From: Rohan McLure <rmclure@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org, linux-xtensa@linux.xtensa.org
Cc: chris@zankel.net, elver@google.com, npiggin@gmail.com,
jcmvbkbc@gmail.com, Rohan McLure <rmclure@linux.ibm.com>
Subject: [PATCH v4 5/7] powerpc: kcsan: Memory barriers semantics
Date: Wed, 8 Feb 2023 14:22:00 +1100 [thread overview]
Message-ID: <20230208032202.1357949-6-rmclure@linux.ibm.com> (raw)
In-Reply-To: <20230208032202.1357949-1-rmclure@linux.ibm.com>
Annotate memory barriers *mb() with calls to kcsan_mb(), signaling to
compilers supporting KCSAN that the respective memory barrier has been
issued. Rename memory barrier *mb() to __*mb() to opt in for
asm-generic/barrier.h to generate the respective *mb() macro.
Signed-off-by: Rohan McLure <rmclure@linux.ibm.com>
---
v2: Implement __smp_mb() in terms of __mb() to avoid duplicate calls to
kcsan_mb()
---
arch/powerpc/include/asm/barrier.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/include/asm/barrier.h b/arch/powerpc/include/asm/barrier.h
index e80b2c0e9315..b95b666f0374 100644
--- a/arch/powerpc/include/asm/barrier.h
+++ b/arch/powerpc/include/asm/barrier.h
@@ -35,9 +35,9 @@
* However, on CPUs that don't support lwsync, lwsync actually maps to a
* heavy-weight sync, so smp_wmb() can be a lighter-weight eieio.
*/
-#define mb() __asm__ __volatile__ ("sync" : : : "memory")
-#define rmb() __asm__ __volatile__ ("sync" : : : "memory")
-#define wmb() __asm__ __volatile__ ("sync" : : : "memory")
+#define __mb() __asm__ __volatile__ ("sync" : : : "memory")
+#define __rmb() __asm__ __volatile__ ("sync" : : : "memory")
+#define __wmb() __asm__ __volatile__ ("sync" : : : "memory")
/* The sub-arch has lwsync */
#if defined(CONFIG_PPC64) || defined(CONFIG_PPC_E500MC)
@@ -51,12 +51,12 @@
/* clang defines this macro for a builtin, which will not work with runtime patching */
#undef __lwsync
#define __lwsync() __asm__ __volatile__ (stringify_in_c(LWSYNC) : : :"memory")
-#define dma_rmb() __lwsync()
-#define dma_wmb() __asm__ __volatile__ (stringify_in_c(SMPWMB) : : :"memory")
+#define __dma_rmb() __lwsync()
+#define __dma_wmb() __asm__ __volatile__ (stringify_in_c(SMPWMB) : : :"memory")
#define __smp_lwsync() __lwsync()
-#define __smp_mb() mb()
+#define __smp_mb() __mb()
#define __smp_rmb() __lwsync()
#define __smp_wmb() __asm__ __volatile__ (stringify_in_c(SMPWMB) : : :"memory")
--
2.37.2
next prev parent reply other threads:[~2023-02-08 3:28 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-08 3:21 [PATCH v4 0/7] powerpc: Add KCSAN Support Rohan McLure
2023-02-08 3:21 ` [PATCH v4 1/7] kcsan: Add atomic builtin stubs for 32-bit systems Rohan McLure
2023-02-08 4:23 ` Max Filippov
2023-02-08 12:23 ` Christophe Leroy
2023-02-08 23:14 ` Rohan McLure
2023-02-09 23:36 ` Rohan McLure
2023-02-08 3:21 ` [PATCH v4 2/7] xtensa: kcsan: Remove kcsan stubs for atomic builtins Rohan McLure
2023-02-08 4:24 ` Max Filippov
2023-02-08 3:21 ` [PATCH v4 3/7] powerpc: kcsan: Add exclusions from instrumentation Rohan McLure
2023-02-08 3:21 ` [PATCH v4 4/7] powerpc: kcsan: Exclude udelay to prevent recursive instrumentation Rohan McLure
2023-02-08 3:22 ` Rohan McLure [this message]
2023-02-08 3:22 ` [PATCH v4 6/7] powerpc: kcsan: Prevent recursive instrumentation with IRQ save/restores Rohan McLure
2023-02-08 3:22 ` [PATCH v4 7/7] powerpc: kcsan: Add KCSAN Support Rohan McLure
2023-02-08 10:10 ` Marco Elver
2023-02-08 12:25 ` Christophe Leroy
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=20230208032202.1357949-6-rmclure@linux.ibm.com \
--to=rmclure@linux.ibm.com \
--cc=chris@zankel.net \
--cc=elver@google.com \
--cc=jcmvbkbc@gmail.com \
--cc=linux-xtensa@linux.xtensa.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=npiggin@gmail.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;
as well as URLs for NNTP newsgroup(s).