arch/powerpc/include/asm/barrier.h: redefine rmb and wmb to lwsync
PATCH v2 1/1 arch/powerpc/include/asm/barrier.h: redefine rmb and wmb to lwsync
A link from ibm.com states:
"Ensures that all instructions preceding the call to __lwsync
complete before any subsequent store instructions can be executed on the processor that executed the function. Also, it ensures that all load instructions preceding the call to __lwsync complete before any subsequent load instructions can be executed on the processor that executed the function. This allows you to synchronize between multiple processors with minimal performance impact, as __lwsync does not wait for confirmation from each processor."
Thats why smp_rmb() and smp_wmb() are defined to lwsync. But this same understanding applies to parallel pipeline execution on each PowerPC processor.
So, use the lwsync instruction for rmb() and wmb() on the PPC architectures that support it.
--- arch/powerpc/include/asm/barrier.h | 7 +++++++ 1 file changed, 7 insertions(+)
arch/powerpc/include/asm/barrier.h +7 -0
@@ -36,8 +36,15 @@* heavy-weight sync, so smp_wmb() can be a lighter-weight eieio. */ #define __mb () __asm__ __volatile__ ("sync" : : : "memory") + +/* The sub-arch has lwsync. */ +#if defined(CONFIG_PPC64 ) || defined(CONFIG_PPC_E500MC ) +#define __rmb () __asm__ __volatile__ ("lwsync" : : : "memory") +#define __wmb () __asm__ __volatile__ ("lwsync" : : : "memory") +#else #define __rmb () __asm__ __volatile__ ("sync" : : : "memory")#define __wmb () __asm__ __volatile__ ("sync" : : : "memory") +#endif /* The sub-arch has lwsync */ #if defined(CONFIG_PPC64 ) || defined(CONFIG_PPC_E500MC )
Signature · 1 line
2.31.1
Again, could some IBM/non-IBM employees do basic sanity kernel load testing on PPC64 UP and SMP systems for this patch? would deeply appreciate it! :-)
Thanks again!
Le 22/02/2023 à 10:30, Kautuk Consul a écrit :
Quoted 3 lines
Again, could some IBM/non-IBM employees do basic sanity kernel load testing on PPC64 UP and SMP systems for this patch? would deeply appreciate it! :-)
And can 'non-IBM' 'non employees' do something ? :)
Quoted 3 lines
Thanks again!
Did you try on QEMU ?
Quoted 8 lines · Christophe Leroy
Le 22/02/2023 à 10:30, Kautuk Consul a écrit :
Quoted 3 lines
Again, could some IBM/non-IBM employees do basic sanity kernel load testing on PPC64 UP and SMP systems for this patch? would deeply appreciate it! :-)
And can 'non-IBM' 'non employees' do something ? :)
Anyone can help! :-)
Quoted 6 lines
Quoted 4 lines
Thanks again!
Did you try on QEMU ?
I am a new IBM employee so I don't have any setup with cross-compiler and rootfs, etc. with me at the moment.
Thats why I requested this from the mailing list.
Le 22/02/2023 à 10:03, Kautuk Consul a écrit :
Quoted 10 lines
A link from ibm.com states:
"Ensures that all instructions preceding the call to__lwsync
complete before any subsequent store instructions can be executed on the processor that executed the function. Also, it ensures that all load instructions preceding the call to__lwsynccomplete before any subsequent load instructions can be executed on the processor that executed the function. This allows you to synchronize between multiple processors with minimal performance impact, as__lwsyncdoes not wait for confirmation from each processor."
Quoted 7 lines
Thats why
smp_rmb()andsmp_wmb()are defined to lwsync. But this same understanding applies to parallel pipeline execution on each PowerPC processor.
So, use the lwsync instruction forrmb()andwmb()on the PPC architectures that support it.Signed-off-by Kautuk Consul <[email protected]>
Quoted 9 lines
--- arch/powerpc/include/asm/barrier.h | 7 +++++++ 1 file changed, 7 insertions(+)arch/powerpc/include/asm/barrier.h +0
-0
arch/powerpc/include/asm/barrier.h line 43
Quoted 8 lines
arch/powerpc/include/asm/barrier.h +5
-0@@ -36,8 +36,15 @@* heavy-weight sync, so smp_wmb() can be a lighter-weight eieio. */ #define __mb () __asm__ __volatile__ ("sync" : : : "memory") + +/* The sub-arch has lwsync. */ +#if defined(CONFIG_PPC64 ) || defined(CONFIG_PPC_E500MC ) +#define __rmb () __asm__ __volatile__ ("lwsync" : : : "memory") +#define __wmb () __asm__ __volatile__ ("lwsync" : : : "memory")
I'd have preferred with 'asm volatile' though.
Quoted 7 lines
arch/powerpc/include/asm/barrier.h +2
-0+#else #define __rmb () __asm__ __volatile__ ("sync" : : : "memory")#define __wmb () __asm__ __volatile__ ("sync" : : : "memory") +#endif /* The sub-arch has lwsync */ #if defined(CONFIG_PPC64 ) || defined(CONFIG_PPC_E500MC )
Quoted 2 lines
Reviewed-by Christophe Leroy <[email protected]>
Thanks!
Quoted 5 lines
Quoted 5 lines
--- arch/powerpc/include/asm/barrier.h | 7 +++++++ 1 file changed, 7 insertions(+)
Quoted 15 lines
arch/powerpc/include/asm/barrier.h line 43
Quoted 13 lines
arch/powerpc/include/asm/barrier.h +5
-0@@ -36,8 +36,15 @@* heavy-weight sync, so smp_wmb() can be a lighter-weight eieio. */ #define __mb () __asm__ __volatile__ ("sync" : : : "memory") + +/* The sub-arch has lwsync. */ +#if defined(CONFIG_PPC64 ) || defined(CONFIG_PPC_E500MC ) +#define __rmb () __asm__ __volatile__ ("lwsync" : : : "memory") +#define __wmb () __asm__ __volatile__ ("lwsync" : : : "memory")I'd have preferred with 'asm volatile' though.
Sorry about that! That wasn't the intent of this patch. Probably another patch series should change this manner of #defining assembly.
Le 22/02/2023 à 10:46, Kautuk Consul a écrit :
Quoted 23 lines
Quoted 2 lines
Reviewed-by Christophe Leroy <[email protected]>Thanks!
Quoted 5 lines
Quoted 5 lines
--- arch/powerpc/include/asm/barrier.h | 7 +++++++ 1 file changed, 7 insertions(+)Quoted 15 lines
arch/powerpc/include/asm/barrier.h line 43
Quoted 13 lines
arch/powerpc/include/asm/barrier.h +5
-0@@ -36,8 +36,15 @@* heavy-weight sync, so smp_wmb() can be a lighter-weight eieio. */ #define __mb () __asm__ __volatile__ ("sync" : : : "memory") + +/* The sub-arch has lwsync. */ +#if defined(CONFIG_PPC64 ) || defined(CONFIG_PPC_E500MC ) +#define __rmb () __asm__ __volatile__ ("lwsync" : : : "memory") +#define __wmb () __asm__ __volatile__ ("lwsync" : : : "memory")I'd have preferred with 'asm volatile' though.
Quoted 3 lines
Sorry about that! That wasn't the intent of this patch. Probably another patch series should change this manner of #defining assembly.
Why adding new line wrong then have to have another patch to make them right ?
When you build a new house in an old village, you first build your house with old materials and then you replace everything with new material ?
Quoted 10 lines
Quoted 4 lines
Quoted 1 line
I'd have preferred with 'asm volatile' though.
Sorry about that! That wasn't the intent of this patch. Probably another patch series should change this manner of #defining assembly.
Why adding new line wrong then have to have another patch to make them right ?
When you build a new house in an old village, you first build your house with old materials and then you replace everything with new material ?
Sorry Christophe. I will take care next time to adhere to new conventions.
Quoted 26 lines · Kautuk Consul
A link from ibm.com states:
"Ensures that all instructions preceding the call to__lwsync
complete before any subsequent store instructions can be executed on the processor that executed the function. Also, it ensures that all load instructions preceding the call to__lwsynccomplete before any subsequent load instructions can be executed on the processor that executed the function. This allows you to synchronize between multiple processors with minimal performance impact, as__lwsyncdoes not wait for confirmation from each processor."Thats why
smp_rmb()andsmp_wmb()are defined to lwsync. But this same understanding applies to parallel pipeline execution on each PowerPC processor.
So, use the lwsync instruction forrmb()andwmb()on the PPC architectures that support it.Signed-off-by Kautuk Consul <[email protected]>--- arch/powerpc/include/asm/barrier.h | 7 +++++++ 1 file changed, 7 insertions(+)arch/powerpc/include/asm/barrier.h +0
-0
arch/powerpc/include/asm/barrier.h line 43
Quoted 8 lines
arch/powerpc/include/asm/barrier.h +5
-0@@ -36,8 +36,15 @@* heavy-weight sync, so smp_wmb() can be a lighter-weight eieio. */ #define __mb () __asm__ __volatile__ ("sync" : : : "memory") + +/* The sub-arch has lwsync. */ +#if defined(CONFIG_PPC64 ) || defined(CONFIG_PPC_E500MC ) +#define __rmb () __asm__ __volatile__ ("lwsync" : : : "memory") +#define __wmb () __asm__ __volatile__ ("lwsync" : : : "memory")
Hmmm...
Does the lwsync instruction now order both cached and uncached accesses? Or have there been changes so that smp_rmb() and smp_wmb() get this definition, while rmb() and wmb() still get the sync instruction? (Not seeing this, but I could easily be missing something.)
Thanx, Paul
Quoted 10 lines
arch/powerpc/include/asm/barrier.h +2
-0+#else #define __rmb () __asm__ __volatile__ ("sync" : : : "memory")#define __wmb () __asm__ __volatile__ ("sync" : : : "memory") +#endif /* The sub-arch has lwsync */ #if defined(CONFIG_PPC64 ) || defined(CONFIG_PPC_E500MC )Signature · 1 line
2.31.1
Michael Ellerman
reviewerHi Paul,
Quoted 38 lines · Paul E. McKenney
Quoted 26 lines · Kautuk Consul
A link from ibm.com states:
"Ensures that all instructions preceding the call to__lwsync
complete before any subsequent store instructions can be executed on the processor that executed the function. Also, it ensures that all load instructions preceding the call to__lwsynccomplete before any subsequent load instructions can be executed on the processor that executed the function. This allows you to synchronize between multiple processors with minimal performance impact, as__lwsyncdoes not wait for confirmation from each processor."Thats why
smp_rmb()andsmp_wmb()are defined to lwsync. But this same understanding applies to parallel pipeline execution on each PowerPC processor.
So, use the lwsync instruction forrmb()andwmb()on the PPC architectures that support it.Signed-off-by Kautuk Consul <[email protected]>--- arch/powerpc/include/asm/barrier.h | 7 +++++++ 1 file changed, 7 insertions(+)arch/powerpc/include/asm/barrier.h +0
-0arch/powerpc/include/asm/barrier.h line 43
Quoted 8 lines
arch/powerpc/include/asm/barrier.h +5
-0@@ -36,8 +36,15 @@* heavy-weight sync, so smp_wmb() can be a lighter-weight eieio. */ #define __mb () __asm__ __volatile__ ("sync" : : : "memory") + +/* The sub-arch has lwsync. */ +#if defined(CONFIG_PPC64 ) || defined(CONFIG_PPC_E500MC ) +#define __rmb () __asm__ __volatile__ ("lwsync" : : : "memory") +#define __wmb () __asm__ __volatile__ ("lwsync" : : : "memory")Hmmm...
Quoted 1 line
Does the lwsync instruction now order both cached and uncached accesses?
No.
Quoted 2 lines
Or have there been changes so that
smp_rmb()andsmp_wmb()get this definition, whilermb()andwmb()still get the sync instruction?
No.
They come from:
include/asm-generic/barrier.h:#define rmb() do { kcsan_rmb(); __rmb(); } while (0)
include/asm-generic/barrier.h:#define wmb() do { kcsan_wmb(); __wmb(); } while (0)
Quoted 1 line
(Not seeing this, but I could easily be missing something.)
You are correct, the patch is wrong because it fails to account for IO accesses.
Kautuk, I'm not sure what motivated you to look at these barriers, was it just the documentation you linked to?
Maybe we need some better documentation in the kernel explaining why we use the barriers we do?
Although there's already a pretty decent comment above the definitions, but maybe it needs further clarification:
/*
* Memory barrier.
* The sync instruction guarantees that all memory accesses initiated
* by this processor have been performed (with respect to all other
* mechanisms that access memory). The eieio instruction is a barrier
* providing an ordering (separately) for (a) cacheable stores and (b)
* loads and stores to non-cacheable memory (e.g. I/O devices). *
* mb() prevents loads and stores being reordered across this point.
* rmb() prevents loads being reordered across this point.
* wmb() prevents stores being reordered across this point. *
* *mb() variants without smp_ prefix must order all types of memory
* operations with one another. sync is the only instruction sufficient
* to do this.
*
* For the smp_ barriers, ordering is for cacheable memory operations
* only. We have to use the sync instruction for smp_mb(), since lwsync
* doesn't order loads with respect to previous stores. Lwsync can be
* used for smp_rmb() and smp_wmb().
cheers
Quoted 81 lines · Michael Ellerman
Hi Paul,
Quoted 38 lines · Paul E. McKenney
Quoted 26 lines · Kautuk Consul
A link from ibm.com states:
"Ensures that all instructions preceding the call to__lwsync
complete before any subsequent store instructions can be executed on the processor that executed the function. Also, it ensures that all load instructions preceding the call to__lwsynccomplete before any subsequent load instructions can be executed on the processor that executed the function. This allows you to synchronize between multiple processors with minimal performance impact, as__lwsyncdoes not wait for confirmation from each processor."Thats why
smp_rmb()andsmp_wmb()are defined to lwsync. But this same understanding applies to parallel pipeline execution on each PowerPC processor.
So, use the lwsync instruction forrmb()andwmb()on the PPC architectures that support it.Signed-off-by Kautuk Consul <[email protected]>--- arch/powerpc/include/asm/barrier.h | 7 +++++++ 1 file changed, 7 insertions(+)arch/powerpc/include/asm/barrier.h +0
-0arch/powerpc/include/asm/barrier.h line 43
Quoted 8 lines
arch/powerpc/include/asm/barrier.h +5
-0@@ -36,8 +36,15 @@* heavy-weight sync, so smp_wmb() can be a lighter-weight eieio. */ #define __mb () __asm__ __volatile__ ("sync" : : : "memory") + +/* The sub-arch has lwsync. */ +#if defined(CONFIG_PPC64 ) || defined(CONFIG_PPC_E500MC ) +#define __rmb () __asm__ __volatile__ ("lwsync" : : : "memory") +#define __wmb () __asm__ __volatile__ ("lwsync" : : : "memory")Hmmm...
Quoted 1 line
Does the lwsync instruction now order both cached and uncached accesses?
No.
Quoted 2 lines
Or have there been changes so that
smp_rmb()andsmp_wmb()get this definition, whilermb()andwmb()still get the sync instruction?No.
They come from:
include/asm-generic/barrier.h:#define
rmb()do {kcsan_rmb();__rmb(); } while (0)
include/asm-generic/barrier.h:#definewmb()do {kcsan_wmb();__wmb(); } while (0)Quoted 1 line
(Not seeing this, but I could easily be missing something.)
You are correct, the patch is wrong because it fails to account for IO accesses.
Kautuk, I'm not sure what motivated you to look at these barriers, was it just the documentation you linked to?
Maybe we need some better documentation in the kernel explaining why we use the barriers we do?
Although there's already a pretty decent comment above the definitions, but maybe it needs further clarification:
/*
* Memory barrier.
* The sync instruction guarantees that all memory accesses initiated
* by this processor have been performed (with respect to all other
* mechanisms that access memory). The eieio instruction is a barrier
* providing an ordering (separately) for (a) cacheable stores and (b)
* loads and stores to non-cacheable memory (e.g. I/O devices). *
*mb()prevents loads and stores being reordered across this point.
*rmb()prevents loads being reordered across this point.
*wmb()prevents stores being reordered across this point. *
Quoted 8 lines
*
*mb()variants withoutsmp_prefix must order all types of memory
* operations with one another. sync is the only instruction sufficient
* to do this.
*
* For thesmp_barriers, ordering is for cacheable memory operations
* only. We have to use the sync instruction forsmp_mb(), since lwsync
* doesn't order loads with respect to previous stores. Lwsync can be
* used forsmp_rmb()andsmp_wmb().
Sorry I didn't change the comment.
My point is: Is the "sync is the only instruction sufficient to do this" comment completely correct?
As I mentioned in my reply to Paul there I didn't find any documentation that up-front states (in the differences between sync and lwsync) that lwsync distinguishes between cached and unchached accesses.
Quoted 3 lines
cheers
Quoted 3 lines
You are correct, the patch is wrong because it fails to account for IO accesses.
Okay, I looked at the PowerPC ISA and found:
"The memory barrier provides an ordering function for the storage accesses caused by Load, Store,and dcbz instructions that are executed by the processor executing the sync instruction and for which the specified storage location is in storage that is Memory Coherence Required and is neitherWrite Through Required nor Caching Inhibited.The applicable pairs are all pairs ai ,bj of such accesses except those in which ai is an accesscaused by a Store or dcbz instruction and bj is anaccess caused by a Load instruction."
Thanks for your time, Michael. Sorry for the noise.
Quoted 3 lines
Kautuk, I'm not sure what motivated you to look at these barriers, was it just the documentation you linked to?
I read the basic documentation. Now that I have access to the PowerISA document I guess I'll go through it more thoroughly.
Quoted 1 line
Michael Ellerman
reviewerQuoted 10 lines · Kautuk Consul
Quoted 3 lines
You are correct, the patch is wrong because it fails to account for IO accesses.
Okay, I looked at the PowerPC ISA and found:
"The memory barrier provides an ordering function for the storage accesses caused by Load, Store,and dcbz instructions that are executed by the processor executing the sync instruction and for which the specified storage location is in storage that is Memory Coherence Required and is neither Write Through Required nor Caching Inhibited.
Yep, that's the key sentence there. If you look at the definition for "sync" it has not exceptions for different storage types.
I agree it's not very clear unless you're looking closely.
Quoted 7 lines
Thanks for your time, Michael. Sorry for the noise.
Quoted 3 lines
Kautuk, I'm not sure what motivated you to look at these barriers, was it just the documentation you linked to?
I read the basic documentation. Now that I have access to the PowerISA document I guess I'll go through it more thoroughly.
The ISA is available publicly. There's links to most versions here:
https://wiki.raptorcs.com/wiki/Power_ISA
cheers
Quoted 38 lines · Paul E. McKenney
Quoted 26 lines · Kautuk Consul
A link from ibm.com states:
"Ensures that all instructions preceding the call to__lwsync
complete before any subsequent store instructions can be executed on the processor that executed the function. Also, it ensures that all load instructions preceding the call to__lwsynccomplete before any subsequent load instructions can be executed on the processor that executed the function. This allows you to synchronize between multiple processors with minimal performance impact, as__lwsyncdoes not wait for confirmation from each processor."Thats why
smp_rmb()andsmp_wmb()are defined to lwsync. But this same understanding applies to parallel pipeline execution on each PowerPC processor.
So, use the lwsync instruction forrmb()andwmb()on the PPC architectures that support it.Signed-off-by Kautuk Consul <[email protected]>--- arch/powerpc/include/asm/barrier.h | 7 +++++++ 1 file changed, 7 insertions(+)arch/powerpc/include/asm/barrier.h +0
-0arch/powerpc/include/asm/barrier.h line 43
Quoted 8 lines
arch/powerpc/include/asm/barrier.h +5
-0@@ -36,8 +36,15 @@* heavy-weight sync, so smp_wmb() can be a lighter-weight eieio. */ #define __mb () __asm__ __volatile__ ("sync" : : : "memory") + +/* The sub-arch has lwsync. */ +#if defined(CONFIG_PPC64 ) || defined(CONFIG_PPC_E500MC ) +#define __rmb () __asm__ __volatile__ ("lwsync" : : : "memory") +#define __wmb () __asm__ __volatile__ ("lwsync" : : : "memory")Hmmm...
Quoted 6 lines
Does the lwsync instruction now order both cached and uncached accesses? Or have there been changes so that
smp_rmb()andsmp_wmb()get this definition, whilermb()andwmb()still get the sync instruction? (Not seeing this, but I could easily be missing something.)Thanx, Paul
Upfront I don't see any documentation that states that lwsync distinguishes between cached and uncached accesses. That's why I requested the mailing list for test results with kernel load testing.
Quoted 11 lines
Quoted 11 lines
arch/powerpc/include/asm/barrier.h +2
-0+#else #define __rmb () __asm__ __volatile__ ("sync" : : : "memory")#define __wmb () __asm__ __volatile__ ("sync" : : : "memory") +#endif /* The sub-arch has lwsync */ #if defined(CONFIG_PPC64 ) || defined(CONFIG_PPC_E500MC )Signature · 1 line
2.31.1
Quoted 44 lines · Kautuk Consul
Quoted 38 lines · Paul E. McKenney
Quoted 26 lines · Kautuk Consul
A link from ibm.com states:
"Ensures that all instructions preceding the call to__lwsync
complete before any subsequent store instructions can be executed on the processor that executed the function. Also, it ensures that all load instructions preceding the call to__lwsynccomplete before any subsequent load instructions can be executed on the processor that executed the function. This allows you to synchronize between multiple processors with minimal performance impact, as__lwsyncdoes not wait for confirmation from each processor."Thats why
smp_rmb()andsmp_wmb()are defined to lwsync. But this same understanding applies to parallel pipeline execution on each PowerPC processor.
So, use the lwsync instruction forrmb()andwmb()on the PPC architectures that support it.Signed-off-by Kautuk Consul <[email protected]>--- arch/powerpc/include/asm/barrier.h | 7 +++++++ 1 file changed, 7 insertions(+)arch/powerpc/include/asm/barrier.h +0
-0arch/powerpc/include/asm/barrier.h line 43
Quoted 8 lines
arch/powerpc/include/asm/barrier.h +5
-0@@ -36,8 +36,15 @@* heavy-weight sync, so smp_wmb() can be a lighter-weight eieio. */ #define __mb () __asm__ __volatile__ ("sync" : : : "memory") + +/* The sub-arch has lwsync. */ +#if defined(CONFIG_PPC64 ) || defined(CONFIG_PPC_E500MC ) +#define __rmb () __asm__ __volatile__ ("lwsync" : : : "memory") +#define __wmb () __asm__ __volatile__ ("lwsync" : : : "memory")Hmmm...
Quoted 4 lines
Does the lwsync instruction now order both cached and uncached accesses? Or have there been changes so that
smp_rmb()andsmp_wmb()get this definition, whilermb()andwmb()still get the sync instruction? (Not seeing this, but I could easily be missing something.)
Quoted 4 lines
Upfront I don't see any documentation that states that lwsync distinguishes between cached and uncached accesses. That's why I requested the mailing list for test results with kernel load testing.
I suggest giving the reference manual a very careful read. I wish I could be more helpful, but I found that a very long time ago, and no longer recall exactly where it was stated.
But maybe Michael Ellerman has a pointer?
Thanx, Paul
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
arch/powerpc/include/asm/barrier.h +2
-0+#else #define __rmb () __asm__ __volatile__ ("sync" : : : "memory")#define __wmb () __asm__ __volatile__ ("sync" : : : "memory") +#endif /* The sub-arch has lwsync */ #if defined(CONFIG_PPC64 ) || defined(CONFIG_PPC_E500MC )Signature · 1 line
2.31.1
Quoted 45 lines · Paul E. McKenney
Quoted 43 lines · Kautuk Consul
Quoted 42 lines · Paul E. McKenney
Quoted 26 lines · Kautuk Consul
A link from ibm.com states:
"Ensures that all instructions preceding the call to__lwsync
complete before any subsequent store instructions can be executed on the processor that executed the function. Also, it ensures that all load instructions preceding the call to__lwsynccomplete before any subsequent load instructions can be executed on the processor that executed the function. This allows you to synchronize between multiple processors with minimal performance impact, as__lwsyncdoes not wait for confirmation from each processor."Thats why
smp_rmb()andsmp_wmb()are defined to lwsync. But this same understanding applies to parallel pipeline execution on each PowerPC processor.
So, use the lwsync instruction forrmb()andwmb()on the PPC architectures that support it.Signed-off-by Kautuk Consul <[email protected]>--- arch/powerpc/include/asm/barrier.h | 7 +++++++ 1 file changed, 7 insertions(+)arch/powerpc/include/asm/barrier.h +0
-0arch/powerpc/include/asm/barrier.h line 43
Quoted 8 lines
arch/powerpc/include/asm/barrier.h +5
-0@@ -36,8 +36,15 @@* heavy-weight sync, so smp_wmb() can be a lighter-weight eieio. */ #define __mb () __asm__ __volatile__ ("sync" : : : "memory") + +/* The sub-arch has lwsync. */ +#if defined(CONFIG_PPC64 ) || defined(CONFIG_PPC_E500MC ) +#define __rmb () __asm__ __volatile__ ("lwsync" : : : "memory") +#define __wmb () __asm__ __volatile__ ("lwsync" : : : "memory")Hmmm...
Does the lwsync instruction now order both cached and uncached accesses? Or have there been changes so that
smp_rmb()andsmp_wmb()get this definition, whilermb()andwmb()still get the sync instruction? (Not seeing this, but I could easily be missing something.)
Quoted 8 lines
Quoted 4 lines
Upfront I don't see any documentation that states that lwsync distinguishes between cached and uncached accesses. That's why I requested the mailing list for test results with kernel load testing.
I suggest giving the reference manual a very careful read. I wish I could be more helpful, but I found that a very long time ago, and no longer recall exactly where it was stated.
Will do that as soon as I get an opprotunity.
Quoted 2 lines
But maybe Michael Ellerman has a pointer?
Sure. Maybe the cached and uncached accesses in these instructions should be spelt out more clearly for newer people like me. :-)
Thanks for your time, Paul.
Quoted 13 lines
Thanx, Paul
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
arch/powerpc/include/asm/barrier.h +2
-0+#else #define __rmb () __asm__ __volatile__ ("sync" : : : "memory")#define __wmb () __asm__ __volatile__ ("sync" : : : "memory") +#endif /* The sub-arch has lwsync */ #if defined(CONFIG_PPC64 ) || defined(CONFIG_PPC_E500MC )Signature · 1 line
2.31.1