]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing
authorPaul E. McKenney <paulmck@kernel.org>
Fri, 10 Jan 2025 19:26:23 +0000 (11:26 -0800)
committerBoqun Feng <boqun.feng@gmail.com>
Wed, 5 Feb 2025 15:14:40 +0000 (07:14 -0800)
The srcu_read_lock_nmisafe() and srcu_read_unlock_nmisafe() functions
map to __srcu_read_lock() and __srcu_read_unlock() on systems like x86
that have NMI-safe this_cpu_inc() operations.  This makes the underlying
__srcu_read_lock_nmisafe() and __srcu_read_unlock_nmisafe() functions
difficult to test on (for example) x86 systems, allowing bugs to creep in.

This commit therefore creates a FORCE_NEED_SRCU_NMI_SAFE Kconfig that
forces those underlying functions to be used even on systems where they
are not needed, thus providing better testing coverage.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
kernel/rcu/Kconfig

index b9b6bc55185dba365236b4f01d8aaa3596f70ecd..c8e540af3a3531cf01093a5fbcb9c5643875a55f 100644 (file)
@@ -65,6 +65,17 @@ config TREE_SRCU
        help
          This option selects the full-fledged version of SRCU.
 
+config FORCE_NEED_SRCU_NMI_SAFE
+       bool "Force selection of NEED_SRCU_NMI_SAFE"
+       depends on !TINY_SRCU
+       select NEED_SRCU_NMI_SAFE
+       default n
+       help
+         This option forces selection of the NEED_SRCU_NMI_SAFE
+         Kconfig option, allowing testing of srcu_read_lock_nmisafe()
+         and srcu_read_unlock_nmisafe() on architectures (like x86)
+         that select the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option.
+
 config NEED_SRCU_NMI_SAFE
        def_bool HAVE_NMI && !ARCH_HAS_NMI_SAFE_THIS_CPU_OPS && !TINY_SRCU