Re: [PATCH v3 02/13] KVM: x86/xen: Introduce kvm_xen_has_64bit_shinfo() macro

From: David Woodhouse

Date: Wed Sep 02 2026 - 14:37:08 EST


On Wed, 2026-09-02 at 13:21 +0100, Paul Durrant wrote:
> On 31/08/2026 22:26, David Woodhouse wrote:
> > From: David Woodhouse <dwmw@xxxxxxxxxxxx>
> >
> > Add a kvm_xen_has_64bit_shinfo() helper macro to replace the repeated
> > pattern of 'IS_ENABLED(CONFIG_64BIT) && kvm->arch.xen.long_mode'
> > throughout the Xen emulation code. The macro uses READ_ONCE() to
> > ensure a consistent snapshot of the flag, which can be changed by
> > another vCPU at any time.
> >
> > This is the KVM equivalent of Xen's !has_32bit_shinfo().
> >
> > Assisted-by: Kiro:claude-opus-4.6-1m
> > Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
> > ---
> >    arch/x86/kvm/xen.c | 16 ++++++++--------
> >    arch/x86/kvm/xen.h |  5 +++++
> >    2 files changed, 13 insertions(+), 8 deletions(-)
> >
> Reviewed-by: Paul Durrant <paul@xxxxxxx>
>
> ...although adding kvm_xen_has_32bit_shinfo() for consistency with Xen
> might be slightly neater.

I did briefly ponder that, but *all* the existing callers that this
patch converts are of the if (64bit) form, so we'd end up negating both
the implementation *and* all the callers to achieve that consistency.

And frankly, I want "consistency with Xen" on a code level about as
much as I want to gouge my eyes out with a rusty spoon. There's a
*reason* all of this code exists... :)

Attachment: smime.p7s
Description: S/MIME cryptographic signature