linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Nicholas Piggin <npiggin@gmail.com>
Subject: [PATCH 3/4] powerpc/64s: Use stncisync instruction for smp_wmb() when available
Date: Fri,  9 Jun 2023 20:00:25 +1000	[thread overview]
Message-ID: <20230609100026.8946-3-npiggin@gmail.com> (raw)
In-Reply-To: <20230609100026.8946-1-npiggin@gmail.com>

stncisync orders less than lwsync (only cacheable store-store, not
load-load or load-store) so it should be as cheap or cheaper.

Microbenchmarks with no actual loads to order shows that the basic
execution cost is the same on POWER10.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/include/asm/barrier.h | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/barrier.h b/arch/powerpc/include/asm/barrier.h
index b95b666f0374..f0ff5737b0d8 100644
--- a/arch/powerpc/include/asm/barrier.h
+++ b/arch/powerpc/include/asm/barrier.h
@@ -6,6 +6,8 @@
 #define _ASM_POWERPC_BARRIER_H
 
 #include <asm/asm-const.h>
+#include <asm/cputable.h>
+#include <asm/feature-fixups.h>
 
 #ifndef __ASSEMBLY__
 #include <asm/ppc-opcode.h>
@@ -41,7 +43,12 @@
 
 /* The sub-arch has lwsync */
 #if defined(CONFIG_PPC64) || defined(CONFIG_PPC_E500MC)
-#    define SMPWMB      LWSYNC
+#    define SMPWMB					\
+	BEGIN_FTR_SECTION;				\
+	LWSYNC;						\
+	FTR_SECTION_ELSE;				\
+	.long PPC_RAW_STNCISYNC();			\
+	ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_31)
 #elif defined(CONFIG_BOOKE)
 #    define SMPWMB      mbar
 #else
-- 
2.40.1


  parent reply	other threads:[~2023-06-09 10:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09 10:00 [PATCH 1/4] powerpc: Make mmiowb a wmb Nicholas Piggin
2023-06-09 10:00 ` [PATCH 2/4] powerpc/64s: Add POWER10 store sync mnemonics Nicholas Piggin
2023-06-13  5:31   ` Joel Stanley
2023-06-14  5:31     ` Nicholas Piggin
2023-06-09 10:00 ` Nicholas Piggin [this message]
2023-06-09 10:00 ` [PATCH 4/4] powerpc/64s: Use POWER10 stsync barrier for wmb() Nicholas Piggin
2023-06-13 13:59   ` Michael Ellerman
2023-06-14  5:56     ` Michael Ellerman
2023-06-15  1:53       ` Nicholas Piggin
2023-06-15  3:09         ` Michael Ellerman
2023-08-24 12:11           ` Michael Ellerman
2023-08-24 12:12             ` Michael Ellerman
2023-08-25  0:28               ` Joel Stanley
2023-08-25  6:59                 ` Michael Ellerman

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=20230609100026.8946-3-npiggin@gmail.com \
    --to=npiggin@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.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;
as well as URLs for NNTP newsgroup(s).