All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: Kconfig: Select ARCH_HAVE_NMI_SAFE_CMPXCHG where possible
@ 2020-12-08 14:32 ` Daniel Thompson
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Thompson @ 2020-12-08 14:32 UTC (permalink / raw)
  To: Russell King; +Cc: Daniel Thompson, linux-arm-kernel, linux-kernel, patches

Currently ARCH_HAVE_NMI_SAFE_CMPXCHG is not set on Arm systems and this
makes it impossible to enable features such as ftrace histogram triggers
on Arm platforms.

Most Arm systems are NMI safe simply because there is no NMI but this isn't
universally true meaning we cannot set ARCH_HAVE_NMI_SAFE_CMPXCHG for all
Arm devices. However the load/store exclusive implementation of cmpxchg is
NMI-safe and this implementation is used ARMv6k and later. Let's select
ARCH_HAVE_NMI_SAFE_CMPXCHG for these systems.

Note that ARMv6 uses load/store exclusive for 32-bit cmpxchg but relies on
interrupt masking for 8- and 16-bit operations. This patch is conservative
and does not change behaviour for CPU_V6.

Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
---
 arch/arm/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 002e0cf025f59..fd434c5958b62 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -24,6 +24,7 @@ config ARM
 	select ARCH_HAS_TEARDOWN_DMA_OPS if MMU
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HAVE_CUSTOM_GPIO_H
+	select ARCH_HAVE_NMI_SAFE_CMPXCHG if CPU_V7 || CPU_V7M || CPU_V6K
 	select ARCH_HAS_GCOV_PROFILE_ALL
 	select ARCH_KEEP_MEMBLOCK if HAVE_ARCH_PFN_VALID || KEXEC
 	select ARCH_MIGHT_HAVE_PC_PARPORT

base-commit: 0477e92881850d44910a7e94fc2c46f96faa131f
--
2.28.0


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

* [PATCH] ARM: Kconfig: Select ARCH_HAVE_NMI_SAFE_CMPXCHG where possible
@ 2020-12-08 14:32 ` Daniel Thompson
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Thompson @ 2020-12-08 14:32 UTC (permalink / raw)
  To: Russell King; +Cc: Daniel Thompson, linux-kernel, linux-arm-kernel, patches

Currently ARCH_HAVE_NMI_SAFE_CMPXCHG is not set on Arm systems and this
makes it impossible to enable features such as ftrace histogram triggers
on Arm platforms.

Most Arm systems are NMI safe simply because there is no NMI but this isn't
universally true meaning we cannot set ARCH_HAVE_NMI_SAFE_CMPXCHG for all
Arm devices. However the load/store exclusive implementation of cmpxchg is
NMI-safe and this implementation is used ARMv6k and later. Let's select
ARCH_HAVE_NMI_SAFE_CMPXCHG for these systems.

Note that ARMv6 uses load/store exclusive for 32-bit cmpxchg but relies on
interrupt masking for 8- and 16-bit operations. This patch is conservative
and does not change behaviour for CPU_V6.

Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
---
 arch/arm/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 002e0cf025f59..fd434c5958b62 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -24,6 +24,7 @@ config ARM
 	select ARCH_HAS_TEARDOWN_DMA_OPS if MMU
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HAVE_CUSTOM_GPIO_H
+	select ARCH_HAVE_NMI_SAFE_CMPXCHG if CPU_V7 || CPU_V7M || CPU_V6K
 	select ARCH_HAS_GCOV_PROFILE_ALL
 	select ARCH_KEEP_MEMBLOCK if HAVE_ARCH_PFN_VALID || KEXEC
 	select ARCH_MIGHT_HAVE_PC_PARPORT

base-commit: 0477e92881850d44910a7e94fc2c46f96faa131f
--
2.28.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-12-08 14:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-08 14:32 [PATCH] ARM: Kconfig: Select ARCH_HAVE_NMI_SAFE_CMPXCHG where possible Daniel Thompson
2020-12-08 14:32 ` Daniel Thompson

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.