[SRU][Q][PATCH 1/2] riscv: Enable ARCH_HAVE_NMI_SAFE_CMPXCHG
Sarah Emery
sarah.emery at canonical.com
Wed Jan 14 13:19:16 UTC 2026
From: Pu Lehui <pulehui at huawei.com>
BugLink: https://bugs.launchpad.net/bugs/2124276
The implement of cmpxchg() in riscv is based on atomic primitives and
has NMI-safe features, so it can be used safely in the in_nmi context.
ftrace's ringbuffer relies on NMI-safe cmpxchg() in the NMI context.
Currently, in_nmi() is true when riscv kprobe is in trap-based mode, so
this config needs to be selected, otherwise kprobetrace will not be
available.
Signed-off-by: Pu Lehui <pulehui at huawei.com>
Reviewed-by: Alexandre Ghiti <alexghiti at rivosinc.com>
Tested-by: Alexandre Ghiti <alexghiti at rivosinc.com>
Link: https://lore.kernel.org/r/20250711090443.1688404-1-pulehui@huaweicloud.com
[pjw at kernel.org: moved to preserve alphabetical order]
Signed-off-by: Paul Walmsley <pjw at kernel.org>
(cherry picked from commit 205cbc714842478df4239b5be205b9b459fd9fbc)
Signed-off-by: Sarah Emery <sarah.emery at canonical.com>
---
arch/riscv/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 51dcd8eaa243..715e59f1e287 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -53,6 +53,7 @@ config RISCV
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
select ARCH_HAS_UBSAN
select ARCH_HAS_VDSO_ARCH_DATA if GENERIC_VDSO_DATA_STORE
+ select ARCH_HAVE_NMI_SAFE_CMPXCHG
select ARCH_KEEP_MEMBLOCK if ACPI
select ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE if 64BIT && MMU
select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
--
2.51.0
More information about the kernel-team
mailing list