From: David Woodhouse <dwmw2@infradead.org>
To: Zack Rusin <zack.rusin@broadcom.com>
Cc: "Sean Christopherson" <seanjc@google.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
kvm@vger.kernel.org, "Doug Covelli" <doug.covelli@broadcom.com>,
"Thomas Gleixner" <tglx@kernel.org>,
"Ingo Molnar" <mingo@redhat.com>,
"Borislav Petkov" <bp@alien8.de>,
"Dave Hansen" <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
"Jonathan Corbet" <corbet@lwn.net>,
"Randy Dunlap" <rdunlap@infradead.org>,
"Shuah Khan" <shuah@kernel.org>,
"Vitaly Kuznetsov" <vkuznets@redhat.com>,
"Paul Durrant" <paul@xen.org>, "Xin Li" <xin@zytor.com>,
"Francesco Lavra" <flavra@baylibre.com>,
"Radim Krčmář" <rkrcmar@ventanamicro.com>,
linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org,
bcm-kernel-feedback-list@broadcom.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 06/12] KVM: x86: Forward VMware hypercalls to userspace
Date: Fri, 13 Nov 2026 11:16:20 -0700 [thread overview]
Message-ID: <ca9dffb64656a392965f95d35b9d13d829f34076.camel@infradead.org> (raw)
In-Reply-To: <CABQX2QNhRZP1Td_HQ6QpMzw-_TjqhbooipWYg3VTgTOq2_U9+w@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3705 bytes --]
On Fri, 2026-11-13 at 01:33 -0500, Zack Rusin wrote:
> On Thu, Nov 12, 2026 at 11:56 PM David Woodhouse <dwmw2@infradead.org> wrote:
> >
> > On Thu, 2026-11-12 at 20:05 -0500, Zack Rusin wrote:
> > >
> > > > And I wonder if the cleaner answer in both cases is just to give
> > > > userspace a way to cancel the pending hypercall completion and use
> > > > KVM_SET_VCPU_EVENTS instead of piling all this stuff into the hcall
> > > > structs? It could even just be a KVM_VCPUEVENT_ flag to make it cancel
> > > > the hypercall completion?
> > >
> > > I agree that this would be cleaner, and if KVM grows such a flag,
> > > VMware userspace could use it too. But it's new API in
> > > KVM_SET_VCPU_EVENTS, and we'd need to agree which completions it may
> > > cancel: simply clearing the callback leaves pending I/O state behind
> > > for PIO and MMIO, and KVM_EXIT_HYPERCALL also covers TDX completions
> > > with different semantics. So I'd rather not make this series depend
> > > on it because it significantly increases its scope.
> >
> > I won't necessarily defend my suggestion above to the hilt on its
> > technical merit, but I'll observe that as a counter-argument, yours
> > *really* isn't a good one. We don't design a userspace ABI based on the
> > fact that we're impatient.
>
> I think that's a misreading of my concern: it wasn't impatience but
> coupling the VMware series to a new cross-cutting semantic in
> KVM_SET_VCPU_EVENTS. The current approach is self-contained. The
> exception fields were already in v2; Sean's only comment on that
> struct was to move it into the x86 UAPI header.
Fair.
> > To your concern, I actually think we could get away with aborting *any*
> > pending complete_userspace_io callback.
>
> I'm not sure about that. I think simply dropping a PIO or MMIO
> completion can leave pio.count or mmio_needed set, triggering WARNs in
> KVM_RUN. Retrying an MMIO read can replay device side effects, while
> dropping a split-write completion can abandon remaining fragments.
> Also afaict for SEV-ES/SNP and TDX, KVM can't simply replay the
> guest's VMGEXIT/TDCALL: RIP has already advanced. Dropping the
> completion can lose returned data or leave a multi-step request such
> as SNP PSC unfinished.
>
> > Userspace *already* needed to
> > know about those¹ because it can't migrate while those are pending;
> > it has to do at least one more run, even if it's with the immediate_exit
> > flag set.
>
> True, but, again afaict, that rule exists because those completions
> have to run, so I don't think it tells us they can be dropped.
>
> > If it's deemed clearer, I'd also be OK with an explicit
> > KVM_VCPUEVENT_CANCEL_HCALL which cancels *only* hypercalls. But I don't
> > really see the point; userspace shouldn't be getting confused when it
> > was actually some other kind of completion that was active anyway.
> >
> > ¹ https://lore.kernel.org/all/20250111012450.1262638-1-seanjc@google.com/
> >
> > Looks something like this in my Hyper-V hcall series (except I already
> > shouted at the agent for stupid struct layout and made it go run pahole
> > on everything it's working on).
>
> FWIW, restricting cancellation to explicitly marked completions looks
> good to me. If Sean/Paolo prefer that, I'm happy to mark our
> completion cancellable and drop our exception fields.
I posted that as
https://lore.kernel.org/kvm/20261113170535.79246-3-dwmw2@infradead.org/T/#u
and caught both Paolo and Sean here at KVM Forum and both seem OK with
it (although acquiescence when badgered at a conference doesn't
necessarily translate to applying the patch... :)
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 6179 bytes --]
next prev parent reply other threads:[~2026-11-13 18:16 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 5:59 [PATCH v3 00/12] KVM: Improve VMware guest support Zack Rusin
2026-11-11 5:59 ` [PATCH v3 01/12] KVM: x86/pmu: Honor enable_vmware_backdoor for VMware pseudo-PMCs Zack Rusin
2026-11-12 0:13 ` Jim Mattson
2026-11-11 5:59 ` [PATCH v3 02/12] KVM: x86: Move VMware backdoor support to separate files Zack Rusin
2026-11-12 0:14 ` Jim Mattson
2026-11-11 5:59 ` [PATCH v3 03/12] KVM: x86: Encapsulate VMware backdoor checks Zack Rusin
2026-11-12 0:14 ` Jim Mattson
2026-11-11 5:59 ` [PATCH v3 04/12] KVM: x86: Add CONFIG_KVM_VMWARE Zack Rusin
2026-11-12 0:15 ` Jim Mattson
2026-11-11 5:59 ` [PATCH v3 05/12] KVM: x86: Add a unified VMware capability Zack Rusin
2026-11-12 0:17 ` Jim Mattson
2026-11-11 5:59 ` [PATCH v3 06/12] KVM: x86: Forward VMware hypercalls to userspace Zack Rusin
2026-11-12 0:28 ` Jim Mattson
2026-11-12 5:48 ` Zack Rusin
2026-11-12 18:52 ` Jim Mattson
2026-11-12 20:25 ` David Woodhouse
2026-11-13 1:05 ` Zack Rusin
2026-11-13 4:56 ` David Woodhouse
2026-11-13 6:33 ` Zack Rusin
2026-11-13 18:16 ` David Woodhouse [this message]
2026-11-11 5:59 ` [PATCH v3 07/12] KVM: x86: Route nested VMware backdoors to KVM Zack Rusin
2026-11-11 5:59 ` [PATCH v3 08/12] KVM: selftests: Add helpers to run x86 guest code in user mode Zack Rusin
2026-11-11 5:59 ` [PATCH v3 09/12] KVM: selftests: Port VMware backdoor coverage Zack Rusin
2026-11-12 18:36 ` Jim Mattson
2026-11-11 5:59 ` [PATCH v3 10/12] KVM: selftests: Test VMware hypercall exits Zack Rusin
2026-11-11 6:00 ` [PATCH v3 11/12] KVM: selftests: Test VMware hypercall exits with nested Hyper-V flushes Zack Rusin
2026-11-11 6:00 ` [PATCH v3 12/12] KVM: selftests: Test nested VMware backdoor routing Zack Rusin
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=ca9dffb64656a392965f95d35b9d13d829f34076.camel@infradead.org \
--to=dwmw2@infradead.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=bp@alien8.de \
--cc=corbet@lwn.net \
--cc=dave.hansen@linux.intel.com \
--cc=doug.covelli@broadcom.com \
--cc=flavra@baylibre.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=rdunlap@infradead.org \
--cc=rkrcmar@ventanamicro.com \
--cc=seanjc@google.com \
--cc=shuah@kernel.org \
--cc=tglx@kernel.org \
--cc=vkuznets@redhat.com \
--cc=x86@kernel.org \
--cc=xin@zytor.com \
--cc=zack.rusin@broadcom.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®