mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-kselftest@vger.kernel.org,
	Paolo Bonzini <pbonzini@redhat.com>,  Paul Durrant <paul@xen.org>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Fred Griffoul <fgriffo@amazon.co.uk>,
	 David Woodhouse <dwmw@amazon.co.uk>
Subject: Re: [PATCH v4 00/12] KVM: x86/xen: Don't drop event deliveries which race memslot updates
Date: Wed, 4 Nov 2026 11:53:16 -0800	[thread overview]
Message-ID: <auuNLC2BJRpJZKA6@google.com> (raw)
In-Reply-To: <20261019162445.37219-1-dwmw2@infradead.org>

On Mon, Oct 19, 2026, David Woodhouse wrote:
> From: David Woodhouse <dwmw@amazon.co.uk>
> 
> Sashiko analysis and torture testing of the upcoming conversion of the
> gfn_to_pfn_cache from rwlock to atomic SRCU¹ highlighted a pre-existing
> problem: refreshing a cache can fail while a memslot is briefly marked
> KVM_MEMSLOT_INVALID during a memslot update, causing kvm_gpc_refresh() to
> return -EFAULT. The Xen event channel and timer delivery paths silently
> dropped events when this happened.

Gah, sorry for not reacting to versions 1-3, I completely misread the cover letter's
subject or something.

KVM's de facto ABI is that userspace must "pause" vCPUs when modifying memslots.
KVM obviously needs to ensure racing updates don't harm the host, but beyond that,
it's userspace's responsibility to ensure vCPUs can't see mixed state.

> The first patch is a standalone fix which the same testing found: a guest
> parked in SCHEDOP_poll with a zero timeout halts holding vcpu_run's
> kvm->srcu read section — unlike every other halt, which drops it — so the
> VMM's next memslot update hangs, unkillably, in synchronize_srcu() until the
> guest deigns to be woken. A memslot add which normally completes in
> microseconds blocks forever.
> 
> For the KVM_MEMSLOT_INVALID case, in some cases we don't really care very
> much: the VMM should really be using the KVM_XEN_ATTR_TYPE_SHARED_INFO_HVA
> mode which doesn't depend on memslots at all, and more faithfully represents
> the Xen semantics where the shared info page exists whether it's mapped into
> the guest at any given moment or not. But we can be more consistent, and
> more intentional about it. So...

I don't want to be more consistent or intentional though, because that risks
signing KVM up for something it fundamentally can't support.

See also: https://lore.kernel.org/all/20220909104506.738478-1-eesposit@redhat.com

      parent reply	other threads:[~2026-11-04 19:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19 16:24 David Woodhouse
2026-10-19 16:24 ` [PATCH v4 01/12] KVM: x86/xen: Don't block memslot updates while halted in SCHEDOP_poll David Woodhouse
2026-10-19 16:24 ` [PATCH v4 02/12] KVM: pfncache: Return -EAGAIN for a lookup which hits an invalid memslot David Woodhouse
2026-10-19 16:24 ` [PATCH v4 03/12] KVM: pfncache: Add a 'wait' argument to the refresh and activate functions David Woodhouse
2026-10-19 16:24 ` [PATCH v4 04/12] KVM: x86/xen: Wait out memslot updates in the Xen attribute ioctls David Woodhouse
2026-10-19 16:24 ` [PATCH v4 05/12] KVM: x86/xen: Don't lose the timer event when delivery fails transiently David Woodhouse
2026-10-19 16:24 ` [PATCH v4 06/12] KVM: x86/xen: Retry event channel delivery which races a memslot update David Woodhouse
2026-10-19 16:24 ` [PATCH v4 07/12] KVM: x86/xen: Extract delivery of event to vCPU into a separate helper David Woodhouse
2026-10-19 16:24 ` [PATCH v4 08/12] KVM: x86/xen: Explicitly tag "shared info" page as never being dirty tracked David Woodhouse
2026-10-19 16:24 ` [PATCH v4 09/12] KVM: x86/xen: Don't dirty track "vCPU info" page David Woodhouse
2026-10-19 16:24 ` [PATCH v4 10/12] KVM: x86: Request the guest TLB flush from record_steal_time() David Woodhouse
2026-10-19 16:24 ` [PATCH v4 11/12] KVM: selftests: Add Xen evtchn vs memslot-update race test David Woodhouse
2026-10-19 16:24 ` [PATCH v4 12/12] KVM: selftests: Fix unreachable timer recovery in xen_shinfo_test David Woodhouse
2026-11-03 22:46 ` [PATCH v4 00/12] KVM: x86/xen: Don't drop event deliveries which race memslot updates David Woodhouse
2026-11-04 19:55   ` Sean Christopherson
2026-11-05  0:42     ` David Woodhouse
2026-11-04 19:53 ` Sean Christopherson [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=auuNLC2BJRpJZKA6@google.com \
    --to=seanjc@google.com \
    --cc=dwmw2@infradead.org \
    --cc=dwmw@amazon.co.uk \
    --cc=fgriffo@amazon.co.uk \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=paul@xen.org \
    --cc=pbonzini@redhat.com \
    --cc=vkuznets@redhat.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®