linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/3] locking/atomic: openrisc: use generic_cmpxchg[64]_local for arch_cmpxchg[64]_local
@ 2023-10-26  7:39 wuqiang.matt
  2023-10-26  8:46 ` Arnd Bergmann
  0 siblings, 1 reply; 11+ messages in thread
From: wuqiang.matt @ 2023-10-26  7:39 UTC (permalink / raw)
  To: Jonas Bonn, Stefan Kristiansson, Stafford Horne, Ingo Molnar,
	Peter Zijlstra (Intel), Andi Shyti, Palmer Dabbelt, Arnd Bergmann,
	Andrzej Hajda
  Cc: linux-trace-kernel, mhiramat, mattwu, wuqiang.matt

arch_cmpxchg[64]_local() are not defined for openrisc. So implement
them with generci_cmpxchg[64]_local, advised by Masami Hiramatsu.

Closes: https://lore.kernel.org/linux-trace-kernel/169824660459.24340.14614817132696360531.stgit@devnote2
Closes: https://lore.kernel.org/oe-kbuild-all/202310241310.Ir5uukOG-lkp@intel.com

Signed-off-by: wuqiang.matt <wuqiang.matt@bytedance.com>
---
 arch/openrisc/include/asm/cmpxchg.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/openrisc/include/asm/cmpxchg.h b/arch/openrisc/include/asm/cmpxchg.h
index 8ee151c072e4..7d0555257389 100644
--- a/arch/openrisc/include/asm/cmpxchg.h
+++ b/arch/openrisc/include/asm/cmpxchg.h
@@ -168,4 +168,18 @@ __arch_xchg(volatile void *ptr, unsigned long with, int size)
 						 sizeof(*(ptr)));	\
 	})
 
+/*
+ * always make arch_cmpxchg[64]_local available. __generic_cmpxchg[64]_local
+ * are atomic with respect to current cpu.
+ */
+#include <asm-generic/cmpxchg-local.h>
+
+#define arch_cmpxchg_local(ptr, o, n) ({				\
+	(__typeof__(*ptr))__generic_cmpxchg_local((ptr),		\
+						(unsigned long)(o),	\
+						(unsigned long)(n),	\
+						sizeof(*(ptr)));	\
+})
+#define arch_cmpxchg64_local(ptr, o, n) __generic_cmpxchg64_local((ptr), (o), (n))
+
 #endif /* __ASM_OPENRISC_CMPXCHG_H */
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-11-02 10:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-26  7:39 [PATCH 3/3] locking/atomic: openrisc: use generic_cmpxchg[64]_local for arch_cmpxchg[64]_local wuqiang.matt
2023-10-26  8:46 ` Arnd Bergmann
2023-10-26 11:05   ` wuqiang.matt
2023-10-28 12:49     ` Masami Hiramatsu
2023-10-28 16:40       ` wuqiang.matt
2023-10-29  3:26         ` Masami Hiramatsu
2023-10-30  2:22           ` Vineet Gupta
2023-10-30  3:41             ` wuqiang.matt
2023-11-02  4:53               ` Vineet Gupta
2023-11-02  9:30                 ` wuqiang.matt
2023-11-02 10:05                   ` wuqiang.matt

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).