Skip to content

Commit 75d8bf4

Browse files
paulmckrcuJoel Fernandes
authored andcommitted
rcutorture: Make srcu_lockdep.sh check reader-conflict handling
Mixing different flavors of RCU readers is forbidden, for example, you should not use srcu_read_lock() and srcu_read_lock_nmisafe() on the same srcu_struct structure. There are checks for this, but these checks are not tested on a regular basis. This commit therefore adds such tests to srcu_lockdep.sh. Signed-off-by: Paul E. McKenney <[email protected]> Signed-off-by: Joel Fernandes <[email protected]>
1 parent 31b7ce3 commit 75d8bf4

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tools/testing/selftests/rcutorture/bin/srcu_lockdep.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,37 @@ do
7979
done
8080
done
8181

82+
# Test lockdep-enabled testing of mixed SRCU readers.
83+
for val in 0x1 0xf
84+
do
85+
err=
86+
tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration 5s --configs "SRCU-P" --kconfig "CONFIG_FORCE_NEED_SRCU_NMI_SAFE=y" --bootargs "rcutorture.reader_flavor=$val" --trust-make --datestamp "$ds/$val" > "$T/kvm.sh.out" 2>&1
87+
ret=$?
88+
mv "$T/kvm.sh.out" "$RCUTORTURE/res/$ds/$val"
89+
if ! grep -q '^CONFIG_PROVE_LOCKING=y' .config
90+
then
91+
echo "rcu_torture_init_srcu_lockdep:Error: CONFIG_PROVE_LOCKING disabled in rcutorture SRCU-P scenario"
92+
nerrs=$((nerrs+1))
93+
err=1
94+
fi
95+
if test "$val" -eq 0xf && test "$ret" -eq 0
96+
then
97+
err=1
98+
echo -n Unexpected success for > "$RCUTORTURE/res/$ds/$val/kvm.sh.err"
99+
fi
100+
if test "$val" -eq 0x1 && test "$ret" -ne 0
101+
then
102+
err=1
103+
echo -n Unexpected failure for > "$RCUTORTURE/res/$ds/$val/kvm.sh.err"
104+
fi
105+
if test -n "$err"
106+
then
107+
grep "rcu_torture_init_srcu_lockdep: test_srcu_lockdep = " "$RCUTORTURE/res/$ds/$val/SRCU-P/console.log" | sed -e 's/^.*rcu_torture_init_srcu_lockdep://' >> "$RCUTORTURE/res/$ds/$val/kvm.sh.err"
108+
cat "$RCUTORTURE/res/$ds/$val/kvm.sh.err"
109+
nerrs=$((nerrs+1))
110+
fi
111+
done
112+
82113
# Set up exit code.
83114
if test "$nerrs" -ne 0
84115
then

0 commit comments

Comments
 (0)