From: sashiko-bot@kernel.org
To: "David Woodhouse" <dwmw2@infradead.org>, kvm@vger.kernel.org
Cc: linux-hyperv@vger.kernel.org
Subject: Re: [PATCH v2 4/4] KVM: selftests: Add Hyper-V hypercall forwarding test
Date: Fri, 13 Nov 2026 17:22:16 +0000 [thread overview]
Message-ID: <sashiko-outbox-213294@kernel.org> (raw)
In-Reply-To: <20261113170535.79246-5-dwmw2@infradead.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] KVM: selftests: missing volatile and XMM constraints in
guest_code()
--
commit e7e0d35b7ca4b9fc386b6fe7a75c6cc9bf38431a
Author: David Woodhouse <dwmw@amazon.co.uk>
KVM: selftests: Add Hyper-V hypercall forwarding test
This commit adds a KVM selftest covering KVM_CAP_HYPERV_FORWARD_HCALL for
memory-based and fast hypercall exits as well as hypercall completion
cancellation via KVM_SET_VCPU_EVENTS.
> diff --git a/tools/testing/selftests/kvm/x86/hyperv_forward_hcall.c b/tools/testing/selftests/kvm/x86/hyperv_forward_hcall.c
> new file mode 100644
> index 0000000000000..4c290b6a10122
> --- /dev/null
> +++ b/tools/testing/selftests/kvm/x86/hyperv_forward_hcall.c
> @@ -0,0 +1,337 @@
[ ... ]
> +static void guest_code(gpa_t pgs_gpa)
> +{
> + __sse128_u in, out;
> + u64 status;
> + u8 vector;
[ ... ]
> + /*
> + * Fast form: the register parameters and XMM0 reach userspace, and
> + * the XMM1 value userspace writes reaches the guest.
> + */
> + in.as_u64[0] = XMM_IN_MARKER;
> + in.as_u64[1] = XMM_IN_MARKER + 1;
> + out.as_u64[0] = 0;
> + out.as_u64[1] = 0;
> + write_sse_reg(0, &in.vec);
> + write_sse_reg(1, &out.vec);
> + vector = __hyperv_hypercall(HVCALL_TEST_CODE | HV_HYPERCALL_FAST_BIT,
> + FAST_PARAM0, FAST_PARAM1, &status);
> + read_sse_reg(1, &out.vec);
> + GUEST_ASSERT(!vector);
> + GUEST_ASSERT_EQ(status, USERSPACE_STATUS);
> + GUEST_ASSERT_EQ(out.as_u64[0], XMM_OUT_MARKER);
> + GUEST_ASSERT_EQ(out.as_u64[1], XMM_OUT_MARKER + 1);
> + GUEST_SYNC(STAGE_FAST);
[Severity: Low]
Can the compiler reorder read_sse_reg() across __hyperv_hypercall(), or
clobber xmm0 before the hypercall runs?
In tools/testing/selftests/kvm/include/x86/processor.h, read_sse_reg()
uses a non-volatile asm statement with an output operand and no input
operands, and neither write_sse_reg() nor __hyperv_hypercall() declares
xmm register constraints or clobbers:
tools/testing/selftests/kvm/include/x86/processor.h:read_sse_reg() {
switch (reg) {
...
case 1:
asm("movdqa %%xmm1, %0" : "=m"(*data));
break;
}
tools/testing/selftests/kvm/include/x86/processor.h:write_sse_reg() {
switch (reg) {
case 0:
asm("movdqa %0, %%xmm0" : : "m"(*data));
break;
}
Because x86 selftests are compiled with -O2 -march=x86-64-v2 (with SSE
enabled), the compiler can schedule a vectorized zeroing of out via xmm0
after write_sse_reg(0, &in.vec) or move read_sse_reg(1, &out.vec) ahead of
__hyperv_hypercall(), causing spurious assertion failures in
handle_fast_hcall() or guest_code().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261113170535.79246-1-dwmw2@infradead.org?part=4
next prev parent reply other threads:[~2026-11-13 17:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 17:05 [PATCH v2 0/4] KVM: x86: hyper-v: Forward unimplemented hypercalls to userspace David Woodhouse
2026-11-13 17:05 ` [PATCH v2 1/4] KVM: x86: hyper-v: Add KVM_CAP_HYPERV_FORWARD_HCALL David Woodhouse
2026-11-13 17:05 ` [PATCH v2 2/4] KVM: x86: Let userspace cancel a pending hypercall completion David Woodhouse
2026-11-13 17:05 ` [PATCH v2 3/4] KVM: x86: hyper-v: Advertise XMM fast hypercall output David Woodhouse
2026-11-13 17:05 ` [PATCH v2 4/4] KVM: selftests: Add Hyper-V hypercall forwarding test David Woodhouse
2026-11-13 17:22 ` sashiko-bot [this message]
2026-11-13 17:10 ` [PATCH v2 0/4] KVM: x86: hyper-v: Forward unimplemented hypercalls to userspace Sean Christopherson
2026-11-13 17:23 ` David Woodhouse
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=sashiko-outbox-213294@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dwmw2@infradead.org \
--cc=kvm@vger.kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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