selftests: kvm: Introduce the mem_slot_test test
cover selftests: kvm: Introduce the mem_slot_test test
This series introduces a new KVM selftest (mem_slot_test) that goal is to verify memory slots can be added up to the maximum allowed. An extra slot is attempted which should occur on error.
The patch 01 is needed so that the VM fd can be accessed from the test code (for the ioctl call attempting to add an extra slot).
I ran the test successfully on x86_64, aarch64, and s390x. This is why it is enabled to build on those arches.
Finally, I hope it is useful test!
Wainer dos Santos Moschetta (2):
selftests: kvm: Add vm_get_fd() in kvm_util
selftests: kvm: Add mem_slot_test test
tools/testing/selftests/kvm/.gitignore | 1 + tools/testing/selftests/kvm/Makefile | 3 + .../testing/selftests/kvm/include/kvm_util.h | 1 + tools/testing/selftests/kvm/lib/kvm_util.c | 5 + tools/testing/selftests/kvm/mem_slot_test.c | 92 +++++++++++++++++++ 5 files changed, 102 insertions(+) create mode 100644 tools/testing/selftests/kvm/mem_slot_test.c
Signature · 1 line
2.17.2
PATCH 1/2 selftests: kvm: Add vm_get_fd() in kvm_util
Introduces the vm_get_fd() function in kvm_util which returns the VM file descriptor.
--- tools/testing/selftests/kvm/include/kvm_util.h | 1 + tools/testing/selftests/kvm/lib/kvm_util.c | 5 +++++ 2 files changed, 6 insertions(+)
tools/testing/selftests/kvm/include/kvm_util.h +1 -0
@@ -163,6 +163,7 @@ bool vm_is_unrestricted_guest(struct kvm_vm *vm);unsigned int vm_get_page_size (struct kvm_vm *vm);unsigned int vm_get_page_shift (struct kvm_vm *vm);unsigned int vm_get_max_gfn (struct kvm_vm *vm); +unsigned int vm_get_fd (struct kvm_vm *vm);struct kvm_userspace_memory_region * kvm_userspace_memory_region_find(struct kvm_vm *vm, uint64_t start,
tools/testing/selftests/kvm/lib/kvm_util.c +5 -0
@@ -1703,3 +1703,8 @@ unsigned int vm_get_max_gfn(struct kvm_vm *vm) {return vm->max_gfn; } + +unsigned int vm_get_fd (struct kvm_vm *vm) +{ +return vm->fd; +}
Signature · 1 line
2.17.2
Re: [PATCH 1/2] selftests: kvm: Add vm_get_fd() in kvm_util
Quoted 37 lines · Wainer dos Santos Moschetta
Introduces the
vm_get_fd()function inkvm_utilwhich returns the VM file descriptor.Signed-off-by Wainer dos Santos Moschetta <[email protected]>--- tools/testing/selftests/kvm/include/kvm_util.h | 1 + tools/testing/selftests/kvm/lib/kvm_util.c | 5 +++++ 2 files changed, 6 insertions(+)tools/testing/selftests/kvm/include/kvm_util.h +1
-0@@ -163,6 +163,7 @@ bool vm_is_unrestricted_guest(struct kvm_vm *vm);unsigned int vm_get_page_size (struct kvm_vm *vm);unsigned int vm_get_page_shift (struct kvm_vm *vm);unsigned int vm_get_max_gfn (struct kvm_vm *vm); +unsigned int vm_get_fd (struct kvm_vm *vm);struct kvm_userspace_memory_region * kvm_userspace_memory_region_find(struct kvm_vm *vm, uint64_t start,tools/testing/selftests/kvm/lib/kvm_util.c +5
-0@@ -1703,3 +1703,8 @@ unsigned int vm_get_max_gfn(struct kvm_vm *vm) {return vm->max_gfn; } + +unsigned int vm_get_fd (struct kvm_vm *vm) +{ +return vm->fd; +}Signature · 1 line
2.17.2
Please use an int instead of 'unsigned int' to match the fd type.
Thanks,
drew
PATCH 2/2 selftests: kvm: Add mem_slot_test test
In reply to Wainer dos Santos MoschettaThis patch introduces the mem_slot_test test which checks an VM can have added memory slots up to the limit defined in KVM_CAP_NR_MEMSLOTS. Then attempt to add one more slot to verify it fails as expected.
--- tools/testing/selftests/kvm/.gitignore | 1 + tools/testing/selftests/kvm/Makefile | 3 + tools/testing/selftests/kvm/mem_slot_test.c | 92 +++++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 tools/testing/selftests/kvm/mem_slot_test.c
tools/testing/selftests/kvm/.gitignore +1 -0
@@ -17,3 +17,4 @@ /clear_dirty_log_test /dirty_log_test /kvm_create_max_vcpus +/mem_slot_test
tools/testing/selftests/kvm/Makefile +3 -0
@@ -30,16 +30,19 @@ TEST_GEN_PROGS_x86_64 += x86_64/svm_vmcall_test TEST_GEN_PROGS_x86_64 += clear_dirty_log_test TEST_GEN_PROGS_x86_64 += dirty_log_test TEST_GEN_PROGS_x86_64 += kvm_create_max_vcpus +TEST_GEN_PROGS_x86_64 += mem_slot_test TEST_GEN_PROGS_aarch64 += clear_dirty_log_test TEST_GEN_PROGS_aarch64 += dirty_log_test TEST_GEN_PROGS_aarch64 += kvm_create_max_vcpus +TEST_GEN_PROGS_aarch64 += mem_slot_test TEST_GEN_PROGS_s390x = s390x/memop TEST_GEN_PROGS_s390x += s390x/sync_regs_test TEST_GEN_PROGS_s390x += s390x/resets TEST_GEN_PROGS_s390x += dirty_log_test TEST_GEN_PROGS_s390x += kvm_create_max_vcpus +TEST_GEN_PROGS_s390x += mem_slot_test TEST_GEN_PROGS += $(TEST_GEN_PROGS_$(UNAME_M)) LIBKVM += $(LIBKVM_$(UNAME_M))
tools/testing/selftests/kvm/mem_slot_test.c new file +92 -0
92 lines not on this page · raw message
Signature · 1 line
2.17.2
Re: [PATCH 2/2] selftests: kvm: Add mem_slot_test test
Quoted 64 lines · Wainer dos Santos Moschetta
This patch introduces the
mem_slot_testtest which checks an VM can have added memory slots up to the limit defined inKVM_CAP_NR_MEMSLOTS. Then attempt to add one more slot to verify it fails as expected.Signed-off-by Wainer dos Santos Moschetta <[email protected]>--- tools/testing/selftests/kvm/.gitignore | 1 + tools/testing/selftests/kvm/Makefile | 3 + tools/testing/selftests/kvm/mem_slot_test.c | 92 +++++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 tools/testing/selftests/kvm/mem_slot_test.ctools/testing/selftests/kvm/.gitignore +1
-0@@ -17,3 +17,4 @@ /clear_dirty_log_test /dirty_log_test /kvm_create_max_vcpus +/mem_slot_testtools/testing/selftests/kvm/Makefile +3
-0@@ -30,16 +30,19 @@ TEST_GEN_PROGS_x86_64 += x86_64/svm_vmcall_test TEST_GEN_PROGS_x86_64 += clear_dirty_log_test TEST_GEN_PROGS_x86_64 += dirty_log_test TEST_GEN_PROGS_x86_64 += kvm_create_max_vcpus +TEST_GEN_PROGS_x86_64 += mem_slot_test TEST_GEN_PROGS_aarch64 += clear_dirty_log_test TEST_GEN_PROGS_aarch64 += dirty_log_test TEST_GEN_PROGS_aarch64 += kvm_create_max_vcpus +TEST_GEN_PROGS_aarch64 += mem_slot_test TEST_GEN_PROGS_s390x = s390x/memop TEST_GEN_PROGS_s390x += s390x/sync_regs_test TEST_GEN_PROGS_s390x += s390x/resets TEST_GEN_PROGS_s390x += dirty_log_test TEST_GEN_PROGS_s390x += kvm_create_max_vcpus +TEST_GEN_PROGS_s390x += mem_slot_test TEST_GEN_PROGS += $(TEST_GEN_PROGS_$(UNAME_M)) LIBKVM += $(LIBKVM_$(UNAME_M))tools/testing/selftests/kvm/mem_slot_test.c new file +12
-0@@ -0,0 +1,92 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* mem_slot_test +* +* Copyright (C) 2020, Red Hat, Inc. +* +* Test it can be added memory slots up to KVM_CAP_NR_MEMSLOTS, then any +* tentative to add further slots should fail. +*/ +#define _GNU_SOURCE/* for program_invocation_short_name */ +#include <linux/kvm.h> +#include <sys/mman.h>
tools/testing/selftests/kvm/mem_slot_test.c line 22
Quoted 10 lines
tools/testing/selftests/kvm/mem_slot_test.c new file +10
-0+#include <unistd.h> + +#include "test_util.h" +#include "kvm_util.h" + +/* Memory region flags */ +#define MEM_REG_FLAGS KVM_MEM_LOG_DIRTY_PAGES + +/* Guest VM mode */ +#define GUEST_VM_MODE VM_MODE_DEFAULT
I'm not sure what the value of the two defines above are. I'd prefer we avoid unnecessary renaming. Also, do we need KVM_MEM_LOG_DIRTY_PAGES for this test?
Quoted 6 lines
tools/testing/selftests/kvm/mem_slot_test.c new file +6
-0+ +int main (int argc,char *argv[]) +{ +struct kvm_vm *vm; +/* Maximum allowed number of memory slots */ +uint32_t max_mem_slots;
tools/testing/selftests/kvm/mem_slot_test.c line 38
Quoted 10 lines
tools/testing/selftests/kvm/mem_slot_test.c new file +10
-0+/* Slot number */ +uint32_t slot; +/* Number of pages in a memory region */ +uint64_t mem_reg_npages; +/* Memory region size */ +uint64_t mem_reg_size; +/* Guest physical memory guest_address */ +uint64_t guest_addr; +/* VM page size */ +uint64_t vm_page_size;
nit: IMO, the variable names above are descriptive enough to drop the comments.
tools/testing/selftests/kvm/mem_slot_test.c line 44
Quoted 6 lines
tools/testing/selftests/kvm/mem_slot_test.c new file +6
-0+int ret; + + max_mem_slots =kvm_check_cap (KVM_CAP_NR_MEMSLOTS ); +TEST_ASSERT (max_mem_slots >0 , +"KVM_CAP_NR_MEMSLOTS should be greater than 0" ); +DEBUG ("Allowed number of memory slots: %i\n" , max_mem_slots);
DEBUG() no longer exists in kvm/queue. This should now be pr_debug().
Quoted 4 lines
tools/testing/selftests/kvm/mem_slot_test.c new file +4
-0+ + vm =vm_create (GUEST_VM_MODE ,0 ,O_RDWR ); + +/* Determine the minimal number of pages as possible per region. */
tools/testing/selftests/kvm/mem_slot_test.c line 58
Quoted 10 lines
tools/testing/selftests/kvm/mem_slot_test.c new file +10
-0+ vm_page_size =vm_get_page_size (vm); +#ifdef __s390x__ + mem_reg_size =0x100000 ; +#else +uint64_t host_page_size =sysconf (_SC_PAGESIZE); + + mem_reg_size = (host_page_size > vm_page_size) ? host_page_size : + vm_page_size; +#endif + mem_reg_npages = mem_reg_size / vm_page_size;
On kvm/queue the above 11 lines can now all be done with
mem_reg_size = SOME_ARBITRARY_MEM_REG_SIZE; mem_reg_npages = vm_calc_num_guest_pages(VM_MODE_DEFAULT, mem_reg_size);
Quoted 4 lines
tools/testing/selftests/kvm/mem_slot_test.c new file +4
-0+ guest_addr =0x0 ; + +/* Check it can be added memory slots up to the maximum allowed */ + DEBUG("Adding slots 0..%i, each memory region with %ldK size\n",
tools/testing/selftests/kvm/mem_slot_test.c line 72
Quoted 10 lines
tools/testing/selftests/kvm/mem_slot_test.c new file +10
-0+ (max_mem_slots - 1), mem_reg_size >> 10); +for (slot =0 ; slot < max_mem_slots; slot++) { +vm_userspace_mem_region_add (vm,VM_MEM_SRC_ANONYMOUS , + guest_addr, slot, mem_reg_npages, +MEM_REG_FLAGS ); + guest_addr += mem_reg_size; + } + +/* Check it cannot be added memory slots beyond the limit */ + guest_addr += mem_reg_size;
nit: shouldn't be necessary. We already incremented guest_addr on the last loop.
Quoted 4 lines
tools/testing/selftests/kvm/mem_slot_test.c new file +4
-0+void *mem =mmap (NULL , mem_reg_size,PROT_READ |PROT_WRITE , +MAP_PRIVATE |MAP_ANONYMOUS ,-1 ,0 ); +TEST_ASSERT (mem !=NULL ,"Failed to mmap() host" ); +
tools/testing/selftests/kvm/mem_slot_test.c line 86
Quoted 10 lines
tools/testing/selftests/kvm/mem_slot_test.c new file +10
-0+struct kvm_userspace_memory_region kvm_region = { + .slot = slot, + .flags =MEM_REG_FLAGS , + .guest_phys_addr = guest_addr, + .memory_size = mem_reg_size, + .userspace_addr = (uint64_t ) mem, + }; + + ret =ioctl (vm_get_fd (vm),KVM_SET_USER_MEMORY_REGION , &kvm_region); +TEST_ASSERT (ret ==-1 ,"Adding one more memory slot should fail" );
Shouldn't we also check that we get the correct errno?
Quoted 9 lines
tools/testing/selftests/kvm/mem_slot_test.c new file +6
-0+ +munmap (mem, mem_reg_size); +kvm_vm_free (vm); + +return 0 ; +}Signature · 1 line
2.17.2
Thanks,
drew
Re: [PATCH 2/2] selftests: kvm: Add mem_slot_test test
Hi Andrew,
Nice review. Few comments below.
Quoted 70 lines · Andrew Jones
Quoted 69 lines · Wainer dos Santos Moschetta
This patch introduces the
mem_slot_testtest which checks an VM can have added memory slots up to the limit defined inKVM_CAP_NR_MEMSLOTS. Then attempt to add one more slot to verify it fails as expected.Signed-off-by Wainer dos Santos Moschetta <[email protected]>--- tools/testing/selftests/kvm/.gitignore | 1 + tools/testing/selftests/kvm/Makefile | 3 + tools/testing/selftests/kvm/mem_slot_test.c | 92 +++++++++++++++++++++ 3 files changed, 96 insertions(+)create mode 100644
tools/testing/selftests/kvm/mem_slot_test.ctools/testing/selftests/kvm/.gitignore +1
-0@@ -17,3 +17,4 @@ /clear_dirty_log_test /dirty_log_test /kvm_create_max_vcpus +/mem_slot_testtools/testing/selftests/kvm/Makefile +3
-0@@ -30,16 +30,19 @@ TEST_GEN_PROGS_x86_64 += x86_64/svm_vmcall_test TEST_GEN_PROGS_x86_64 += clear_dirty_log_test TEST_GEN_PROGS_x86_64 += dirty_log_test TEST_GEN_PROGS_x86_64 += kvm_create_max_vcpus +TEST_GEN_PROGS_x86_64 += mem_slot_test TEST_GEN_PROGS_aarch64 += clear_dirty_log_test TEST_GEN_PROGS_aarch64 += dirty_log_test TEST_GEN_PROGS_aarch64 += kvm_create_max_vcpus +TEST_GEN_PROGS_aarch64 += mem_slot_test TEST_GEN_PROGS_s390x = s390x/memop TEST_GEN_PROGS_s390x += s390x/sync_regs_test TEST_GEN_PROGS_s390x += s390x/resets TEST_GEN_PROGS_s390x += dirty_log_test TEST_GEN_PROGS_s390x += kvm_create_max_vcpus +TEST_GEN_PROGS_s390x += mem_slot_test TEST_GEN_PROGS += $(TEST_GEN_PROGS_$(UNAME_M)) LIBKVM += $(LIBKVM_$(UNAME_M))tools/testing/selftests/kvm/mem_slot_test.c new file +17
-0@@ -0,0 +1,92 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* mem_slot_test +* +* Copyright (C) 2020, Red Hat, Inc. +* +* Test it can be added memory slots up to KVM_CAP_NR_MEMSLOTS, then any +* tentative to add further slots should fail. +*/ +#define _GNU_SOURCE/* for program_invocation_short_name */ +#include <linux/kvm.h> +#include <sys/mman.h> +#include <unistd.h> + +#include "test_util.h" +#include "kvm_util.h" +
Quoted 8 lines
tools/testing/selftests/kvm/mem_slot_test.c line 22
Quoted 5 lines
tools/testing/selftests/kvm/mem_slot_test.c new file +5
-0+/* Memory region flags */ +#define MEM_REG_FLAGS KVM_MEM_LOG_DIRTY_PAGES + +/* Guest VM mode */ +#define GUEST_VM_MODE VM_MODE_DEFAULTI'm not sure what the value of the two defines above are. I'd prefer we avoid unnecessary renaming. Also, do we need
KVM_MEM_LOG_DIRTY_PAGESfor this test?
It would be nice to exercise the code by adding slots with different page flags. But for this test that simple checks the limit, the use of KVM_MEM_READONLY is enough. I will change it on v2.
Quoted 20 lines
Quoted 7 lines
tools/testing/selftests/kvm/mem_slot_test.c new file +6
-0+ +int main (int argc,char *argv[]) +{ +struct kvm_vm *vm; +/* Maximum allowed number of memory slots */ +uint32_t max_mem_slots;tools/testing/selftests/kvm/mem_slot_test.c line 38
Quoted 10 lines
tools/testing/selftests/kvm/mem_slot_test.c new file +10
-0+/* Slot number */ +uint32_t slot; +/* Number of pages in a memory region */ +uint64_t mem_reg_npages; +/* Memory region size */ +uint64_t mem_reg_size; +/* Guest physical memory guest_address */ +uint64_t guest_addr; +/* VM page size */ +uint64_t vm_page_size;nit: IMO, the variable names above are descriptive enough to drop the comments.
Quoted 7 lines
tools/testing/selftests/kvm/mem_slot_test.c line 44
Quoted 6 lines
tools/testing/selftests/kvm/mem_slot_test.c new file +6
-0+int ret; + + max_mem_slots =kvm_check_cap (KVM_CAP_NR_MEMSLOTS ); +TEST_ASSERT (max_mem_slots >0 , +"KVM_CAP_NR_MEMSLOTS should be greater than 0" ); +DEBUG ("Allowed number of memory slots: %i\n" , max_mem_slots);
DEBUG()no longer exists in kvm/queue. This should now bepr_debug().
Great. I will rebase my code to kvm/queue...
Quoted 20 lines
Quoted 5 lines
tools/testing/selftests/kvm/mem_slot_test.c new file +4
-0+ + vm =vm_create (GUEST_VM_MODE ,0 ,O_RDWR ); + +/* Determine the minimal number of pages as possible per region. */ tools/testing/selftests/kvm/mem_slot_test.c line 58
Quoted 10 lines
tools/testing/selftests/kvm/mem_slot_test.c new file +10
-0+ vm_page_size =vm_get_page_size (vm); +#ifdef __s390x__ + mem_reg_size =0x100000 ; +#else +uint64_t host_page_size =sysconf (_SC_PAGESIZE); + + mem_reg_size = (host_page_size > vm_page_size) ? host_page_size : + vm_page_size; +#endif + mem_reg_npages = mem_reg_size / vm_page_size;On kvm/queue the above 11 lines can now all be done with
mem_reg_size = SOME_ARBITRARY_MEM_REG_SIZE; mem_reg_npages = vm_calc_num_guest_pages(VM_MODE_DEFAULT, mem_reg_size);
Quoted 16 lines
Quoted 4 lines
tools/testing/selftests/kvm/mem_slot_test.c new file +4
-0+ guest_addr =0x0 ; + +/* Check it can be added memory slots up to the maximum allowed */ + DEBUG("Adding slots 0..%i, each memory region with %ldK size\n",tools/testing/selftests/kvm/mem_slot_test.c line 72
Quoted 10 lines
tools/testing/selftests/kvm/mem_slot_test.c new file +10
-0+ (max_mem_slots - 1), mem_reg_size >> 10); +for (slot =0 ; slot < max_mem_slots; slot++) { +vm_userspace_mem_region_add (vm,VM_MEM_SRC_ANONYMOUS , + guest_addr, slot, mem_reg_npages, +MEM_REG_FLAGS ); + guest_addr += mem_reg_size; + } + +/* Check it cannot be added memory slots beyond the limit */ + guest_addr += mem_reg_size;nit: shouldn't be necessary. We already incremented
guest_addron the last loop.
Good catch.
Quoted 16 lines
Quoted 5 lines
tools/testing/selftests/kvm/mem_slot_test.c new file +4
-0+void *mem =mmap (NULL , mem_reg_size,PROT_READ |PROT_WRITE , +MAP_PRIVATE |MAP_ANONYMOUS ,-1 ,0 ); +TEST_ASSERT (mem !=NULL ,"Failed to mmap() host" ); +tools/testing/selftests/kvm/mem_slot_test.c line 86
Quoted 10 lines
tools/testing/selftests/kvm/mem_slot_test.c new file +10
-0+struct kvm_userspace_memory_region kvm_region = { + .slot = slot, + .flags =MEM_REG_FLAGS , + .guest_phys_addr = guest_addr, + .memory_size = mem_reg_size, + .userspace_addr = (uint64_t ) mem, + }; + + ret =ioctl (vm_get_fd (vm),KVM_SET_USER_MEMORY_REGION , &kvm_region); +TEST_ASSERT (ret ==-1 ,"Adding one more memory slot should fail" );Shouldn't we also check that we get the correct errno?
Good idea.
In the kvm API document there isn't any mention to the errno returned but looking at code it seems to be EINVAL for all errors (except for one EEXIST).
Thanks,
Wainer
Quoted 12 lines
Quoted 10 lines
tools/testing/selftests/kvm/mem_slot_test.c new file +6
-0+ +munmap (mem, mem_reg_size); +kvm_vm_free (vm); + +return 0 ; +}Signature · 1 line
2.17.2Thanks,
drew
Re: [PATCH 2/2] selftests: kvm: Add mem_slot_test test
Quoted 3 lines · Wainer dos Santos Moschetta
It would be nice to exercise the code by adding slots with different page flags. But for this test that simple checks the limit, the use of
KVM_MEM_READONLYis enough. I will change it on v2.
It would be good to test more memslot error conditions as well. Do you plan to expand on this test?
Thanks,
drew
Re: [PATCH 2/2] selftests: kvm: Add mem_slot_test test
Quoted 6 lines · Andrew Jones
Quoted 3 lines · Wainer dos Santos Moschetta
It would be nice to exercise the code by adding slots with different page flags. But for this test that simple checks the limit, the use of
KVM_MEM_READONLYis enough. I will change it on v2.It would be good to test more memslot error conditions as well. Do you plan to expand on this test?
Yes, I do. For example, check memory slots addresses can't overlap.
Quoted 3 lines
Thanks,
drew
Re: [PATCH 2/2] selftests: kvm: Add mem_slot_test test
In reply to Wainer dos Santos MoschettaQuoted 5 lines · Wainer dos Santos Moschetta
This patch introduces the
mem_slot_testtest which checks an VM can have added memory slots up to the limit defined inKVM_CAP_NR_MEMSLOTS. Then attempt to add one more slot to verify it fails as expected.
Quoted 8 lines
Signed-off-by Wainer dos Santos Moschetta <[email protected]>--- tools/testing/selftests/kvm/.gitignore | 1 + tools/testing/selftests/kvm/Makefile | 3 + tools/testing/selftests/kvm/mem_slot_test.c | 92 +++++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 tools/testing/selftests/kvm/mem_slot_test.c
BTW, in kvm/queue we also now have
x86_64/set_memory_region_test.c
I wonder if we shouldn't try to make x86_64/set_memory_region_test.c arch-neutral and then integrate this new test with it.
Thanks,
drew
Re: [PATCH 2/2] selftests: kvm: Add mem_slot_test test
Quoted 14 lines · Andrew Jones
Quoted 5 lines · Wainer dos Santos Moschetta
This patch introduces the
mem_slot_testtest which checks an VM can have added memory slots up to the limit defined inKVM_CAP_NR_MEMSLOTS. Then attempt to add one more slot to verify it fails as expected.Quoted 8 lines
Signed-off-by Wainer dos Santos Moschetta <[email protected]>--- tools/testing/selftests/kvm/.gitignore | 1 + tools/testing/selftests/kvm/Makefile | 3 + tools/testing/selftests/kvm/mem_slot_test.c | 92 +++++++++++++++++++++ 3 files changed, 96 insertions(+)create mode 100644
tools/testing/selftests/kvm/mem_slot_test.c
Quoted 6 lines
BTW, in kvm/queue we also now have
x86_64/set_memory_region_test.cI wonder if we shouldn't try to make
x86_64/set_memory_region_test.carch-neutral and then integrate this new test with it.
When I started work on this test I called it "add_max_mem_slots" but then I realized it could be rather a suite for other tests, so it was renamed. So yes, I think we can try to merge those memory region tests altogether.
I'm about to send a v2 where I address all your comments and hopefully we can use as the base for such as integration. Makes sense?
Thanks!
- Wainer
Quoted 3 lines
Thanks,
drew
Re: [PATCH 2/2] selftests: kvm: Add mem_slot_test test
Quoted 23 lines · Wainer dos Santos Moschetta
Quoted 14 lines · Andrew Jones
Quoted 5 lines · Wainer dos Santos Moschetta
This patch introduces the
mem_slot_testtest which checks an VM can have added memory slots up to the limit defined inKVM_CAP_NR_MEMSLOTS. Then attempt to add one more slot to verify it fails as expected.Quoted 8 lines
Signed-off-by Wainer dos Santos Moschetta <[email protected]>--- tools/testing/selftests/kvm/.gitignore | 1 + tools/testing/selftests/kvm/Makefile | 3 + tools/testing/selftests/kvm/mem_slot_test.c | 92 +++++++++++++++++++++ 3 files changed, 96 insertions(+)create mode 100644
tools/testing/selftests/kvm/mem_slot_test.cQuoted 6 lines
BTW, in kvm/queue we also now have
x86_64/set_memory_region_test.cI wonder if we shouldn't try to make
x86_64/set_memory_region_test.carch-neutral and then integrate this new test with it.
Quoted 6 lines
When I started work on this test I called it "
add_max_mem_slots" but then I realized it could be rather a suite for other tests, so it was renamed. So yes, I think we can try to merge those memory region tests altogether.I'm about to send a v2 where I address all your comments and hopefully we can use as the base for such as integration. Makes sense?
OK, but there's no rush (at least for me) for v2. If you want to look at integration for v2 and send it later, then I'm fine with waiting.
Thanks,
drew
Quoted 10 lines
Thanks!
- Wainer
Quoted 3 lines
Thanks,
drew