mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Sean Christopherson <seanjc@google.com>
Cc: sashiko-bot@kernel.org, pbonzini@redhat.com, tglx@kernel.org,
	 mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	x86@kernel.org, 	hpa@zytor.com, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org, 	sashiko-reviews@lists.linux.dev,
	stollmc@amazon.com
Subject: Re: [PATCH v2 20/20] KVM: x86: Use gfn_to_pfn_cache for record_steal_time
Date: Wed, 05 Aug 2026 23:51:48 +0200	[thread overview]
Message-ID: <3a19ec60be238ba56ebe9c519fbeda0582aed67a.camel@infradead.org> (raw)
In-Reply-To: <aidiOemcna1Un9wG@google.com>

[-- Attachment #1: Type: text/plain, Size: 1737 bytes --]

On Mon, 2026-06-08 at 17:45 -0700, Sean Christopherson wrote:
> On Tue, Jun 02, 2026, David Woodhouse wrote:
> > On Sat, 30 May 2026 06:19:32 +0000, sashiko-bot@kernel.org wrote:
> > > [Severity: High]
> > > Does this introduce a scheduling while atomic bug on non-PREEMPT_RT kernels?
> > > 
> > > The CLASS(gpc_map_local, st_map) macro acquires a read_lock on gpc->lock,
> > > which disables preemption. While this lock is held, if the guest supports
> > > PV TLB flush, the code calls kvm_vcpu_flush_tlb_guest().
> > > 
> > > If TDP is disabled (shadow paging), kvm_vcpu_flush_tlb_guest() calls
> > > kvm_mmu_sync_roots() and eventually mmu_sync_children(). This path can yield
> > > via cond_resched_rwlock_write(). Yielding while preemption is disabled by
> > > the gpc read lock will trigger a BUG.
> > 
> > Ah, that issue exists in the previous versions too, but it's simple
> > enough to fix. There's no particular timing constraint for flushing the
> > TLB; it just have to be done before this vCPU ever runs again. It can
> > just be moved to the end of the function after the lock is dropped.
> > 
> > That does mean record_steal_time() should use the explicit
> > gpc_map_local_lock()/gpc_map_local_unlock() instead of the CLASS()
> > macro, but that's easy enough.
> 
> Actually, we use KVM_REQ_TLB_FLUSH_GUEST and "optimize" the code for the rare
> case where KVM already have a TLB flushed queued for the vCPU.  E.g. over two
> patches (so that changing the order of the request processing is isolated):

D'oh! Missed this when preparing the RCU-based v3, and Sashiko had to
point it out again. (And I'm fairly sure most of the rest of the
Sashiko feedback rings a bell too).

Fixing... 

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 6179 bytes --]

  reply	other threads:[~2026-08-05 21:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260530061932.7849D1F00893@smtp.kernel.org>
2026-06-02 12:29 ` David Woodhouse
2026-06-09  0:45   ` Sean Christopherson
2026-08-05 21:51     ` David Woodhouse [this message]
2026-07-20 17:05   ` David Woodhouse
2026-05-29 16:50 [PATCH v2 00/20] KVM: x86/xen: Fix Xen/GP/PREEMPT_RT issues with rwlock_t Sean Christopherson
2026-05-29 16:51 ` [PATCH v2 20/20] KVM: x86: Use gfn_to_pfn_cache for record_steal_time Sean Christopherson

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=3a19ec60be238ba56ebe9c519fbeda0582aed67a.camel@infradead.org \
    --to=dwmw2@infradead.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=sashiko-bot@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=seanjc@google.com \
    --cc=stollmc@amazon.com \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    /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®