From: sashiko-bot@kernel.org
To: "Yosry Ahmed" <yosry@kernel.org>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v4 12/12] KVM: selftests: Trigger L2->L1 exits stress save+restore and #PF test
Date: Tue, 28 Jul 2026 00:09:24 +0000 [thread overview]
Message-ID: <20260728000925.3C6051F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260727235228.1007324-13-yosry@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The test unconditionally enables `KVM_CAP_EXCEPTION_PAYLOAD` in `run_test()`, causing the test to crash on older kernels before reaching the capability check in `main()`.
--
--- Patch [12]: [PATCH v4 12/12] KVM: selftests: Trigger L2->L1 exits stress save+restore and #PF test ---
commit 30592840747b18628e46af30e613a95b722da3cc
Author: Yosry Ahmed <yosry@kernel.org>
KVM: selftests: Trigger L2->L1 exits stress save+restore and #PF test
This commit extends the testing coverage in L2 by forcing a nested VM-Exit
from L2 to L1 right after restore on every other iteration. To force the
nested VM-Exit, it injects a #UD into the saved vCPU state and intercepts
#UD from L1.
> diff --git a/tools/testing/selftests/kvm/x86/save_restore_pf_stress_test.c b/tools/testing/selftests/kvm/x86/save_restore_pf_stress_test.c
> index 0e5ddeb5af444..ba1d723001e94 100644
> --- a/tools/testing/selftests/kvm/x86/save_restore_pf_stress_test.c
> +++ b/tools/testing/selftests/kvm/x86/save_restore_pf_stress_test.c
[ ... ]
> @@ -156,6 +178,7 @@ static void run_test(bool nested)
>
> vm = vm_create_with_one_vcpu(&vcpu, nested ? l1_guest_code : guest_access_memory);
> vm_install_exception_handler(vm, PF_VECTOR, guest_pf_handler);
> + vm_enable_cap(vm, KVM_CAP_EXCEPTION_PAYLOAD, -2ul);
>
> if (nested) {
> if (kvm_cpu_has(X86_FEATURE_SVM))
[ ... ]
> @@ -247,7 +278,9 @@ int main(int argc, char *argv[])
> pr_info("Running save+restore stress test...\n");
> run_test(/*nested=*/false);
>
> - if (!kvm_cpu_has(X86_FEATURE_SVM) && !kvm_cpu_has(X86_FEATURE_VMX)) {
> + if (!kvm_has_cap(KVM_CAP_EXCEPTION_PAYLOAD) ||
> + !kvm_has_cap(KVM_CAP_NESTED_STATE) ||
> + (!kvm_cpu_has(X86_FEATURE_SVM) && !kvm_cpu_has(X86_FEATURE_VMX))) {
[Severity: Medium]
Will this test crash on older kernels that lack KVM_CAP_EXCEPTION_PAYLOAD?
Because run_test(false) is called before this capability check in main(),
run_test() will unconditionally call vm_enable_cap() for
KVM_CAP_EXCEPTION_PAYLOAD.
Could this prevent the test from gracefully skipping on environments without
this capability?
> pr_info("Nested virtualization not supported, skipping nested test\n");
> return 0;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260727235228.1007324-1-yosry@kernel.org?part=12
next prev parent reply other threads:[~2026-07-28 0:09 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-27 23:52 [PATCH v4 00/12] KVM: selftests: Stress save+restore and #PF (ft. nested) Yosry Ahmed
2026-07-27 23:52 ` [PATCH v4 01/12] KVM: selftests: Use __stringify() instead of custom XSTR() macros Yosry Ahmed
2026-07-27 23:52 ` [PATCH v4 02/12] KVM: selftests: Fix RAX and RFLAGS VMCB offsets when running L2 Yosry Ahmed
2026-07-28 0:07 ` sashiko-bot
2026-07-28 0:29 ` Yosry Ahmed
2026-07-27 23:52 ` [PATCH v4 03/12] KVM: selftests: Rework GPR registers switching for SVM (and fix offsets) Yosry Ahmed
2026-07-27 23:52 ` [PATCH v4 04/12] KVM: selftests: Handle rflags save/restore for SVM in guest_regs Yosry Ahmed
2026-07-27 23:52 ` [PATCH v4 05/12] KVM: selftests: Reuse GPR switching logic for nVMX Yosry Ahmed
2026-07-28 0:05 ` sashiko-bot
2026-07-28 0:30 ` Yosry Ahmed
2026-07-27 23:52 ` [PATCH v4 06/12] KVM: selftests: Drop HORRIFIC_L2_UCALL_CLOBBER_HACK Yosry Ahmed
2026-07-27 23:52 ` [PATCH v4 07/12] KVM: selftests: Add a blank line before logging assertion failures Yosry Ahmed
2026-07-27 23:52 ` [PATCH v4 08/12] KVM: selftests: Expose PTE masks to guests as part of an MMU Yosry Ahmed
2026-07-27 23:52 ` [PATCH v4 09/12] KVM: selftests: Add basic stress test for save+restore and #PF handling Yosry Ahmed
2026-07-27 23:52 ` [PATCH v4 10/12] KVM: selftests: Trigger save+restore randomly in the #PF stress test Yosry Ahmed
2026-07-27 23:52 ` [PATCH v4 11/12] KVM: selftests: Support running stress save+restore and #PF test in L2 Yosry Ahmed
2026-07-27 23:52 ` [PATCH v4 12/12] KVM: selftests: Trigger L2->L1 exits stress save+restore and #PF test Yosry Ahmed
2026-07-28 0:09 ` sashiko-bot [this message]
2026-07-28 0:31 ` Yosry Ahmed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260728000925.3C6051F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=yosry@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox