Add a new user option to memslot_modification_stress_test to allow testing
with slot zap quirk KVM_X86_QUIRK_SLOT_ZAP_ALL disabled.
Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>
---
.../kvm/memslot_modification_stress_test.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/kvm/memslot_modification_stress_test.c b/tools/testing/selftests/kvm/memslot_modification_stress_test.c
index 05fcf902e067..c6f22ded4c96 100644
--- a/tools/testing/selftests/kvm/memslot_modification_stress_test.c
+++ b/tools/testing/selftests/kvm/memslot_modification_stress_test.c
@@ -85,6 +85,7 @@ struct test_params {
useconds_t delay;
uint64_t nr_iterations;
bool partition_vcpu_memory_access;
+ bool disable_slot_zap_quirk;
};
static void run_test(enum vm_guest_mode mode, void *arg)
@@ -95,6 +96,13 @@ static void run_test(enum vm_guest_mode mode, void *arg)
vm = memstress_create_vm(mode, nr_vcpus, guest_percpu_mem_size, 1,
VM_MEM_SRC_ANONYMOUS,
p->partition_vcpu_memory_access);
+#ifdef __x86_64__
+ if (p->disable_slot_zap_quirk)
+ vm_enable_cap(vm, KVM_CAP_DISABLE_QUIRKS2, KVM_X86_QUIRK_SLOT_ZAP_ALL);
+
+ pr_info("Memslot zap quirk %s\n", p->disable_slot_zap_quirk ?
+ "disabled" : "enabled");
+#endif
pr_info("Finished creating vCPUs\n");
@@ -113,11 +121,12 @@ static void run_test(enum vm_guest_mode mode, void *arg)
static void help(char *name)
{
puts("");
- printf("usage: %s [-h] [-m mode] [-d delay_usec]\n"
+ printf("usage: %s [-h] [-m mode] [-d delay_usec] [-q]\n"
" [-b memory] [-v vcpus] [-o] [-i iterations]\n", name);
guest_modes_help();
printf(" -d: add a delay between each iteration of adding and\n"
" deleting a memslot in usec.\n");
+ printf(" -q: Disable memslot zap quirk.\n");
printf(" -b: specify the size of the memory region which should be\n"
" accessed by each vCPU. e.g. 10M or 3G.\n"
" Default: 1G\n");
@@ -143,7 +152,7 @@ int main(int argc, char *argv[])
guest_modes_append_default();
- while ((opt = getopt(argc, argv, "hm:d:b:v:oi:")) != -1) {
+ while ((opt = getopt(argc, argv, "hm:d:qb:v:oi:")) != -1) {
switch (opt) {
case 'm':
guest_modes_cmdline(optarg);
@@ -166,6 +175,12 @@ int main(int argc, char *argv[])
case 'i':
p.nr_iterations = atoi_positive("Number of iterations", optarg);
break;
+ case 'q':
+ p.disable_slot_zap_quirk = true;
+
+ TEST_REQUIRE(kvm_check_cap(KVM_CAP_DISABLE_QUIRKS2) &
+ KVM_X86_QUIRK_SLOT_ZAP_ALL);
+ break;
case 'h':
default:
help(argv[0]);
--
2.43.2
On 03/07/2024 03:12, Yan Zhao wrote:
> Add a new user option to memslot_modification_stress_test to allow testing
> with slot zap quirk KVM_X86_QUIRK_SLOT_ZAP_ALL disabled.
>
> Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>
> ---
> .../kvm/memslot_modification_stress_test.c | 19 +++++++++++++++++--
Hi Yan,
When building kselftest-kvm config against next-20240924 kernel with
Arm64 an error "'KVM_X86_QUIRK_SLOT_ZAP_ALL' undeclared" is observed.
A bisect identified 218f6415004a881d116e254eeb837358aced55ab as the
first bad commit. Bisected it on the tag "next-20240923" at repo
"https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git".
Reverting the change seems to fix it.
This works fine on Linux version 6.11
Failure log
------------
https://storage.kernelci.org/next/master/next-20240924/arm64/defconfig+kselftest/gcc-12/logs/kselftest.log
In file included from include/kvm_util.h:8,
from include/memstress.h:13,
from memslot_modification_stress_test.c:21:
memslot_modification_stress_test.c: In function ‘main’:
memslot_modification_stress_test.c:176:38: error:
‘KVM_X86_QUIRK_SLOT_ZAP_ALL’ undeclared (first use in this function)
176 | KVM_X86_QUIRK_SLOT_ZAP_ALL);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
include/test_util.h:41:15: note: in definition of macro ‘__TEST_REQUIRE’
41 | if (!(f)) \
| ^
memslot_modification_stress_test.c:175:25: note: in expansion of macro
‘TEST_REQUIRE’
175 |
TEST_REQUIRE(kvm_check_cap(KVM_CAP_DISABLE_QUIRKS2) &
| ^~~~~~~~~~~~
memslot_modification_stress_test.c:176:38: note: each undeclared
identifier is reported only once for each function it appears in
176 | KVM_X86_QUIRK_SLOT_ZAP_ALL);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
include/test_util.h:41:15: note: in definition of macro ‘__TEST_REQUIRE’
41 | if (!(f)) \
| ^
memslot_modification_stress_test.c:175:25: note: in expansion of macro
‘TEST_REQUIRE’
175 |
TEST_REQUIRE(kvm_check_cap(KVM_CAP_DISABLE_QUIRKS2) &
| ^~~~~~~~~~~~
At top level:
cc1: note: unrecognized command-line option
‘-Wno-gnu-variable-sized-type-not-at-end’ may have been intended to
silence earlier diagnostics
make[4]: *** [Makefile:300:
/tmp/kci/linux/build/kselftest/kvm/memslot_modification_stress_test.o]
Error 1
make[4]: Leaving directory '/tmp/kci/linux/tools/testing/selftests/kvm'
Bisect log:
----------
git bisect start
# good: [98f7e32f20d28ec452afb208f9cffc08448a2652] Linux 6.11
git bisect good 98f7e32f20d28ec452afb208f9cffc08448a2652
# bad: [ef545bc03a65438cabe87beb1b9a15b0ffcb6ace] Add linux-next
specific files for 20240923
git bisect bad ef545bc03a65438cabe87beb1b9a15b0ffcb6ace
# good: [176000734ee2978121fde22a954eb1eabb204329] Merge tag
'ata-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux
git bisect good 176000734ee2978121fde22a954eb1eabb204329
# good: [f55bf3fb11d7fe32a37b8d625744d22891c02e5e] Merge branch
'at91-next' of git://git.kernel.org/pub/scm/linux/kernel/git/at91/linux.git
git bisect good f55bf3fb11d7fe32a37b8d625744d22891c02e5e
# good: [1340ff0aa9e6dcb9c8ac5f86472eb78ba524b14a] Merge branch
'for-next' of git://git.kernel.dk/linux-block.git
git bisect good 1340ff0aa9e6dcb9c8ac5f86472eb78ba524b14a
# bad: [51d98f15885e036a06fef35c396c987e80c47a27] Merge branch
'char-misc-next' of
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
git bisect bad 51d98f15885e036a06fef35c396c987e80c47a27
# bad: [4f216a17ef0dc3bf99c28902abbc6c70fb7798a0] Merge branch
'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
git bisect bad 4f216a17ef0dc3bf99c28902abbc6c70fb7798a0
# bad: [b11ba58b0ef5c932303dac5ce96e17d96c127870] Merge branch 'next' of
git://git.kernel.org/pub/scm/virt/kvm/kvm.git
git bisect bad b11ba58b0ef5c932303dac5ce96e17d96c127870
# good: [b7ba28772e5709196e3efffb9341c7fd698b2497] Merge branch
'for-next' of
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
git bisect good b7ba28772e5709196e3efffb9341c7fd698b2497
# bad: [c345344e8317176944be33f46e18812c0343dc63] Merge tag
'kvm-x86-selftests-6.12' of https://github.com/kvm-x86/linux into HEAD
git bisect bad c345344e8317176944be33f46e18812c0343dc63
# bad: [7056c4e2a13a61f4e8a9e8ce27cd499f27e0e63b] Merge tag
'kvm-x86-generic-6.12' of https://github.com/kvm-x86/linux into HEAD
git bisect bad 7056c4e2a13a61f4e8a9e8ce27cd499f27e0e63b
# bad: [590b09b1d88e18ae57f89930a6f7b89795d2e9f3] KVM: x86: Register
"emergency disable" callbacks when virt is enabled
git bisect bad 590b09b1d88e18ae57f89930a6f7b89795d2e9f3
# bad: [70c0194337d38dd29533e63e3cb07620f8c5eae1] KVM: Rename symbols
related to enabling virtualization hardware
git bisect bad 70c0194337d38dd29533e63e3cb07620f8c5eae1
# bad: [218f6415004a881d116e254eeb837358aced55ab] KVM: selftests: Allow
slot modification stress test with quirk disabled
git bisect bad 218f6415004a881d116e254eeb837358aced55ab
# good: [b4ed2c67d275b85b2ab07d54f88bebd5998d61d8] KVM: selftests: Test
slot move/delete with slot zap quirk enabled/disabled
git bisect good b4ed2c67d275b85b2ab07d54f88bebd5998d61d8
# first bad commit: [218f6415004a881d116e254eeb837358aced55ab] KVM:
selftests: Allow slot modification stress test with quirk disabled
Thanks,
Aishwarya
On Tue, Sep 24, 2024 at 01:26:20PM +0100, Aishwarya TCV wrote:
>
>
> On 03/07/2024 03:12, Yan Zhao wrote:
> > Add a new user option to memslot_modification_stress_test to allow testing
> > with slot zap quirk KVM_X86_QUIRK_SLOT_ZAP_ALL disabled.
> >
> > Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>
> > ---
> > .../kvm/memslot_modification_stress_test.c | 19 +++++++++++++++++--
> Hi Yan,
>
> When building kselftest-kvm config against next-20240924 kernel with
> Arm64 an error "'KVM_X86_QUIRK_SLOT_ZAP_ALL' undeclared" is observed.
Ah, I forgot to hide
"TEST_REQUIRE(kvm_check_cap(KVM_CAP_DISABLE_QUIRKS2) &
KVM_X86_QUIRK_SLOT_ZAP_ALL)"
inside "#ifdef __x86_64__" when parsing opts though it's done in run_test().
>
> A bisect identified 218f6415004a881d116e254eeb837358aced55ab as the
> first bad commit. Bisected it on the tag "next-20240923" at repo
> "https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git".
> Reverting the change seems to fix it.
>
> This works fine on Linux version 6.11
>
> Failure log
> ------------
> https://storage.kernelci.org/next/master/next-20240924/arm64/defconfig+kselftest/gcc-12/logs/kselftest.log
>
> In file included from include/kvm_util.h:8,
> from include/memstress.h:13,
> from memslot_modification_stress_test.c:21:
> memslot_modification_stress_test.c: In function ‘main’:
> memslot_modification_stress_test.c:176:38: error:
> ‘KVM_X86_QUIRK_SLOT_ZAP_ALL’ undeclared (first use in this function)
> 176 | KVM_X86_QUIRK_SLOT_ZAP_ALL);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~
> include/test_util.h:41:15: note: in definition of macro ‘__TEST_REQUIRE’
> 41 | if (!(f)) \
> | ^
> memslot_modification_stress_test.c:175:25: note: in expansion of macro
> ‘TEST_REQUIRE’
> 175 |
> TEST_REQUIRE(kvm_check_cap(KVM_CAP_DISABLE_QUIRKS2) &
> | ^~~~~~~~~~~~
> memslot_modification_stress_test.c:176:38: note: each undeclared
> identifier is reported only once for each function it appears in
> 176 | KVM_X86_QUIRK_SLOT_ZAP_ALL);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~
> include/test_util.h:41:15: note: in definition of macro ‘__TEST_REQUIRE’
> 41 | if (!(f)) \
> | ^
> memslot_modification_stress_test.c:175:25: note: in expansion of macro
> ‘TEST_REQUIRE’
> 175 |
> TEST_REQUIRE(kvm_check_cap(KVM_CAP_DISABLE_QUIRKS2) &
> | ^~~~~~~~~~~~
> At top level:
> cc1: note: unrecognized command-line option
> ‘-Wno-gnu-variable-sized-type-not-at-end’ may have been intended to
> silence earlier diagnostics
> make[4]: *** [Makefile:300:
> /tmp/kci/linux/build/kselftest/kvm/memslot_modification_stress_test.o]
> Error 1
> make[4]: Leaving directory '/tmp/kci/linux/tools/testing/selftests/kvm'
>
>
> Bisect log:
> ----------
>
> git bisect start
> # good: [98f7e32f20d28ec452afb208f9cffc08448a2652] Linux 6.11
> git bisect good 98f7e32f20d28ec452afb208f9cffc08448a2652
> # bad: [ef545bc03a65438cabe87beb1b9a15b0ffcb6ace] Add linux-next
> specific files for 20240923
> git bisect bad ef545bc03a65438cabe87beb1b9a15b0ffcb6ace
> # good: [176000734ee2978121fde22a954eb1eabb204329] Merge tag
> 'ata-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux
> git bisect good 176000734ee2978121fde22a954eb1eabb204329
> # good: [f55bf3fb11d7fe32a37b8d625744d22891c02e5e] Merge branch
> 'at91-next' of git://git.kernel.org/pub/scm/linux/kernel/git/at91/linux.git
> git bisect good f55bf3fb11d7fe32a37b8d625744d22891c02e5e
> # good: [1340ff0aa9e6dcb9c8ac5f86472eb78ba524b14a] Merge branch
> 'for-next' of git://git.kernel.dk/linux-block.git
> git bisect good 1340ff0aa9e6dcb9c8ac5f86472eb78ba524b14a
> # bad: [51d98f15885e036a06fef35c396c987e80c47a27] Merge branch
> 'char-misc-next' of
> git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
> git bisect bad 51d98f15885e036a06fef35c396c987e80c47a27
> # bad: [4f216a17ef0dc3bf99c28902abbc6c70fb7798a0] Merge branch
> 'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
> git bisect bad 4f216a17ef0dc3bf99c28902abbc6c70fb7798a0
> # bad: [b11ba58b0ef5c932303dac5ce96e17d96c127870] Merge branch 'next' of
> git://git.kernel.org/pub/scm/virt/kvm/kvm.git
> git bisect bad b11ba58b0ef5c932303dac5ce96e17d96c127870
> # good: [b7ba28772e5709196e3efffb9341c7fd698b2497] Merge branch
> 'for-next' of
> git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
> git bisect good b7ba28772e5709196e3efffb9341c7fd698b2497
> # bad: [c345344e8317176944be33f46e18812c0343dc63] Merge tag
> 'kvm-x86-selftests-6.12' of https://github.com/kvm-x86/linux into HEAD
> git bisect bad c345344e8317176944be33f46e18812c0343dc63
> # bad: [7056c4e2a13a61f4e8a9e8ce27cd499f27e0e63b] Merge tag
> 'kvm-x86-generic-6.12' of https://github.com/kvm-x86/linux into HEAD
> git bisect bad 7056c4e2a13a61f4e8a9e8ce27cd499f27e0e63b
> # bad: [590b09b1d88e18ae57f89930a6f7b89795d2e9f3] KVM: x86: Register
> "emergency disable" callbacks when virt is enabled
> git bisect bad 590b09b1d88e18ae57f89930a6f7b89795d2e9f3
> # bad: [70c0194337d38dd29533e63e3cb07620f8c5eae1] KVM: Rename symbols
> related to enabling virtualization hardware
> git bisect bad 70c0194337d38dd29533e63e3cb07620f8c5eae1
> # bad: [218f6415004a881d116e254eeb837358aced55ab] KVM: selftests: Allow
> slot modification stress test with quirk disabled
> git bisect bad 218f6415004a881d116e254eeb837358aced55ab
> # good: [b4ed2c67d275b85b2ab07d54f88bebd5998d61d8] KVM: selftests: Test
> slot move/delete with slot zap quirk enabled/disabled
> git bisect good b4ed2c67d275b85b2ab07d54f88bebd5998d61d8
> # first bad commit: [218f6415004a881d116e254eeb837358aced55ab] KVM:
> selftests: Allow slot modification stress test with quirk disabled
>
> Thanks,
> Aishwarya
>
On Wed, Sep 25, 2024 at 08:42:56AM +0800, Yan Zhao wrote: > On Tue, Sep 24, 2024 at 01:26:20PM +0100, Aishwarya TCV wrote: > > On 03/07/2024 03:12, Yan Zhao wrote: > > > Add a new user option to memslot_modification_stress_test to allow testing > > > with slot zap quirk KVM_X86_QUIRK_SLOT_ZAP_ALL disabled. > > > Signed-off-by: Yan Zhao <yan.y.zhao@intel.com> > > When building kselftest-kvm config against next-20240924 kernel with > > Arm64 an error "'KVM_X86_QUIRK_SLOT_ZAP_ALL' undeclared" is observed. > Ah, I forgot to hide > "TEST_REQUIRE(kvm_check_cap(KVM_CAP_DISABLE_QUIRKS2) & > KVM_X86_QUIRK_SLOT_ZAP_ALL)" > inside "#ifdef __x86_64__" when parsing opts though it's done in run_test(). This bug, which Aishwarya originally reported against -next, is now present in mainline: https://storage.kernelci.org/mainline/master/v6.12-rc1/arm64/defconfig+kselftest/gcc-12/logs/kselftest.log I couldn't find a fix being posted so I sent: https://lore.kernel.org/r/20240930-kvm-build-breakage-v1-1-866fad3cc164@kernel.org which also fixes the same issue in memslot_perf_test.c.
© 2016 - 2025 Red Hat, Inc.