Linux-HyperV List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "David Woodhouse" <dwmw2@infradead.org>, kvm@vger.kernel.org
Cc: linux-hyperv@vger.kernel.org
Subject: Re: [PATCH] KVM: selftests: Make the x86 SSE register helpers volatile
Date: Fri, 13 Nov 2026 18:16:39 +0000	[thread overview]
Message-ID: <sashiko-outbox-213401@kernel.org> (raw)
In-Reply-To: <20261113181053.81779-1-dwmw2@infradead.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] KVM: selftests: missing Fixes trailer for commit 676a863ce605
--

commit ec0caf7c95f47c5b258b6b71433582cb4674f3a4
Author: David Woodhouse <dwmw@amazon.co.uk>

> KVM: selftests: Make the x86 SSE register helpers volatile
>
> read_sse_reg() and write_sse_reg() were borrowed from KVM's
> _kvm_read_sse_reg() and _kvm_write_sse_reg(). The kernel is built
> without SSE, so the compiler never uses the XMM registers itself and a
> plain asm() is enough there. Selftest guest code is built with SSE, and
> there the asm statements have to tell the compiler what they do.
>
> read_sse_reg() has an output and is not volatile, so the compiler may
> treat it as a pure computation and move it, for example ahead of the
> hypercall whose XMM output it is meant to read. write_sse_reg() has no
> outputs and is therefore implicitly volatile, but it doesn't declare the
> register it overwrites, so a value the compiler was keeping there does
> not survive.
>
> Mark both volatile, and declare the register each write_sse_reg() case
> writes as clobbered. A read_sse_reg() after __hyperv_hypercall() now
> stays after it.
>
> That still leaves the compiler free to use an XMM register for its own
> code between a write_sse_reg() and the asm which consumes it.
> hyperv_write_xmm_input() in the hyperv_ipi and hyperv_tlb_flush tests
> relies on that not happening; GCC 11.5 at -O2 emits nothing there.
> Closing that window entirely would mean passing the XMM values as
> operands of the hypercall asm itself.
>
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Closes: https://lore.kernel.org/all/sashiko-outbox-209724@kernel.org/
> Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>

[Severity: Low]
Since this fixes read_sse_reg() and write_sse_reg(), should it include:

  Fixes: 676a863ce605 ("KVM: selftests: Better XMM read/write helpers")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261113181053.81779-1-dwmw2@infradead.org?part=1

      reply	other threads:[~2026-11-13 18:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 20:58 [PATCH 0/4] KVM: x86: hyper-v: Forward unimplemented hypercalls to userspace David Woodhouse
2026-11-11 20:58 ` [PATCH 1/4] KVM: x86: hyper-v: Add KVM_CAP_HYPERV_FORWARD_HCALL David Woodhouse
2026-11-11 20:58 ` [PATCH 2/4] KVM: x86: hyper-v: Let userspace fault a forwarded hypercall David Woodhouse
2026-11-11 20:58 ` [PATCH 3/4] KVM: x86: hyper-v: Advertise XMM fast hypercall output David Woodhouse
2026-11-11 20:58 ` [PATCH 4/4] KVM: selftests: Add Hyper-V hypercall forwarding test David Woodhouse
2026-11-11 21:49   ` sashiko-bot
2026-11-13 18:10     ` [PATCH] KVM: selftests: Make the x86 SSE register helpers volatile David Woodhouse
2026-11-13 18:16       ` sashiko-bot [this message]

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-213401@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