]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rcutorture: Make srcu_lockdep.sh check kernel Kconfig
authorPaul E. McKenney <paulmck@kernel.org>
Wed, 22 Jan 2025 21:42:23 +0000 (13:42 -0800)
committerJoel Fernandes <joelagnelf@nvidia.com>
Tue, 8 Apr 2025 18:55:38 +0000 (14:55 -0400)
The srcu_lockdep.sh currently blindly trusts the rcutorture SRCU-P
scenario to build its kernel with lockdep enabled.  Of course, this
dependency might not be obvious to someone rebalancing SRCU scenarios.
This commit therefore adds code to srcu_lockdep.sh that verifies that
the .config file has lockdep enabled.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com>
tools/testing/selftests/rcutorture/bin/srcu_lockdep.sh

index 2db12c5cad9c6a54130221a4b3debebd0b7af4be..b94f6d3445c6c621c0d29bdd5add8237cc94a293 100755 (executable)
@@ -39,8 +39,9 @@ do
        shift
 done
 
-err=
 nerrs=0
+
+# Test lockdep's handling of deadlocks.
 for d in 0 1
 do
        for t in 0 1 2
@@ -52,6 +53,12 @@ do
                        tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration 5s --configs "SRCU-P" --kconfig "CONFIG_FORCE_NEED_SRCU_NMI_SAFE=y" --bootargs "rcutorture.test_srcu_lockdep=$val rcutorture.reader_flavor=0x2" --trust-make --datestamp "$ds/$val" > "$T/kvm.sh.out" 2>&1
                        ret=$?
                        mv "$T/kvm.sh.out" "$RCUTORTURE/res/$ds/$val"
+                       if ! grep -q '^CONFIG_PROVE_LOCKING=y' .config
+                       then
+                               echo "rcu_torture_init_srcu_lockdep:Error: CONFIG_PROVE_LOCKING disabled in rcutorture SRCU-P scenario"
+                               nerrs=$((nerrs+1))
+                               err=1
+                       fi
                        if test "$d" -ne 0 && test "$ret" -eq 0
                        then
                                err=1
@@ -71,6 +78,8 @@ do
                done
        done
 done
+
+# Set up exit code.
 if test "$nerrs" -ne 0
 then
        exit 1