From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: David Woodhouse <dwmw2@infradead.org>
Cc: "Paolo Bonzini" <pbonzini@redhat.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>,
"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>,
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: Thu, 20 Aug 2026 15:30:20 +0200 [thread overview]
Message-ID: <20260820133020.7ZCRIhwX@linutronix.de> (raw)
In-Reply-To: <5364F424-42B7-4D1B-BE55-B6F9E68B0F2B@infradead.org>
On 2026-08-12 18:49:50 [+0100], David Woodhouse wrote:
> >Making synchronize_srcu_atomic() spin in CONFIG_PREEMPT_RT is a
> >slightly tall request - it's basically putting it on the same level as
> >raw_spinlock. But if the MMU notifier guys really want to make OOM
> >notifiers atomic, this would be basically the only way to do so.
> >
> >If instead it's okay to remove nonblock_start/end under
> >CONFIG_PREEMPT_RT, for RT kernels I'd rather avoid
> >preempt_disable/enable and only make synchronize_srcu_atomic() try to
> >skip the index flip:
> >
> > if (!try_synchronize_srcu(ssp))
> > synchronize_srcu_expedited(ssp);
>
> Yeah, so in the normal case it's truly atomic but in the RT case both
> readers and grace periods quietly start to sleep again... just like
> spinlocks in RT. That seems reasonable.
I just caught up with the thread.
The task_struct::non_block_count is not properly defined IMHO. It talks
about sleeping and atomic but it is fine to acquire a spinlock_t which
is a spinning lock on !RT.
The other user of non_block_start() is pwm_set_waveform_might_sleep()
where it is used if the pwmchip's lock is a spinlock_t and not a
mutex_t. Again, it seems fine to acquire a spinlock_t.
So it seems if a lock is acquired which is spinning on !RT and part that
these locks are turned into sleeping locks shouldn't lead to a problem.
The splat referenced in
https://lore.kernel.org/all/787aa26cf62dfd361eea8ed19f384fc517892501.camel@infradead.org/
complains only about non_block, the other fields are zero.
In that case it is just a question of how might_sleep() is implemented
and we could skip the warning for the few locks that sleep on RT and
spin on !RT. (FTR: There is also no RCU warning on RT if we sleep
(schedule()) within a RCU read section while blocking on a spinlock_t
but there is a warning if we block on a mutex_t).
In
https://lore.kernel.org/all/a94b75e8b9b1d2191f365c0f4275fd5082332df5.camel@infradead.org
there was a suggestion for "srcu: Add an ATOMIC reader flavor and a spinning
synchronize_srcu_atomic()". This one had preempt_disable() in
srcu_read_lock_atomic(). This is bad as not only forbids to acquire any
sleeping locks (such as spinlock_t) but it also does not allow any
scheduling of any kind within this section.
So if it is *just* the annoying splat on RT, I could try to teach
might_sleep() no to be upset here.
Sebastian
next prev parent reply other threads:[~2026-08-20 13:30 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 8:58 [PATCH] mm/mmu_notifier: Remove non_block_start/end() from notifier invocation 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-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 [this message]
2026-08-20 14:26 ` David Woodhouse
2026-08-20 15:34 ` Sebastian Andrzej Siewior
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=20260820133020.7ZCRIhwX@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=akpm@linux-foundation.org \
--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=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