From: "Woodhouse, David" <dwmw@amazon.co.uk>
To: "seanjc@google.com" <seanjc@google.com>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>
Cc: "bigeasy@linutronix.de" <bigeasy@linutronix.de>,
"peterz@infradead.org" <peterz@infradead.org>,
"mingo@redhat.com" <mingo@redhat.com>,
"will@kernel.org" <will@kernel.org>,
"longman@redhat.com" <longman@redhat.com>,
"boqun@kernel.org" <boqun@kernel.org>,
"tglx@kernel.org" <tglx@kernel.org>,
"paul@xen.org" <paul@xen.org>,
"Stollmaier, Carsten" <stollmc@amazon.de>,
"dwmw2@infradead.org" <dwmw2@infradead.org>,
"Woodhouse, David" <dwmw@amazon.co.uk>,
"daniel.vetter@ffwll.ch" <daniel.vetter@ffwll.ch>,
"mhocko@suse.com" <mhocko@suse.com>,
"jgg@nvidia.com" <jgg@nvidia.com>,
"christian.koenig@amd.com" <christian.koenig@amd.com>,
"jglisse@redhat.com" <jglisse@redhat.com>,
"david@kernel.org" <david@kernel.org>,
"ljs@kernel.org" <ljs@kernel.org>,
"liam@infradead.org" <liam@infradead.org>,
"vbabka@kernel.org" <vbabka@kernel.org>,
"rppt@kernel.org" <rppt@kernel.org>,
"surenb@google.com" <surenb@google.com>,
"bp@alien8.de" <bp@alien8.de>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"hpa@zytor.com" <hpa@zytor.com>,
"x86@kernel.org" <x86@kernel.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH v3 2/7] mm/mmu_notifier: Remove non_block_start/end() from notifier invocation
Date: Wed, 5 Aug 2026 19:55:43 +0000 [thread overview]
Message-ID: <20260805195528.3853473-3-dwmw@amazon.co.uk> (raw)
In-Reply-To: <20260805195528.3853473-1-dwmw@amazon.co.uk>
[-- Attachment #1.1: Type: text/plain, Size: 3130 bytes --]
This effectively reverts commit ba170f76b69d ("mm, notifier: Catch
sleeping/blocking for !blockable") for the mmu_notifier call sites.
The non_block_start/end() annotation causes the scheduler to complain
about *any* voluntary sleep in a non-blockable notifier. But that was
never the actual constraint. As Michal Hocko put it when the
annotation was first proposed, the OOM reaper "shouldn't depend on any
locks or sleepable conditionals" and checking for sleepable context
was "the best thing we could come up with that would describe these
demands at least partially". The real requirement is that the reaper
must not block on anything which may itself depend on memory
allocation (or on the dying mm) to make progress — which is why
spinning locks were always considered fine.
That distinction now matters in both directions:
- 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.
- A notifier implementation may legitimately need to wait for an RCU
grace period before allowing the caller to proceed with unmapping
(in the manner of a TLB shootdown, waiting for readers of a cached
translation to drain). A grace period completes without any memory
allocation and cannot deadlock against the reaper, but the
annotation forbids it.
Checking for genuinely forbidden dependencies mechanically would
require tracking *what* is being waited on, which this annotation
never did. Remove it from the notifier invocation and leave the
constraint where it always really lived: in review and documentation
of the notifier implementations.
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Assisted-by: Claude:claude-mythos-5
---
mm/mmu_notifier.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c
index 245b74f39f91..cd5d15cd646a 100644
--- a/mm/mmu_notifier.c
+++ b/mm/mmu_notifier.c
@@ -520,11 +520,7 @@ static int mn_hlist_invalidate_range_start(
if (ops->invalidate_range_start) {
int _ret;
- if (!mmu_notifier_range_blockable(range))
- non_block_start();
_ret = ops->invalidate_range_start(subscription, range);
- if (!mmu_notifier_range_blockable(range))
- non_block_end();
if (_ret) {
pr_info("%pS callback failed with %d in %sblockable context.\n",
ops->invalidate_range_start, _ret,
@@ -591,14 +587,9 @@ mn_hlist_invalidate_end(struct mmu_notifier_subscriptions *subscriptions,
id = srcu_read_lock(&srcu);
hlist_for_each_entry_srcu(subscription, &subscriptions->list, hlist,
srcu_read_lock_held(&srcu)) {
- if (subscription->ops->invalidate_range_end) {
- if (!mmu_notifier_range_blockable(range))
- non_block_start();
+ if (subscription->ops->invalidate_range_end)
subscription->ops->invalidate_range_end(subscription,
range);
- if (!mmu_notifier_range_blockable(range))
- non_block_end();
- }
}
srcu_read_unlock(&srcu, id);
}
--
2.43.0
[-- Attachment #1.2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 15938 bytes --]
[-- Attachment #2.1: Type: text/plain, Size: 215 bytes --]
Amazon Development Centre (London) Ltd. Registered in England and Wales with registration number 04543232 with its registered office at 1 Principal Place, Worship Street, London EC2A 2FA, United Kingdom.
[-- Attachment #2.2: Type: text/html, Size: 228 bytes --]
next prev parent reply other threads:[~2026-08-05 19:55 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-05 19:55 [PATCH v3 0/7] KVM: x86/xen: Fix Xen/GPC/PREEMPT_RT issues with rwlock_t Woodhouse, David
2026-08-05 19:55 ` [PATCH v3 1/7] KVM: pfncache: use a dedicated invalidation sequence for cache refresh Woodhouse, David
2026-08-05 19:55 ` Woodhouse, David [this message]
2026-08-05 19:55 ` [PATCH v3 3/7] KVM: pfncache: Use RCU for readers instead of a rwlock Woodhouse, David
2026-08-05 20:36 ` sashiko-bot
2026-08-06 16:53 ` Sean Christopherson
2026-08-06 17:58 ` Woodhouse, David
2026-08-06 18:11 ` Sean Christopherson
2026-08-06 18:23 ` Woodhouse, David
2026-08-07 8:56 ` Woodhouse, David
2026-08-07 10:48 ` David Woodhouse
2026-08-06 20:38 ` David Woodhouse
2026-08-06 21:52 ` Paul E. McKenney
2026-08-06 22:02 ` David Woodhouse
2026-08-07 21:55 ` Paul E. McKenney
2026-08-08 7:09 ` David Woodhouse
2026-08-08 10:09 ` David Woodhouse
2026-08-08 17:58 ` Paul E. McKenney
2026-08-09 9:59 ` David Woodhouse
2026-08-09 15:24 ` Uladzislau Rezki
2026-08-09 17:44 ` David Woodhouse
2026-08-10 10:22 ` Uladzislau Rezki
2026-08-10 20:00 ` David Woodhouse
2026-08-05 19:55 ` [PATCH v3 4/7] KVM: x86/xen: Extract delivery of event to vCPU into a separate helper Woodhouse, David
2026-08-05 20:47 ` sashiko-bot
2026-08-05 22:35 ` David Woodhouse
2026-08-06 10:00 ` David Woodhouse
2026-08-06 14:32 ` David Woodhouse
2026-08-05 19:56 ` [PATCH v3 5/7] KVM: x86/xen: Explicitly tag "shared info" page as never being dirty tracked Woodhouse, David
2026-08-05 19:56 ` [PATCH v3 6/7] KVM: x86/xen: Don't dirty track "vCPU info" page Woodhouse, David
2026-08-05 19:56 ` [PATCH v3 7/7] KVM: x86: Use gfn_to_pfn_cache for steal time / preempted status Woodhouse, David
2026-08-05 21:15 ` sashiko-bot
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=20260805195528.3853473-3-dwmw@amazon.co.uk \
--to=dwmw@amazon.co.uk \
--cc=akpm@linux-foundation.org \
--cc=bigeasy@linutronix.de \
--cc=boqun@kernel.org \
--cc=bp@alien8.de \
--cc=christian.koenig@amd.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dave.hansen@linux.intel.com \
--cc=david@kernel.org \
--cc=dwmw2@infradead.org \
--cc=hpa@zytor.com \
--cc=jgg@nvidia.com \
--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=ljs@kernel.org \
--cc=longman@redhat.com \
--cc=mhocko@suse.com \
--cc=mingo@redhat.com \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=rppt@kernel.org \
--cc=seanjc@google.com \
--cc=stollmc@amazon.de \
--cc=surenb@google.com \
--cc=tglx@kernel.org \
--cc=vbabka@kernel.org \
--cc=will@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.