mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
	"David Hildenbrand" <david@kernel.org>,
	"Lorenzo Stoakes" <ljs@kernel.org>,
	"Liam R. Howlett" <liam@infradead.org>,
	"Vlastimil Babka" <vbabka@kernel.org>,
	"Mike Rapoport" <rppt@kernel.org>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Michal Hocko" <mhocko@suse.com>,
	"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
	"Clark Williams" <clrkwllms@kernel.org>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Simona Vetter" <simona.vetter@ffwll.ch>,
	"Jérôme Glisse" <jglisse@redhat.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	"Sean Christopherson" <seanjc@google.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	linux-mm@kvack.org, kvm@vger.kernel.org,
	linux-rt-devel@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/mmu_notifier: Remove non_block_start/end() from notifier invocation
Date: Tue, 11 Aug 2026 15:33:18 +0100	[thread overview]
Message-ID: <a552b227e18ddbb3fa1f2edf2d1cb30ee6ccff13.camel@infradead.org> (raw)
In-Reply-To: <20260811142730.GG544626@ziepe.ca>

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

(Correcting Sean's email address)

On Tue, 2026-08-11 at 11:27 -0300, Jason Gunthorpe wrote:
> On Tue, Aug 11, 2026 at 03:21:35PM +0100, David Woodhouse wrote:
> > > >  - On PREEMPT_RT, spinning locks become sleeping locks, and perfectly
> > > >    legitimate spinlock/rwlock usage in notifier implementations (e.g.
> > > >    KVM's mn_invalidate_lock and gfn_to_pfn_cache locks) triggers the
> > > >    splat despite having no allocator dependency whatsoever. This is
> > > >    reproducible today on a PREEMPT_RT kernel: KVM takes
> > > >    kvm->mn_invalidate_lock in kvm_mmu_notifier_invalidate_range_start(),
> > > >    and if the OOM reaper reaps a KVM process the result is a "BUG:
> > > >    sleeping function called from invalid context" from
> > > >    rt_spin_lock().
> > > 
> > > I don't know anything about PREEEMPT_RT, but this seems like an issue
> > > with RT if a traditionally atomic safe functions are now triggering
> > > might sleep failures?
> > 
> > I can sympathise with that point of view. In fact I've spent the last
> > couple of years mostly ignoring this "problem" and just blaming RT for
> > doing exactly that, but I don't think we can really get away with it
> > any more.
> > 
> > cf. https://lore.kernel.org/all/787aa26cf62dfd361eea8ed19f384fc517892501.camel@infradead.org/
> 
> If might_sleep doesn't work sanely at all in preempt_rt then just
> globally turn it off?

Turn might_sleep off? Or PREEMPT_RT? :)

The RT maintainers are on this thread if you want to pick either of
those fights... that was not the course of action I chose to take.

> > > >  - A notifier implementation may legitimately need to wait for an RCU
> > > >    grace period before allowing the caller to proceed with unmapping
> > > 
> > > That's not allowed. We really want to forbid that, it is not an
> > > acceptable way to implement a driver using these APIs due to
> > > performance.
> > 
> > Speak for yourself. For the KVM gfn-to-pfn-cache the performance scales
> > *much* better with RCU than with explicit locking:
> > https://lore.kernel.org/all/8f41cb82b7c99d5a3d1dda016e4841326b4d8a52.camel@infradead.org/
> 
> At the cost of completely destroying the mm shootdown performance with
> 1s RCU grace period waits every mm operation. No thanks.

I feel like we're not talking about the same things here.

The KVM patch which this enables does *not* behave as you have
described. Have you looked at it?

Nobody's suggesting that we force any *other* MMU notifiers to do
anything that they don't do today.

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

  reply	other threads:[~2026-08-11 14:33 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-11  8:58 David Woodhouse
2026-08-11 13:55 ` Jason Gunthorpe
2026-08-11 14:21   ` David Woodhouse
2026-08-11 14:27     ` Jason Gunthorpe
2026-08-11 14:33       ` David Woodhouse [this message]
2026-08-11 14:42         ` Steven Rostedt
2026-08-11 15:24           ` David Woodhouse
2026-08-11 15:30             ` Jason Gunthorpe
2026-08-12  8:14             ` Michal Hocko
2026-08-12  8:21               ` David Woodhouse
2026-08-12 12:27                 ` Jason Gunthorpe
2026-08-12 13:46                   ` David Woodhouse
2026-08-12 13:49                     ` Jason Gunthorpe
2026-08-12 14:05                       ` David Woodhouse
2026-08-12 14:26                         ` Jason Gunthorpe
2026-08-12 14:38                           ` David Woodhouse
2026-08-13 10:05                             ` David Woodhouse
2026-08-13 13:59                               ` Sean Christopherson
2026-08-13 14:40                                 ` Jason Gunthorpe
2026-08-12 14:34                         ` David Woodhouse
2026-08-12 15:03                           ` David Woodhouse
2026-08-12 15:49                             ` David Woodhouse
2026-08-12 16:20                               ` Sean Christopherson
2026-08-12 17:17                                 ` David Woodhouse
2026-08-12 21:38                                   ` Paul E. McKenney
2026-08-12 21:55                                     ` David Woodhouse
2026-08-13  7:54                                     ` David Woodhouse
2026-08-12 16:04                             ` Paolo Bonzini
2026-08-12 16:07                               ` Jason Gunthorpe
2026-08-12 17:49                               ` David Woodhouse
2026-08-12  8:13           ` Michal Hocko
2026-08-11 15:29         ` Jason Gunthorpe
2026-08-11 15:15       ` David Woodhouse
2026-08-11 15:24         ` Jason Gunthorpe
2026-08-11 15:29           ` David Woodhouse
2026-08-11 16:24             ` Jason Gunthorpe
2026-08-11 17:22               ` David Woodhouse
2026-08-11 17:26                 ` Jason Gunthorpe
2026-08-11 17:59                   ` David Woodhouse
2026-08-11 18:19                     ` Jason Gunthorpe
2026-08-11 20:06                       ` Sean Christopherson
2026-08-11 20:21                         ` Paolo Bonzini
2026-08-11 21:14                           ` David Woodhouse
2026-08-11 22:58                             ` Sean Christopherson
2026-08-11 23:50                               ` David Woodhouse
2026-08-12 10:25                                 ` David Woodhouse
2026-08-12 16:07                                 ` Sean Christopherson
2026-08-11 20:29                         ` David Woodhouse
2026-08-11 15:12 ` David Hildenbrand (Arm)

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=a552b227e18ddbb3fa1f2edf2d1cb30ee6ccff13.camel@infradead.org \
    --to=dwmw2@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=bigeasy@linutronix.de \
    --cc=christian.koenig@amd.com \
    --cc=clrkwllms@kernel.org \
    --cc=david@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=jglisse@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=paulmck@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=rppt@kernel.org \
    --cc=seanjc@google.com \
    --cc=simona.vetter@ffwll.ch \
    --cc=surenb@google.com \
    --cc=vbabka@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®