mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Sean Christopherson <seanjc@google.com>,
	Jason Gunthorpe <jgg@ziepe.ca>, Michal Hocko <mhocko@suse.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	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>,
	Clark Williams <clrkwllms@kernel.org>,
	Simona Vetter <simona.vetter@ffwll.ch>,
	Jerome Glisse <jglisse@redhat.com>,
	Christian Koenig <christian.koenig@amd.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: Wed, 26 Aug 2026 14:04:32 -0700	[thread overview]
Message-ID: <4415dbf2-10b0-4cb1-b045-13dbcd69c5d5@paulmck-laptop> (raw)
In-Reply-To: <06F9A0F0-2177-4173-A201-56325A73F89B@infradead.org>

On Wed, Aug 26, 2026 at 09:30:43PM +0100, David Woodhouse wrote:
> On 26 August 2026 20:59:31 BST, "Paul E. McKenney" <paulmck@kernel.org> wrote:
> >On Wed, Aug 26, 2026 at 07:01:24PM +0100, David Woodhouse wrote:
> >> On 26 August 2026 17:28:27 BST, "Paul E. McKenney" <paulmck@kernel.org> wrote:
> >> >On Wed, Aug 26, 2026 at 08:05:06AM -0700, Paul E. McKenney wrote:
> >> >> On Wed, Aug 26, 2026 at 08:38:27AM +0100, David Woodhouse wrote:
> >> >> > On Wed, 2026-08-26 at 09:32 +0200, Sebastian Andrzej Siewior wrote:
> >> >> > > On 2026-08-25 13:51:14 [-0700], Paul E. McKenney wrote:
> >> >> > > > Very good, preemption disabling it is!  It is quite possible that the
> >> >> > > > PREEMPT_RT guys will need something else, but one thing at a time.
> >> >> > > 
> >> >> > > This reminds me of classic RCU ;) It might work in this use case but I
> >> >> > > am afraid that other users might come along where it actually hurts.
> >> >> > > With PREEMPT LAZY the preemption within the read-section should
> >> >> > > hopefully be the exception.
> >> >> > 
> >> >> > Given the way that PREEMPT_RT treats other locks like spinlocks and
> >> >> > rwlocks — turning them into sleeping locks — I suspect it makes most
> >> >> > sense, and is consistent, to also turn rcu_read_lock_atomic() and
> >> >> > synchronize_rcu_atomic() into plain rcu_read_lock() and
> >> >> > try_synchronize_srcu()+synchronize_scru_expedited().
> >> >> 
> >> >> That makes a lot of sense to me.
> >> >
> >> >Another option is to instead fall back to non-atomic SRCU.
> >> 
> >> That's exactly what I thought I was suggesting; I think I left an 's' out though :)
> >
> >Heh!!!
> >
> >About 20 years ago, I was shocked to learn of a valid use case involving
> >sleeping RCU readers, which resulted in SRCU.  And now it is time
> >to be shocked at non-sleeping sleeping RCU readers, and especially a
> >non-sleeping grace-period wait.  ;-)
> >
> >Anyway, easy enough:
> >
> >#ifdef CONFIG_PREEMPT_RT
> >DEFINE_SRCU(whatever);
> >#define my_srcu_read_lock() srcu_read_lock(&whatever);
> >#define my_srcu_read_unlock(idx) srcu_read_unlock(&whatever, (idx));
> >#define my_synchronize_srcu() synchronize_srcu(&whatever);
> >#else
> >DEFINE_SRCU_ATOMIC(whatever);
> >#define my_srcu_read_lock() srcu_read_lock_atomic(&whatever);
> >#define my_srcu_read_unlock(idx) srcu_read_unlock_atomic(&whatever, (idx));
> >#define my_synchronize_srcu() synchronize_srcu_atomic(&whatever);
> >#endif
> 
> We could do that for the KVM GPC locking, but more consistent would be to change *all* users of the 'atomic' lock under PREEMPT_RT to silently get the sleeping version instead, like PREEMPT_RT does with spinlocks and rwlocks.
> 
> So it's srcu_read_lock_atomic() itself (et al) which would get that if/else treatment.

OK, the traditional approach is that raw_synchronize_srcu_atomic() and
friends with the raw_ prefix are always atomic, and without the raw_
prefix it is atomic for !PREEMPT_RT and non-atomic otherwise.  You would
use the non-_raw primitives.

Easy enough to do.  But does it do the job, both from a PREEMPT_RT
perspective and a notifier perspective?

And notifiers (though a different type of them) were the first use case
for SRCU.  ;-)

							Thanx, Paul

  reply	other threads:[~2026-08-26 21:04 UTC|newest]

Thread overview: 83+ 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
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-18 18:18                                       ` Paul E. McKenney
2026-08-18 18:28                                         ` David Woodhouse
2026-08-20 14:43                                         ` David Woodhouse
2026-08-21 17:38                                           ` Paul E. McKenney
2026-08-25 12:15                                             ` David Woodhouse
2026-08-25 16:47                                               ` Paul E. McKenney
2026-08-25 17:05                                                 ` David Woodhouse
2026-08-25 17:19                                                   ` Paul E. McKenney
2026-08-25 17:48                                                     ` David Woodhouse
2026-08-25 18:16                                                       ` Paul E. McKenney
2026-08-25 19:58                                                         ` Sean Christopherson
2026-08-25 20:51                                                           ` Paul E. McKenney
2026-08-26  7:32                                                             ` Sebastian Andrzej Siewior
2026-08-26  7:38                                                               ` David Woodhouse
2026-08-26 15:05                                                                 ` Paul E. McKenney
2026-08-26 16:28                                                                   ` Paul E. McKenney
2026-08-26 18:01                                                                     ` David Woodhouse
2026-08-26 19:59                                                                       ` Paul E. McKenney
2026-08-26 20:30                                                                         ` David Woodhouse
2026-08-26 21:04                                                                           ` Paul E. McKenney [this message]
2026-08-27  8:20                                                                             ` Sebastian Andrzej Siewior
2026-08-27 23:25                                                         ` David Woodhouse
2026-08-28 23:18                                                           ` David Woodhouse
2026-09-01  0:58                                                           ` Paul E. McKenney
2026-09-01  9:40                                                             ` David Woodhouse
2026-09-01 19:12                                                               ` Sean Christopherson
2026-09-01 20:40                                                                 ` Paul E. McKenney
2026-09-01 22:51                                                                   ` Sean Christopherson
2026-09-01 22:53                                                                     ` David Woodhouse
2026-09-01 23:05                                                                       ` Paul E. McKenney
2026-08-12 16:04                             ` Paolo Bonzini
2026-08-12 16:07                               ` Jason Gunthorpe
2026-08-12 17:49                               ` David Woodhouse
2026-08-20 13:30                                 ` Sebastian Andrzej Siewior
2026-08-20 14:26                                   ` David Woodhouse
2026-08-20 15:34                                     ` Sebastian Andrzej Siewior
2026-08-20 18: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=4415dbf2-10b0-4cb1-b045-13dbcd69c5d5@paulmck-laptop \
    --to=paulmck@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=bigeasy@linutronix.de \
    --cc=christian.koenig@amd.com \
    --cc=clrkwllms@kernel.org \
    --cc=david@kernel.org \
    --cc=dwmw2@infradead.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=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®