Skip to content

Commit 000ac42

Browse files
committed
selftests: kvm: fix overlapping addresses in memslot_perf_test
vm_create allocates memory and maps it close to GPA. This memory is separate from what is allocated in subsequent calls to vm_userspace_mem_region_add, so it is incorrect to pass the test memory size to vm_create_default. Just pass a small fixed amount of memory which can be used later for page table, otherwise GPAs are already allocated at MEM_GPA and the test aborts. Signed-off-by: Paolo Bonzini <[email protected]>
1 parent a3d2ec9 commit 000ac42

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/testing/selftests/kvm/memslot_perf_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ static bool prepare_vm(struct vm_data *data, int nslots, uint64_t *maxslots,
267267
data->hva_slots = malloc(sizeof(*data->hva_slots) * data->nslots);
268268
TEST_ASSERT(data->hva_slots, "malloc() fail");
269269

270-
data->vm = vm_create_default(VCPU_ID, mempages, guest_code);
270+
data->vm = vm_create_default(VCPU_ID, 1024, guest_code);
271271

272272
pr_info_v("Adding slots 1..%i, each slot with %"PRIu64" pages + %"PRIu64" extra pages last\n",
273273
max_mem_slots - 1, data->pages_per_slot, rempages);

0 commit comments

Comments
 (0)