From: sashiko-bot@kernel.org
To: "Sean Christopherson" <seanjc@google.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v4 5/6] KVM: selftests: Refactor invalid nVMX state test to prepare for RSM testcase
Date: Tue, 28 Jul 2026 00:51:42 +0000 [thread overview]
Message-ID: <20260728005142.E8F9D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260728004351.887076-6-seanjc@google.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The assertion failure message in `vcpu_run_to_io` hardcodes 'L2' as the expected guest level, ignoring the `want_l2` parameter.
--
--- Patch [5]: [PATCH v4 5/6] KVM: selftests: Refactor invalid nVMX state test to prepare for RSM testcase ---
commit 7bfb34d63ffa2d4c98580f574a703358bca449c2
Author: Sean Christopherson <seanjc@google.com>
KVM: selftests: Refactor invalid nVMX state test to prepare for RSM testcase
This commit extracts the VM creation and initial vCPU execution logic into
helper functions to allow reuse for a future RSM testcase. It also eliminates
the global vm variable and adds an assertion to ensure L2 is never resumed
after an I/O exit to L1.
> diff --git a/tools/testing/selftests/kvm/x86/vmx_invalid_nested_guest_state.c b/tools/testing/selftests/kvm/x86/vmx_invalid_nested_guest_state.c
> --- a/tools/testing/selftests/kvm/x86/vmx_invalid_nested_guest_state.c
> +++ b/tools/testing/selftests/kvm/x86/vmx_invalid_nested_guest_state.c
[ ... ]
> +static void vcpu_run_to_io(struct kvm_vcpu *vcpu, bool want_l2)
> {
> - gva_t vmx_pages_gva;
> - struct kvm_sregs sregs;
> - struct kvm_vcpu *vcpu;
> - struct kvm_run *run;
> - struct ucall uc;
> + struct kvm_run *run = vcpu->run;
>
> - TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_VMX));
> + vcpu_run(vcpu);
>
> - vm = vm_create_with_one_vcpu(&vcpu, l1_guest_code);
> + TEST_ASSERT_KVM_EXIT_REASON(vcpu, KVM_EXIT_IO);
>
> - /* Allocate VMX pages and shared descriptors (vmx_pages). */
> - vcpu_alloc_vmx(vm, &vmx_pages_gva);
> - vcpu_args_set(vcpu, 1, vmx_pages_gva);
> + TEST_ASSERT(run->io.port == ARBITRARY_IO_PORT &&
> + (!!(run->flags & KVM_RUN_X86_GUEST_MODE) == want_l2 ||
> + !kvm_has_cap(KVM_CAP_X86_GUEST_MODE)),
> + "Expected IN from port %d from L2, got port %d from L%u",
[Severity: Low]
Is the hardcoded "from L2" in the expected message string intentional?
Since vcpu_run_to_io() is a helper that takes a want_l2 parameter, the error
output could be misleading if a test calls it expecting an exit from L1.
Would it make sense to dynamically print L1 or L2 in the failure message
based on the want_l2 parameter?
> + ARBITRARY_IO_PORT, run->io.port,
> + 1 + !!(run->flags & KVM_RUN_X86_GUEST_MODE));
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260728004351.887076-1-seanjc@google.com?part=5
next prev parent reply other threads:[~2026-07-28 0:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 0:43 [PATCH v4 0/6] KVM: nVMX: Synthesize SHUTDOWN on RSM with bad state Sean Christopherson
2026-07-28 0:43 ` [PATCH v4 1/6] KVM: x86: Extract VMX's unhandleable emulation check to common x86 Sean Christopherson
2026-07-28 0:58 ` sashiko-bot
2026-07-28 1:01 ` Sean Christopherson
2026-07-28 0:43 ` [PATCH v4 2/6] KVM: nVMX: Synthesize SHUTDOWN on RSM if L2 requires emulation Sean Christopherson
2026-07-28 0:43 ` [PATCH v4 3/6] KVM: x86: Rework kvm_x86_ops.vcpu_pre_run() into .vcpu_needs_initialization() Sean Christopherson
2026-07-28 0:43 ` [PATCH v4 4/6] KVM: selftests: Use port 0x80 in invalid nVMX guest state test Sean Christopherson
2026-07-28 0:43 ` [PATCH v4 5/6] KVM: selftests: Refactor invalid nVMX state test to prepare for RSM testcase Sean Christopherson
2026-07-28 0:51 ` sashiko-bot [this message]
2026-07-28 0:43 ` [PATCH v4 6/6] KVM: selftests: Extend the invalid nVMX guest state test to cover RSM Sean Christopherson
2026-07-28 3:01 ` Hao Zhang
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=20260728005142.E8F9D1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=seanjc@google.com \
/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