* [PATCH 1/2] locking/xchg/alpha: Use smp_mb() in place of __ASM__MB
@ 2018-02-22 9:24 Andrea Parri
2018-02-22 21:46 ` Paul E. McKenney
2018-02-23 8:27 ` [tip:locking/urgent] locking/xchg/alpha: Clean up barrier usage by using " tip-bot for Andrea Parri
0 siblings, 2 replies; 4+ messages in thread
From: Andrea Parri @ 2018-02-22 9:24 UTC (permalink / raw)
To: Ingo Molnar, Peter Zijlstra
Cc: Andrea Parri, Paul E . McKenney, Alan Stern, Ivan Kokshaysky,
Matt Turner, Richard Henderson, linux-alpha, linux-kernel
Replace each occurrence of __ASM__MB with a (trailing) smp_mb() in
xchg(), cmpxchg(), and remove the now unused __ASM__MB definitions;
this improves readability, with no additional synchronization cost.
Suggested-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: linux-alpha@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
arch/alpha/include/asm/cmpxchg.h | 6 ------
arch/alpha/include/asm/xchg.h | 16 ++++++++--------
2 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/arch/alpha/include/asm/cmpxchg.h b/arch/alpha/include/asm/cmpxchg.h
index 46ebf14aed4e5..8a2b331e43feb 100644
--- a/arch/alpha/include/asm/cmpxchg.h
+++ b/arch/alpha/include/asm/cmpxchg.h
@@ -6,7 +6,6 @@
* Atomic exchange routines.
*/
-#define __ASM__MB
#define ____xchg(type, args...) __xchg ## type ## _local(args)
#define ____cmpxchg(type, args...) __cmpxchg ## type ## _local(args)
#include <asm/xchg.h>
@@ -33,10 +32,6 @@
cmpxchg_local((ptr), (o), (n)); \
})
-#ifdef CONFIG_SMP
-#undef __ASM__MB
-#define __ASM__MB "\tmb\n"
-#endif
#undef ____xchg
#undef ____cmpxchg
#define ____xchg(type, args...) __xchg ##type(args)
@@ -64,7 +59,6 @@
cmpxchg((ptr), (o), (n)); \
})
-#undef __ASM__MB
#undef ____cmpxchg
#endif /* _ALPHA_CMPXCHG_H */
diff --git a/arch/alpha/include/asm/xchg.h b/arch/alpha/include/asm/xchg.h
index e2660866ce972..e1facf6fc2446 100644
--- a/arch/alpha/include/asm/xchg.h
+++ b/arch/alpha/include/asm/xchg.h
@@ -28,12 +28,12 @@ ____xchg(_u8, volatile char *m, unsigned long val)
" or %1,%2,%2\n"
" stq_c %2,0(%3)\n"
" beq %2,2f\n"
- __ASM__MB
".subsection 2\n"
"2: br 1b\n"
".previous"
: "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64)
: "r" ((long)m), "1" (val) : "memory");
+ smp_mb();
return ret;
}
@@ -52,12 +52,12 @@ ____xchg(_u16, volatile short *m, unsigned long val)
" or %1,%2,%2\n"
" stq_c %2,0(%3)\n"
" beq %2,2f\n"
- __ASM__MB
".subsection 2\n"
"2: br 1b\n"
".previous"
: "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64)
: "r" ((long)m), "1" (val) : "memory");
+ smp_mb();
return ret;
}
@@ -72,12 +72,12 @@ ____xchg(_u32, volatile int *m, unsigned long val)
" bis $31,%3,%1\n"
" stl_c %1,%2\n"
" beq %1,2f\n"
- __ASM__MB
".subsection 2\n"
"2: br 1b\n"
".previous"
: "=&r" (val), "=&r" (dummy), "=m" (*m)
: "rI" (val), "m" (*m) : "memory");
+ smp_mb();
return val;
}
@@ -92,12 +92,12 @@ ____xchg(_u64, volatile long *m, unsigned long val)
" bis $31,%3,%1\n"
" stq_c %1,%2\n"
" beq %1,2f\n"
- __ASM__MB
".subsection 2\n"
"2: br 1b\n"
".previous"
: "=&r" (val), "=&r" (dummy), "=m" (*m)
: "rI" (val), "m" (*m) : "memory");
+ smp_mb();
return val;
}
@@ -150,12 +150,12 @@ ____cmpxchg(_u8, volatile char *m, unsigned char old, unsigned char new)
" stq_c %2,0(%4)\n"
" beq %2,3f\n"
"2:\n"
- __ASM__MB
".subsection 2\n"
"3: br 1b\n"
".previous"
: "=&r" (prev), "=&r" (new), "=&r" (tmp), "=&r" (cmp), "=&r" (addr64)
: "r" ((long)m), "Ir" (old), "1" (new) : "memory");
+ smp_mb();
return prev;
}
@@ -177,12 +177,12 @@ ____cmpxchg(_u16, volatile short *m, unsigned short old, unsigned short new)
" stq_c %2,0(%4)\n"
" beq %2,3f\n"
"2:\n"
- __ASM__MB
".subsection 2\n"
"3: br 1b\n"
".previous"
: "=&r" (prev), "=&r" (new), "=&r" (tmp), "=&r" (cmp), "=&r" (addr64)
: "r" ((long)m), "Ir" (old), "1" (new) : "memory");
+ smp_mb();
return prev;
}
@@ -200,12 +200,12 @@ ____cmpxchg(_u32, volatile int *m, int old, int new)
" stl_c %1,%2\n"
" beq %1,3f\n"
"2:\n"
- __ASM__MB
".subsection 2\n"
"3: br 1b\n"
".previous"
: "=&r"(prev), "=&r"(cmp), "=m"(*m)
: "r"((long) old), "r"(new), "m"(*m) : "memory");
+ smp_mb();
return prev;
}
@@ -223,12 +223,12 @@ ____cmpxchg(_u64, volatile long *m, unsigned long old, unsigned long new)
" stq_c %1,%2\n"
" beq %1,3f\n"
"2:\n"
- __ASM__MB
".subsection 2\n"
"3: br 1b\n"
".previous"
: "=&r"(prev), "=&r"(cmp), "=m"(*m)
: "r"((long) old), "r"(new), "m"(*m) : "memory");
+ smp_mb();
return prev;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] locking/xchg/alpha: Use smp_mb() in place of __ASM__MB
2018-02-22 9:24 [PATCH 1/2] locking/xchg/alpha: Use smp_mb() in place of __ASM__MB Andrea Parri
@ 2018-02-22 21:46 ` Paul E. McKenney
2018-02-23 8:27 ` [tip:locking/urgent] locking/xchg/alpha: Clean up barrier usage by using " tip-bot for Andrea Parri
1 sibling, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2018-02-22 21:46 UTC (permalink / raw)
To: Andrea Parri
Cc: Ingo Molnar, Peter Zijlstra, Alan Stern, Ivan Kokshaysky,
Matt Turner, Richard Henderson, linux-alpha, linux-kernel
On Thu, Feb 22, 2018 at 10:24:29AM +0100, Andrea Parri wrote:
> Replace each occurrence of __ASM__MB with a (trailing) smp_mb() in
> xchg(), cmpxchg(), and remove the now unused __ASM__MB definitions;
> this improves readability, with no additional synchronization cost.
>
> Suggested-by: Will Deacon <will.deacon@arm.com>
> Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
I am a bit confused by the use of out-of-line branches to do a backwards
branch, but those were in place to start with. Maybe the point is to
defeat backwards-branch prediction or some such.
Regardless...
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Cc: Alan Stern <stern@rowland.harvard.edu>
> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
> Cc: Matt Turner <mattst88@gmail.com>
> Cc: Richard Henderson <rth@twiddle.net>
> Cc: linux-alpha@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> ---
> arch/alpha/include/asm/cmpxchg.h | 6 ------
> arch/alpha/include/asm/xchg.h | 16 ++++++++--------
> 2 files changed, 8 insertions(+), 14 deletions(-)
>
> diff --git a/arch/alpha/include/asm/cmpxchg.h b/arch/alpha/include/asm/cmpxchg.h
> index 46ebf14aed4e5..8a2b331e43feb 100644
> --- a/arch/alpha/include/asm/cmpxchg.h
> +++ b/arch/alpha/include/asm/cmpxchg.h
> @@ -6,7 +6,6 @@
> * Atomic exchange routines.
> */
>
> -#define __ASM__MB
> #define ____xchg(type, args...) __xchg ## type ## _local(args)
> #define ____cmpxchg(type, args...) __cmpxchg ## type ## _local(args)
> #include <asm/xchg.h>
> @@ -33,10 +32,6 @@
> cmpxchg_local((ptr), (o), (n)); \
> })
>
> -#ifdef CONFIG_SMP
> -#undef __ASM__MB
> -#define __ASM__MB "\tmb\n"
> -#endif
> #undef ____xchg
> #undef ____cmpxchg
> #define ____xchg(type, args...) __xchg ##type(args)
> @@ -64,7 +59,6 @@
> cmpxchg((ptr), (o), (n)); \
> })
>
> -#undef __ASM__MB
> #undef ____cmpxchg
>
> #endif /* _ALPHA_CMPXCHG_H */
> diff --git a/arch/alpha/include/asm/xchg.h b/arch/alpha/include/asm/xchg.h
> index e2660866ce972..e1facf6fc2446 100644
> --- a/arch/alpha/include/asm/xchg.h
> +++ b/arch/alpha/include/asm/xchg.h
> @@ -28,12 +28,12 @@ ____xchg(_u8, volatile char *m, unsigned long val)
> " or %1,%2,%2\n"
> " stq_c %2,0(%3)\n"
> " beq %2,2f\n"
> - __ASM__MB
> ".subsection 2\n"
> "2: br 1b\n"
> ".previous"
> : "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64)
> : "r" ((long)m), "1" (val) : "memory");
> + smp_mb();
>
> return ret;
> }
> @@ -52,12 +52,12 @@ ____xchg(_u16, volatile short *m, unsigned long val)
> " or %1,%2,%2\n"
> " stq_c %2,0(%3)\n"
> " beq %2,2f\n"
> - __ASM__MB
> ".subsection 2\n"
> "2: br 1b\n"
> ".previous"
> : "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64)
> : "r" ((long)m), "1" (val) : "memory");
> + smp_mb();
>
> return ret;
> }
> @@ -72,12 +72,12 @@ ____xchg(_u32, volatile int *m, unsigned long val)
> " bis $31,%3,%1\n"
> " stl_c %1,%2\n"
> " beq %1,2f\n"
> - __ASM__MB
> ".subsection 2\n"
> "2: br 1b\n"
> ".previous"
> : "=&r" (val), "=&r" (dummy), "=m" (*m)
> : "rI" (val), "m" (*m) : "memory");
> + smp_mb();
>
> return val;
> }
> @@ -92,12 +92,12 @@ ____xchg(_u64, volatile long *m, unsigned long val)
> " bis $31,%3,%1\n"
> " stq_c %1,%2\n"
> " beq %1,2f\n"
> - __ASM__MB
> ".subsection 2\n"
> "2: br 1b\n"
> ".previous"
> : "=&r" (val), "=&r" (dummy), "=m" (*m)
> : "rI" (val), "m" (*m) : "memory");
> + smp_mb();
>
> return val;
> }
> @@ -150,12 +150,12 @@ ____cmpxchg(_u8, volatile char *m, unsigned char old, unsigned char new)
> " stq_c %2,0(%4)\n"
> " beq %2,3f\n"
> "2:\n"
> - __ASM__MB
> ".subsection 2\n"
> "3: br 1b\n"
> ".previous"
> : "=&r" (prev), "=&r" (new), "=&r" (tmp), "=&r" (cmp), "=&r" (addr64)
> : "r" ((long)m), "Ir" (old), "1" (new) : "memory");
> + smp_mb();
>
> return prev;
> }
> @@ -177,12 +177,12 @@ ____cmpxchg(_u16, volatile short *m, unsigned short old, unsigned short new)
> " stq_c %2,0(%4)\n"
> " beq %2,3f\n"
> "2:\n"
> - __ASM__MB
> ".subsection 2\n"
> "3: br 1b\n"
> ".previous"
> : "=&r" (prev), "=&r" (new), "=&r" (tmp), "=&r" (cmp), "=&r" (addr64)
> : "r" ((long)m), "Ir" (old), "1" (new) : "memory");
> + smp_mb();
>
> return prev;
> }
> @@ -200,12 +200,12 @@ ____cmpxchg(_u32, volatile int *m, int old, int new)
> " stl_c %1,%2\n"
> " beq %1,3f\n"
> "2:\n"
> - __ASM__MB
> ".subsection 2\n"
> "3: br 1b\n"
> ".previous"
> : "=&r"(prev), "=&r"(cmp), "=m"(*m)
> : "r"((long) old), "r"(new), "m"(*m) : "memory");
> + smp_mb();
>
> return prev;
> }
> @@ -223,12 +223,12 @@ ____cmpxchg(_u64, volatile long *m, unsigned long old, unsigned long new)
> " stq_c %1,%2\n"
> " beq %1,3f\n"
> "2:\n"
> - __ASM__MB
> ".subsection 2\n"
> "3: br 1b\n"
> ".previous"
> : "=&r"(prev), "=&r"(cmp), "=m"(*m)
> : "r"((long) old), "r"(new), "m"(*m) : "memory");
> + smp_mb();
>
> return prev;
> }
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip:locking/urgent] locking/xchg/alpha: Clean up barrier usage by using smp_mb() in place of __ASM__MB
2018-02-22 9:24 [PATCH 1/2] locking/xchg/alpha: Use smp_mb() in place of __ASM__MB Andrea Parri
2018-02-22 21:46 ` Paul E. McKenney
@ 2018-02-23 8:27 ` tip-bot for Andrea Parri
2018-02-26 18:05 ` Will Deacon
1 sibling, 1 reply; 4+ messages in thread
From: tip-bot for Andrea Parri @ 2018-02-23 8:27 UTC (permalink / raw)
To: linux-tip-commits
Cc: will.deacon, rth, mattst88, tglx, hpa, parri.andrea, ink, stern,
paulmck, mingo, linux-kernel, peterz, torvalds, akpm
Commit-ID: 79d442461df7478cdd0c50d9b8a76f431f150fa3
Gitweb: https://git.kernel.org/tip/79d442461df7478cdd0c50d9b8a76f431f150fa3
Author: Andrea Parri <parri.andrea@gmail.com>
AuthorDate: Thu, 22 Feb 2018 10:24:29 +0100
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 23 Feb 2018 08:38:15 +0100
locking/xchg/alpha: Clean up barrier usage by using smp_mb() in place of __ASM__MB
Replace each occurrence of __ASM__MB with a (trailing) smp_mb() in
xchg(), cmpxchg(), and remove the now unused __ASM__MB definitions;
this improves readability, with no additional synchronization cost.
Suggested-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-alpha@vger.kernel.org
Link: http://lkml.kernel.org/r/1519291469-5702-1-git-send-email-parri.andrea@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/alpha/include/asm/cmpxchg.h | 6 ------
arch/alpha/include/asm/xchg.h | 16 ++++++++--------
2 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/arch/alpha/include/asm/cmpxchg.h b/arch/alpha/include/asm/cmpxchg.h
index 46ebf14aed4e..8a2b331e43fe 100644
--- a/arch/alpha/include/asm/cmpxchg.h
+++ b/arch/alpha/include/asm/cmpxchg.h
@@ -6,7 +6,6 @@
* Atomic exchange routines.
*/
-#define __ASM__MB
#define ____xchg(type, args...) __xchg ## type ## _local(args)
#define ____cmpxchg(type, args...) __cmpxchg ## type ## _local(args)
#include <asm/xchg.h>
@@ -33,10 +32,6 @@
cmpxchg_local((ptr), (o), (n)); \
})
-#ifdef CONFIG_SMP
-#undef __ASM__MB
-#define __ASM__MB "\tmb\n"
-#endif
#undef ____xchg
#undef ____cmpxchg
#define ____xchg(type, args...) __xchg ##type(args)
@@ -64,7 +59,6 @@
cmpxchg((ptr), (o), (n)); \
})
-#undef __ASM__MB
#undef ____cmpxchg
#endif /* _ALPHA_CMPXCHG_H */
diff --git a/arch/alpha/include/asm/xchg.h b/arch/alpha/include/asm/xchg.h
index e2660866ce97..e1facf6fc244 100644
--- a/arch/alpha/include/asm/xchg.h
+++ b/arch/alpha/include/asm/xchg.h
@@ -28,12 +28,12 @@ ____xchg(_u8, volatile char *m, unsigned long val)
" or %1,%2,%2\n"
" stq_c %2,0(%3)\n"
" beq %2,2f\n"
- __ASM__MB
".subsection 2\n"
"2: br 1b\n"
".previous"
: "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64)
: "r" ((long)m), "1" (val) : "memory");
+ smp_mb();
return ret;
}
@@ -52,12 +52,12 @@ ____xchg(_u16, volatile short *m, unsigned long val)
" or %1,%2,%2\n"
" stq_c %2,0(%3)\n"
" beq %2,2f\n"
- __ASM__MB
".subsection 2\n"
"2: br 1b\n"
".previous"
: "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64)
: "r" ((long)m), "1" (val) : "memory");
+ smp_mb();
return ret;
}
@@ -72,12 +72,12 @@ ____xchg(_u32, volatile int *m, unsigned long val)
" bis $31,%3,%1\n"
" stl_c %1,%2\n"
" beq %1,2f\n"
- __ASM__MB
".subsection 2\n"
"2: br 1b\n"
".previous"
: "=&r" (val), "=&r" (dummy), "=m" (*m)
: "rI" (val), "m" (*m) : "memory");
+ smp_mb();
return val;
}
@@ -92,12 +92,12 @@ ____xchg(_u64, volatile long *m, unsigned long val)
" bis $31,%3,%1\n"
" stq_c %1,%2\n"
" beq %1,2f\n"
- __ASM__MB
".subsection 2\n"
"2: br 1b\n"
".previous"
: "=&r" (val), "=&r" (dummy), "=m" (*m)
: "rI" (val), "m" (*m) : "memory");
+ smp_mb();
return val;
}
@@ -150,12 +150,12 @@ ____cmpxchg(_u8, volatile char *m, unsigned char old, unsigned char new)
" stq_c %2,0(%4)\n"
" beq %2,3f\n"
"2:\n"
- __ASM__MB
".subsection 2\n"
"3: br 1b\n"
".previous"
: "=&r" (prev), "=&r" (new), "=&r" (tmp), "=&r" (cmp), "=&r" (addr64)
: "r" ((long)m), "Ir" (old), "1" (new) : "memory");
+ smp_mb();
return prev;
}
@@ -177,12 +177,12 @@ ____cmpxchg(_u16, volatile short *m, unsigned short old, unsigned short new)
" stq_c %2,0(%4)\n"
" beq %2,3f\n"
"2:\n"
- __ASM__MB
".subsection 2\n"
"3: br 1b\n"
".previous"
: "=&r" (prev), "=&r" (new), "=&r" (tmp), "=&r" (cmp), "=&r" (addr64)
: "r" ((long)m), "Ir" (old), "1" (new) : "memory");
+ smp_mb();
return prev;
}
@@ -200,12 +200,12 @@ ____cmpxchg(_u32, volatile int *m, int old, int new)
" stl_c %1,%2\n"
" beq %1,3f\n"
"2:\n"
- __ASM__MB
".subsection 2\n"
"3: br 1b\n"
".previous"
: "=&r"(prev), "=&r"(cmp), "=m"(*m)
: "r"((long) old), "r"(new), "m"(*m) : "memory");
+ smp_mb();
return prev;
}
@@ -223,12 +223,12 @@ ____cmpxchg(_u64, volatile long *m, unsigned long old, unsigned long new)
" stq_c %1,%2\n"
" beq %1,3f\n"
"2:\n"
- __ASM__MB
".subsection 2\n"
"3: br 1b\n"
".previous"
: "=&r"(prev), "=&r"(cmp), "=m"(*m)
: "r"((long) old), "r"(new), "m"(*m) : "memory");
+ smp_mb();
return prev;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [tip:locking/urgent] locking/xchg/alpha: Clean up barrier usage by using smp_mb() in place of __ASM__MB
2018-02-23 8:27 ` [tip:locking/urgent] locking/xchg/alpha: Clean up barrier usage by using " tip-bot for Andrea Parri
@ 2018-02-26 18:05 ` Will Deacon
0 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2018-02-26 18:05 UTC (permalink / raw)
To: mattst88, rth, tglx, hpa, stern, parri.andrea, ink, akpm,
paulmck, torvalds, linux-kernel, peterz, mingo
Cc: linux-tip-commits
Hi Andrea,
I know this is in mainline now, but I think the way you've got the barriers
here:
On Fri, Feb 23, 2018 at 12:27:54AM -0800, tip-bot for Andrea Parri wrote:
> diff --git a/arch/alpha/include/asm/cmpxchg.h b/arch/alpha/include/asm/cmpxchg.h
> index 46ebf14aed4e..8a2b331e43fe 100644
> --- a/arch/alpha/include/asm/cmpxchg.h
> +++ b/arch/alpha/include/asm/cmpxchg.h
> @@ -6,7 +6,6 @@
> * Atomic exchange routines.
> */
>
> -#define __ASM__MB
> #define ____xchg(type, args...) __xchg ## type ## _local(args)
> #define ____cmpxchg(type, args...) __cmpxchg ## type ## _local(args)
> #include <asm/xchg.h>
> @@ -33,10 +32,6 @@
> cmpxchg_local((ptr), (o), (n)); \
> })
>
> -#ifdef CONFIG_SMP
> -#undef __ASM__MB
> -#define __ASM__MB "\tmb\n"
> -#endif
> #undef ____xchg
> #undef ____cmpxchg
> #define ____xchg(type, args...) __xchg ##type(args)
> @@ -64,7 +59,6 @@
> cmpxchg((ptr), (o), (n)); \
> })
>
> -#undef __ASM__MB
> #undef ____cmpxchg
>
> #endif /* _ALPHA_CMPXCHG_H */
> diff --git a/arch/alpha/include/asm/xchg.h b/arch/alpha/include/asm/xchg.h
> index e2660866ce97..e1facf6fc244 100644
> --- a/arch/alpha/include/asm/xchg.h
> +++ b/arch/alpha/include/asm/xchg.h
> @@ -28,12 +28,12 @@ ____xchg(_u8, volatile char *m, unsigned long val)
> " or %1,%2,%2\n"
> " stq_c %2,0(%3)\n"
> " beq %2,2f\n"
> - __ASM__MB
> ".subsection 2\n"
> "2: br 1b\n"
> ".previous"
> : "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64)
> : "r" ((long)m), "1" (val) : "memory");
> + smp_mb();
>
> return ret;
ends up adding unnecessary barriers to the _local variants, which the
previous code took care to avoid. That's why I suggesting adding
the smp_mb() into the cmpxchg macro rather than the ____cmpxchg variants.
I think it's worth spinning another patch to fix this properly.
Will
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-02-26 18:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-22 9:24 [PATCH 1/2] locking/xchg/alpha: Use smp_mb() in place of __ASM__MB Andrea Parri
2018-02-22 21:46 ` Paul E. McKenney
2018-02-23 8:27 ` [tip:locking/urgent] locking/xchg/alpha: Clean up barrier usage by using " tip-bot for Andrea Parri
2018-02-26 18:05 ` Will Deacon
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.