From: David Woodhouse <dwmw2@infradead.org>
To: Sean Christopherson <seanjc@google.com>
Cc: Paul Durrant <xadimgnik@gmail.com>,
pbonzini@redhat.com, joao.m.martins@oracle.com,
boris.ostrovsky@oracle.com, ankur.a.arora@oracle.com,
tglx@kernel.org, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com, hpa@zytor.com, x86@kernel.org,
syzbot+208f7f3e5f59c11aeb90@syzkaller.appspotmail.com,
syzkaller-bugs@googlegroups.com, suryasaimadhu369@gmail.com,
lkp@intel.com, nicoyip.dev@gmail.com, frn1furkan10@gmail.com,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
imv4bel@gmail.com
Subject: Re: [PATCH v3 01/13] KVM: x86/xen: Rename 'longmode' to 'is_64bit' in hypercall handling
Date: Wed, 02 Sep 2026 23:00:25 +0100 [thread overview]
Message-ID: <2cad39ededd2e8e975f6c21cb63df94f65638746.camel@infradead.org> (raw)
In-Reply-To: <aphxoidZsbyoNEN0@google.com>
[-- Attachment #1: Type: text/plain, Size: 3191 bytes --]
On Wed, 2026-09-02 at 11:57 -0700, Sean Christopherson wrote:
> On Wed, Sep 02, 2026, David Woodhouse wrote:
> > On Wed, 2026-09-02 at 13:18 +0100, Paul Durrant wrote:
> > > On 31/08/2026 22:26, David Woodhouse wrote:
> > > > From: David Woodhouse <dwmw@amazon.co.uk>
> > > >
> > > > Rename the local 'longmode' variable and function parameter to
> > > > 'is_64bit' throughout the Xen hypercall handling code. This
> > > > distinguishes it from the VM-wide kvm->arch.xen.long_mode which
> > > > represents the Xen shared_info layout mode.
> > > >
> > > > The 'is_64bit' parameter indicates whether the vCPU was in 64-bit
> > > > mode when it made the hypercall, which determines how to parse the
> > > > hypercall arguments. The UAPI field name (vcpu->run->xen.u.hcall.longmode)
> > > > is unchanged.
> > > >
> > >
> > > Given that 'longmode' is the term used in the UAPI I'm not sure I really
> > > see the point in this change (particularly since there is not even a
> > > name clash with 'long_mode').
> >
> > The difference between 'longmode' and 'long_mode' is subtle, and *has*
> > caused confusion which IIRC is what led to part of this series.
> >
> > Having to keep 'longmode' in the UAPI for KVM_EXIT_XEN_HCALL is sad,
> > but at least the context is very clear there (xen.u.hcall.longmode).
>
> We can actually "fix" that, if we want. And given that the only "longmode"
> reference left in KVM is one in kvm_hv_hypercall_set_result() that can and should
> be nuked, I think it make sense to purge longmode from KVM's source.
>
> We already did something very similar in e65733b5c59a ("KVM: x86: Redefine 'longmode'
> as a flag for KVM_EXIT_HYPERCALL"). And if we expose both names to userspace, we can
> even purge the misleading name from selftests without forcing existing VMMs to
> rebuild.
>
> E.g. (completely untested)
>
> diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c
> index 718396340d3c..043a61e2409d 100644
> --- a/arch/x86/kvm/xen.c
> +++ b/arch/x86/kvm/xen.c
> @@ -1804,7 +1804,7 @@ int kvm_xen_hypercall(struct kvm_vcpu *vcpu)
> handle_in_userspace:
> vcpu->run->exit_reason = KVM_EXIT_XEN;
> vcpu->run->xen.type = KVM_EXIT_XEN_HCALL;
> - vcpu->run->xen.u.hcall.longmode = is_64bit;
> + vcpu->run->xen.u.hcall.is_64bit = is_64bit;
> vcpu->run->xen.u.hcall.cpl = cpl;
> vcpu->run->xen.u.hcall.input = input;
> vcpu->run->xen.u.hcall.params[0] = params[0];
> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
> index 9fc8dfdfd65f..5a74765732e3 100644
> --- a/include/uapi/linux/kvm.h
> +++ b/include/uapi/linux/kvm.h
> @@ -131,7 +131,12 @@ struct kvm_xen_exit {
> __u32 type;
> union {
> struct {
> - __u32 longmode;
> + union {
> +#ifndef __KERNEL__
> + __u32 longmode;
> +#endif
> + __u32 is_64bit;
> + };
> __u32 cpl;
> __u64 input;
> __u64 result;
I worry that this kind of thing would leave me grepping the kernel for
"what even *sets* longmode?" after seeing userspace consuming that
field. In the context of a structure that is explicitly about the
hypercall, I think the existing name is fine.
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 6179 bytes --]
next prev parent reply other threads:[~2026-09-02 22:01 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 21:26 [PATCH v3 0/13] KVM: x86/xen: Bug fixes and long_mode cleanup David Woodhouse
2026-08-31 21:26 ` [PATCH v3 01/13] KVM: x86/xen: Rename 'longmode' to 'is_64bit' in hypercall handling David Woodhouse
2026-09-02 12:18 ` Paul Durrant
2026-09-02 18:24 ` David Woodhouse
2026-09-02 18:57 ` Sean Christopherson
2026-09-02 22:00 ` David Woodhouse [this message]
2026-08-31 21:26 ` [PATCH v3 02/13] KVM: x86/xen: Introduce kvm_xen_has_64bit_shinfo() macro David Woodhouse
2026-09-02 12:21 ` Paul Durrant
2026-09-02 18:28 ` David Woodhouse
2026-08-31 21:26 ` [PATCH v3 03/13] KVM: x86/xen: Rename max_evtchn_port() to kvm_max_evtchn_port() David Woodhouse
2026-09-02 12:22 ` Paul Durrant
2026-08-31 21:26 ` [PATCH v3 04/13] KVM: x86/xen: Latch shinfo mode in kvm_xen_set_evtchn_fast() David Woodhouse
2026-09-02 12:25 ` Paul Durrant
2026-08-31 21:26 ` [PATCH v3 05/13] KVM: x86/xen: Latch shinfo mode in kvm_xen_schedop_poll() David Woodhouse
2026-09-02 12:27 ` Paul Durrant
2026-08-31 21:26 ` [PATCH v3 06/13] KVM: x86/xen: Enforce 4-byte alignment of vcpu_info registration David Woodhouse
2026-09-02 12:29 ` Paul Durrant
2026-08-31 21:26 ` [PATCH v3 07/13] KVM: x86/xen: Use 32-bit locked bts for vcpu_info evtchn_pending_sel David Woodhouse
2026-09-02 12:33 ` Paul Durrant
2026-08-31 21:26 ` [PATCH v3 08/13] KVM: x86/xen: Use 32-bit atomics if vCPU's evtchn_pending_sel isn't aligned David Woodhouse
2026-09-02 12:38 ` Paul Durrant
2026-08-31 21:26 ` [PATCH v3 09/13] KVM: x86/xen: Use atomic*() APIs instead of open coded equivalents David Woodhouse
2026-09-02 12:41 ` Paul Durrant
2026-09-02 18:32 ` David Woodhouse
2026-09-02 18:59 ` Sean Christopherson
2026-08-31 21:26 ` [PATCH v3 10/13] KVM: x86/xen: Take kvm->srcu in __kvm_xen_has_interrupt() David Woodhouse
2026-09-02 12:43 ` Paul Durrant
2026-08-31 21:26 ` [PATCH v3 11/13] KVM: x86/xen: Mark poll_evtchn accesses with READ_ONCE()/WRITE_ONCE() David Woodhouse
2026-09-02 12:45 ` Paul Durrant
2026-08-31 21:26 ` [PATCH v3 12/13] KVM: pfncache: use a dedicated invalidation sequence for cache refresh David Woodhouse
2026-09-02 12:14 ` Paul Durrant
2026-08-31 21:26 ` [PATCH v3 13/13] KVM: x86/xen: Convert evtchn_ports from IDR to XArray David Woodhouse
2026-09-02 12:48 ` Paul Durrant
2026-09-04 15:37 ` [PATCH v3 0/13] KVM: x86/xen: Bug fixes and long_mode cleanup Paolo Bonzini
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=2cad39ededd2e8e975f6c21cb63df94f65638746.camel@infradead.org \
--to=dwmw2@infradead.org \
--cc=ankur.a.arora@oracle.com \
--cc=boris.ostrovsky@oracle.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=frn1furkan10@gmail.com \
--cc=hpa@zytor.com \
--cc=imv4bel@gmail.com \
--cc=joao.m.martins@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=mingo@redhat.com \
--cc=nicoyip.dev@gmail.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=suryasaimadhu369@gmail.com \
--cc=syzbot+208f7f3e5f59c11aeb90@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
--cc=xadimgnik@gmail.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
all inboxes | Powered by JetHome®