From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Randy Dunlap <rdunlap@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
K Prateek Nayak <kprateek.nayak@amd.com>,
Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>, Guo Ren <guoren@kernel.org>,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
linux-riscv@lists.infradead.org, linux-csky@vger.kernel.org,
Jonas Bonn <jonas@southpole.se>,
Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>,
Stafford Horne <shorne@gmail.com>,
linux-openrisc@vger.kernel.org, Rich Felker <dalias@libc.org>,
John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
linux-sh@vger.kernel.org, Chris Zankel <chris@zankel.net>,
Max Filippov <jcmvbkbc@gmail.com>,
Huacai Chen <chenhuacai@kernel.org>,
WANG Xuerui <kernel@xen0n.name>,
loongarch@lists.linux.dev,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
Helge Deller <deller@gmx.de>,
linux-parisc@vger.kernel.org, linux-arch@vger.kernel.org
Subject: [PATCH v2 10/16] Documentation/membarrier: Update the per-architecture barrier list
Date: Fri, 27 Nov 2026 13:58:15 -0500 [thread overview]
Message-ID: <20261127185822.158216-11-mathieu.desnoyers@efficios.com> (raw)
In-Reply-To: <20261127185822.158216-1-mathieu.desnoyers@efficios.com>
membarrier.rst lists how each architecture provides the full memory
barrier after the store to rq->curr. The list misses several SMP
architectures.
Add csky, openrisc, sh and xtensa. They use the generic
smp_store_release(). It issues smp_mb() before the store.
finish_task() uses it.
LoongArch and parisc now provide the barrier with
membarrier_arch_switch_mm(). Add them next to powerpc and riscv.
State the rule which both broke: an architecture which weakens
smp_store_release() or spin_unlock() must provide the barrier another
way.
Update the matching comment in __schedule().
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
---
Documentation/scheduler/membarrier.rst | 14 ++++++++++----
kernel/sched/core.c | 10 ++++++----
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/Documentation/scheduler/membarrier.rst b/Documentation/scheduler/membarrier.rst
index 2387804b1c63..c5f6f4f57331 100644
--- a/Documentation/scheduler/membarrier.rst
+++ b/Documentation/scheduler/membarrier.rst
@@ -28,12 +28,18 @@ architectures are as follows.
- alpha, arc, arm, hexagon, mips rely on the full barrier implied by
spin_unlock() in finish_lock_switch().
+ - csky, openrisc, sh, xtensa rely on the generic smp_store_release(),
+ which issues a full barrier before the store. finish_task() uses it.
+
- arm64 relies on the full barrier implied by switch_to().
- - powerpc, riscv, s390, sparc, x86 rely on the full barrier implied by
- switch_mm(), if mm is not NULL; they rely on the full barrier implied
- by mmdrop(), otherwise. On powerpc and riscv, switch_mm() relies on
- membarrier_arch_switch_mm().
+ - loongarch, parisc, powerpc, riscv, s390, sparc, x86 rely on the full
+ barrier implied by switch_mm(), if mm is not NULL; they rely on the full
+ barrier implied by mmdrop(), otherwise. On loongarch, parisc, powerpc and
+ riscv, switch_mm() relies on membarrier_arch_switch_mm().
+
+An architecture which overrides smp_store_release() or spin_unlock() with
+something weaker than a full barrier must provide this barrier another way.
The barrier matches a full barrier in the proximity of the membarrier system call
entry, cf. membarrier_{private,global}_expedited().
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index df6d15cf7109..9985c95ecd73 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7367,10 +7367,12 @@ static void __sched notrace __schedule(int sched_mode)
* Here are the schemes providing that barrier on the
* various architectures:
* - mm ? switch_mm() : mmdrop() for x86, s390, sparc, PowerPC,
- * RISC-V. switch_mm() relies on membarrier_arch_switch_mm()
- * on PowerPC and on RISC-V.
- * - finish_lock_switch() for weakly-ordered
- * architectures where spin_unlock is a full barrier,
+ * RISC-V, LoongArch, PA-RISC. switch_mm() relies on
+ * membarrier_arch_switch_mm() on PowerPC, RISC-V,
+ * LoongArch and PA-RISC.
+ * - finish_task() and finish_lock_switch() for weakly-ordered
+ * architectures where smp_store_release() or spin_unlock
+ * is a full barrier,
* - switch_to() for arm64 (weakly-ordered, spin_unlock
* is a RELEASE barrier),
*
--
2.47.3
next prev parent reply other threads:[~2026-11-27 18:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 18:58 [PATCH v2 00/16] membarrier: fixes, selftests and documentation Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 01/16] sched/membarrier: Fix stale runqueue state after a lazy mm switch Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 02/16] sched/membarrier: Report only completed registrations Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 03/16] selftests/membarrier: Rebuild the tests when their header changes Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 04/16] selftests/membarrier: Issue the sync core command in its test Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 05/16] selftests/membarrier: Run the tests on nohz_full kernels Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 06/16] selftests/membarrier: Test which CPUs the expedited commands interrupt Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 07/16] selftests/membarrier: Test command arguments and registration lifetime Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 08/16] LoongArch: membarrier: Add full memory barrier in switch_mm() Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 09/16] parisc: " Mathieu Desnoyers
2026-11-27 18:58 ` Mathieu Desnoyers [this message]
2026-11-27 18:58 ` [PATCH v2 11/16] Documentation/features: Update the membarrier sync core requirements Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 12/16] x86/entry: Remove stale membarrier sync core comments Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 13/16] selftests/membarrier: Add litmus tests of the memory ordering Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 14/16] MAINTAINERS: Add the membarrier selftests to MEMBARRIER SUPPORT Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 15/16] selftests/membarrier: Check the memory barriers of each thread Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 16/16] selftests/membarrier: Check the core serialization of the sync core command Mathieu Desnoyers
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=20261127185822.158216-11-mathieu.desnoyers@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=bsegall@google.com \
--cc=chenhuacai@kernel.org \
--cc=chris@zankel.net \
--cc=corbet@lwn.net \
--cc=dalias@libc.org \
--cc=deller@gmx.de \
--cc=dietmar.eggemann@arm.com \
--cc=glaubitz@physik.fu-berlin.de \
--cc=guoren@kernel.org \
--cc=jcmvbkbc@gmail.com \
--cc=jonas@southpole.se \
--cc=juri.lelli@redhat.com \
--cc=kernel@xen0n.name \
--cc=kprateek.nayak@amd.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-csky@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-openrisc@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-sh@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=palmer@dabbelt.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=pjw@kernel.org \
--cc=rdunlap@infradead.org \
--cc=rostedt@goodmis.org \
--cc=shorne@gmail.com \
--cc=skhan@linuxfoundation.org \
--cc=stefan.kristiansson@saunalahti.fi \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/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®