summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-10-21 10:04:13 -1000
committerLinus Torvalds <torvalds@linux-foundation.org>2026-10-21 10:04:13 -1000
commita7f2bc878742be60e72616586ef2583a75ec810e (patch)
tree7158d52fa03bd7cd50ed1819a7bdd548075c1497 /tools
parent9ba46df344883ca8bade47c0ed7aebf80a1e07b9 (diff)
parentd9011419496a3dc6b455b5308846684c63c18de5 (diff)
Merge tag 'rcu.2026.10.12b' of git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux
Pull RCU updates from Paul McKenney: "Execution contexts and call_rcu() and call_srcu(): - Make call_rcu() and call_srcu invocable from NMI handlers and while holding scheduler locks (using irq-work handlers) - Add rcutorture and BPF tests calling these functions from these contexts - Disable rcutorture overload testing for RCU readers that are "fragile", that is, that do not either disable preemption or have some form of RCU priority boosting SRCU updates: - Add an atomic SRCU where readers run with preemption disabled and grace periods can be invoked from atomic contexts. David Woodhouse has a patch series exploiting this for GPC - Add torture and lockdep tests for atomic SRCU - Add numerous optimizations for atomic SRCU based on the fact that it does not have callbacks, for example, eliminating any transition to "big" srcu_struct structures even on systems that configure these to happen at initialization time Additional torture-test updates: - Fix a divide-by-zero bug in forward-progress testing - Synchronously wait for all IRQ-queued callbacks to complete - Allow alternative "ssh" commands to be specified for use by kvm-remote.sh - Fix kvm-again.sh re-run failure on PowerPC - Add additional lockdep testing for atomic SRCU - Fix error double-counting in srcu_lockdep.sh - Add atomic SRCU cross-CPU IRQ context mismatch testing, with the - trick being that the atomic SRCU readers context must be at least as strict as that of the atomic SRCU grace-period wait. So for example, if the readers have IRQs disabled, so must the grace-period wait Miscellaneous updates: - Update stallwarn.rst documentation for the re-implementation of RCU Tasks Trace in terms of SRCU - Fix the lazy-callback shrink scanner budget computation so that it honors the reclaim budget - Avoid panicking on RCU CPU stalls that end before the warning can be printed - Add "running" and "boosted" indications to the RCU task stall warning output - People have been (incorrectly) relying on rcu_barrier() to wait for kfree_rcu() callbacks and processing. But it turns out to be easier to fix rcu_barrier() to meet their expectations than to fix their code to live within the earlier rcu_barrier() specification. So rcu_barrier() now waits on kfree_rcu() callbacks and processing - Disable RCU Tasks console output that track when this RCU flavor switches between per-CPU and global callback queuing. New use cases appeared that generated enough console traffic to cause trouble, and no one seemed to care about these messages. For those needing those messages, there is a new rcupdate.rcu_task_collapse_debug kernel boot parameter - Fix __rcu pointer attribute handling to eliminate false positives - Fix typos and drop redundant #include directives" * tag 'rcu.2026.10.12b' of git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux: (46 commits) rcutorture: Add atomic SRCU cross-CPU IRQ context mismatch test selftests/rcutorture: Fix double nerrs count in srcu_lockdep.sh selftests/rcutorture: Wire atomic SRCU into srcu_lockdep.sh rcutorture: Add atomic SRCU lockdep support rcutorture: Fix kvm-again.sh re-run failure on ppc64 torture: Allow specifying alternative ssh command to kvm-remote.sh rcutorture: Synchronously wait for all rcu_torture_irq() callbacks to complete rcutorture: Fix divide-by-zero with fwd_progress_div=1 srcutree: Preserve IRQ state in synchronize_srcu_atomic() callchain srcutiny: Add lockdep and early-boot checks to synchronize_srcu_atomic() srcutree: Add lockdep and early-boot checks to synchronize_srcu_atomic() srcutree: Skip torture to-big transition for atomic SRCU srcutree: Don't transition atomic SRCU to big in srcu_gp_end() srcutree: Make init_srcu_struct_atomic() prevent transition to big srcu: Restrict atomic-SRCU non_block annotation to task context srcutree: Remove srcu_barrier() sleep for atomic SRCU srcutree: Skip callback scheduling for atomic SRCU grace periods srcutree: Add reader-free fastpath to synchronize_srcu_atomic() rcutorture: Add atomic-SRCU support to torture.sh srcutree: Explicitly note DEFINE_SRCU() needs for srcu_barrier() ...
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/bpf/prog_tests/rcu_reentry.c93
-rw-r--r--tools/testing/selftests/bpf/progs/rcu_reentry.c51
-rwxr-xr-xtools/testing/selftests/rcutorture/bin/kvm-again.sh11
-rwxr-xr-xtools/testing/selftests/rcutorture/bin/kvm-remote.sh22
-rwxr-xr-xtools/testing/selftests/rcutorture/bin/srcu_lockdep.sh77
-rwxr-xr-xtools/testing/selftests/rcutorture/bin/torture.sh24
6 files changed, 267 insertions, 11 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/rcu_reentry.c b/tools/testing/selftests/bpf/prog_tests/rcu_reentry.c
new file mode 100644
index 000000000000..de23a14b3d40
--- /dev/null
+++ b/tools/testing/selftests/bpf/prog_tests/rcu_reentry.c
@@ -0,0 +1,93 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Exercise re-entry into call_srcu() from BPF; see progs/rcu_reentry.c. */
+#define _GNU_SOURCE
+#include <sched.h>
+#include <test_progs.h>
+#include "task_local_storage_helpers.h"
+#include "trace_helpers.h"
+#include "rcu_reentry.skel.h"
+
+/* Tiny RCU has no rcu_segcblist_enqueue() to attach to. */
+static bool have_attach_target(void)
+{
+ unsigned long long addr;
+
+ return kallsyms_find("rcu_segcblist_enqueue", &addr) == 0;
+}
+
+/* Tiny SRCU stubs out srcu_expedite_current(); Tree SRCU exports it. */
+static bool have_tree_srcu(void)
+{
+ unsigned long long addr;
+
+ return kallsyms_find("srcu_expedite_current", &addr) == 0;
+}
+
+void test_rcu_reentry(void)
+{
+ struct rcu_reentry *skel;
+ int err, pidfd = -1, map_fd;
+ cpu_set_t set, old_set;
+ bool affinity_saved;
+ __u64 val = 1;
+ int cpu;
+
+ if (!have_attach_target()) {
+ test__skip();
+ return;
+ }
+
+ skel = rcu_reentry__open_and_load();
+ if (!ASSERT_OK_PTR(skel, "skel_open_and_load"))
+ return;
+
+ err = rcu_reentry__attach(skel);
+ if (!ASSERT_OK(err, "skel_attach"))
+ goto out;
+
+ /* Keep the re-entry on a single CPU; a cpuset may exclude CPU 0. */
+ affinity_saved = !sched_getaffinity(0, sizeof(old_set), &old_set);
+ cpu = sched_getcpu();
+ if (!ASSERT_GE(cpu, 0, "getcpu"))
+ goto out;
+ CPU_ZERO(&set);
+ CPU_SET(cpu, &set);
+ if (!ASSERT_OK(sched_setaffinity(0, sizeof(set), &set), "setaffinity"))
+ goto out;
+
+ pidfd = sys_pidfd_open(getpid(), 0);
+ if (!ASSERT_GE(pidfd, 0, "pidfd_open"))
+ goto restore;
+ map_fd = bpf_map__fd(skel->maps.task_stg);
+ err = bpf_map_update_elem(map_fd, &pidfd, &val, BPF_NOEXIST);
+ if (!ASSERT_OK(err, "boot_create"))
+ goto restore;
+
+ /* Arm the handler for this thread, then trigger call_rcu_tasks_trace(). */
+ skel->bss->target_pid = syscall(__NR_gettid);
+ err = bpf_map_delete_elem(map_fd, &pidfd);
+ if (!ASSERT_OK(err, "boot_delete"))
+ goto restore;
+
+ /*
+ * Only Tree SRCU reaches rcu_segcblist_enqueue() from call_srcu(); a
+ * UP+PREEMPT kernel pairs Tree RCU with Tiny SRCU, so the attach
+ * succeeds but nothing fires. On Tree SRCU it must fire.
+ */
+ if (!skel->bss->hits) {
+ if (have_tree_srcu())
+ ASSERT_GT(skel->bss->hits, 0, "prog_fired");
+ else
+ test__skip();
+ goto restore;
+ }
+ ASSERT_EQ(skel->bss->get_errs, 0, "nested_storage_get");
+ ASSERT_EQ(skel->bss->del_errs, 0, "nested_storage_delete");
+restore:
+ if (affinity_saved)
+ sched_setaffinity(0, sizeof(old_set), &old_set);
+out:
+ if (pidfd >= 0)
+ close(pidfd);
+ rcu_reentry__destroy(skel);
+}
diff --git a/tools/testing/selftests/bpf/progs/rcu_reentry.c b/tools/testing/selftests/bpf/progs/rcu_reentry.c
new file mode 100644
index 000000000000..47a36f704cf3
--- /dev/null
+++ b/tools/testing/selftests/bpf/progs/rcu_reentry.c
@@ -0,0 +1,51 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Re-enter call_srcu() from a BPF program. fentry on rcu_segcblist_enqueue()
+ * fires inside call_srcu()'s enqueue (reached from srcu_gp_start_if_needed()
+ * with the srcu_data ->lock held); the handler then calls call_rcu_tasks_trace()
+ * -- itself call_srcu() on rcu_tasks_trace_srcu_struct -- re-entering the same
+ * srcu_data on the same CPU.
+ */
+#include "vmlinux.h"
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_tracing.h>
+
+char _license[] SEC("license") = "GPL";
+
+struct {
+ __uint(type, BPF_MAP_TYPE_TASK_STORAGE);
+ __uint(map_flags, BPF_F_NO_PREALLOC);
+ __type(key, int);
+ __type(value, __u64);
+} task_stg SEC(".maps");
+
+int target_pid;
+int hits;
+int get_errs;
+int del_errs;
+int done;
+
+SEC("fentry/rcu_segcblist_enqueue")
+int BPF_PROG(reenter)
+{
+ struct task_struct *cur;
+
+ if (done || !target_pid)
+ return 0;
+
+ cur = bpf_get_current_task_btf();
+ if (cur->pid != target_pid)
+ return 0;
+
+ /* Issue the nested call exactly once, so the test is deterministic. */
+ done = 1;
+ __sync_fetch_and_add(&hits, 1);
+
+ /* Re-enter via a task-storage delete, which calls call_rcu_tasks_trace(). */
+ if (!bpf_task_storage_get(&task_stg, cur, 0, BPF_LOCAL_STORAGE_GET_F_CREATE))
+ __sync_fetch_and_add(&get_errs, 1);
+ else if (bpf_task_storage_delete(&task_stg, cur))
+ __sync_fetch_and_add(&del_errs, 1);
+
+ return 0;
+}
diff --git a/tools/testing/selftests/rcutorture/bin/kvm-again.sh b/tools/testing/selftests/rcutorture/bin/kvm-again.sh
index b5239b52cb5d..9060b3dc8926 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm-again.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm-again.sh
@@ -180,6 +180,9 @@ fi
echo ---- Re-run results directory: $rundir
+qemu_binary="$(find "$oldrun" -maxdepth 2 -name 'qemu-cmd' -type f 2>/dev/null | head -1 | xargs -r grep -v '^#' 2>/dev/null | awk 'NF { print $1; exit }')"
+boot_image="`identify_boot_image "$qemu_binary"`"
+
if test "$oldrun" != "$rundir"
then
# Copy old run directory tree over and adjust.
@@ -189,7 +192,7 @@ then
echo "Cannot copy from $oldrun to $rundir."
usage
fi
- rm -f "$rundir"/*/{console.log,console.log.diags,qemu_pid,qemu-pid,qemu-retval,Warnings,kvm-test-1-run.sh.out,kvm-test-1-run-qemu.sh.out,vmlinux} "$rundir"/log
+ rm -f "$rundir"/*/{console.log,console.log.diags,qemu_pid,qemu-pid,qemu-retval,Warnings,kvm-test-1-run.sh.out,kvm-test-1-run-qemu.sh.out} "$rundir"/log
touch "$rundir/log"
echo $scriptname $args | tee -a "$rundir/log"
echo $oldrun > "$rundir/re-run"
@@ -197,6 +200,10 @@ then
then
$arg_link "$oldrun/../../bin" "$rundir/../.."
fi
+ if test "`basename "$boot_image"`" != vmlinux
+ then
+ rm -f "$rundir"/*/vmlinux
+ fi
else
# Check for a run having already happened.
find "$rundir" -name console.log -print > $T/oldrun-console.log
@@ -217,7 +224,7 @@ do
qemu_cmd_dir="`dirname "$i"`"
kernel_dir="`echo $qemu_cmd_dir | sed -e 's/\.[0-9]\+$//'`"
jitter_dir="`dirname "$kernel_dir"`"
- kvm-transform.sh "$kernel_dir/bzImage" "$qemu_cmd_dir/console.log" "$jitter_dir" "$dur" "$bootargs" < $T/qemu-cmd > $i
+ kvm-transform.sh "$kernel_dir/`basename $boot_image`" "$qemu_cmd_dir/console.log" "$jitter_dir" "$dur" "$bootargs" < $T/qemu-cmd > $i
if test -n "$arg_remote"
then
echo "# TORTURE_KCONFIG_GDB_ARG=''" >> $i
diff --git a/tools/testing/selftests/rcutorture/bin/kvm-remote.sh b/tools/testing/selftests/rcutorture/bin/kvm-remote.sh
index 48a8052d5dae..a8397f86e49d 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm-remote.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm-remote.sh
@@ -6,6 +6,11 @@
# Usage: kvm-remote.sh "systems" [ <kvm.sh args> ]
# kvm-remote.sh "systems" /path/to/old/run [ <kvm-again.sh args> ]
#
+# The caller may set the KVM_REMOTE_SSH environment in order to specify
+# an alternative ssh command, which is necessary in some environments
+# for authentication purposes. This alternative ssn command must support
+# ssh's usual arguments.
+#
# Copyright (C) 2021 Facebook, Inc.
#
# Authors: Paul E. McKenney <paulmck@kernel.org>
@@ -13,6 +18,11 @@
scriptname=$0
args="$*"
+if test -z "${KVM_REMOTE_SSH}"
+then
+ KVM_REMOTE_SSH=ssh; export KVM_REMOTE_SSH
+fi
+
if ! test -d tools/testing/selftests/rcutorture/bin
then
echo $scriptname must be run from top-level directory of kernel source tree.
@@ -137,7 +147,7 @@ chmod +x $T/bin/kvm-remote-*.sh
# Check first to avoid the need for cleanup for system-name typos
for i in $systems
do
- ssh -o BatchMode=yes $i getconf _NPROCESSORS_ONLN > $T/ssh.stdout 2> $T/ssh.stderr
+ ${KVM_REMOTE_SSH} -o BatchMode=yes $i getconf _NPROCESSORS_ONLN > $T/ssh.stdout 2> $T/ssh.stderr
ret=$?
if test "$ret" -ne 0
then
@@ -158,14 +168,14 @@ echo Build-products tarball: `du -h $T/binres.tgz` | tee -a "$oldrun/remote-log"
for i in $systems
do
echo Downloading tarball to $i `date` | tee -a "$oldrun/remote-log"
- cat $T/binres.tgz | ssh -o BatchMode=yes $i "cd /tmp; tar -xzf -"
+ cat $T/binres.tgz | ${KVM_REMOTE_SSH} -o BatchMode=yes $i "cd /tmp; tar -xzf -"
ret=$?
tries=0
while test "$ret" -ne 0
do
echo Unable to download $T/binres.tgz to system $i, waiting and then retrying. $tries prior retries. | tee -a "$oldrun/remote-log"
sleep 60
- cat $T/binres.tgz | ssh -o BatchMode=yes $i "cd /tmp; tar -xzf -"
+ cat $T/binres.tgz | ${KVM_REMOTE_SSH} -o BatchMode=yes $i "cd /tmp; tar -xzf -"
ret=$?
if test "$ret" -ne 0
then
@@ -191,7 +201,7 @@ checkremotefile () {
while :
do
- ssh -o BatchMode=yes $1 "test -f \"$2\""
+ ${KVM_REMOTE_SSH} -o BatchMode=yes $1 "test -f \"$2\""
ret=$?
if test "$ret" -eq 255
then
@@ -239,7 +249,7 @@ startbatches () {
then
continue # System still running last test, skip.
fi
- ssh -o BatchMode=yes "$i" "cd \"$resdir/$ds\"; touch remote.run; PATH=\"$T/bin:$PATH\" nohup kvm-remote-$curbatch.sh > kvm-remote-$curbatch.sh.out 2>&1 &" 1>&2
+ ${KVM_REMOTE_SSH} -o BatchMode=yes "$i" "cd \"$resdir/$ds\"; touch remote.run; PATH=\"$T/bin:$PATH\" nohup kvm-remote-$curbatch.sh > kvm-remote-$curbatch.sh.out 2>&1 &" 1>&2
ret=$?
if test "$ret" -ne 0
then
@@ -281,7 +291,7 @@ do
if test "$ret" -eq 1
then
echo " ---" Collecting results from $i `date` | tee -a "$oldrun/remote-log"
- ( cd "$oldrun"; ssh -o BatchMode=yes $i "cd $rundir; tar -czf - kvm-remote-*.sh.out */console.log */kvm-test-1-run*.sh.out */qemu[_-]pid */qemu-retval */qemu-affinity; rm -rf $T > /dev/null 2>&1" | tar -xzf - )
+ ( cd "$oldrun"; ${KVM_REMOTE_SSH} -o BatchMode=yes $i "cd $rundir; tar -czf - kvm-remote-*.sh.out */console.log */kvm-test-1-run*.sh.out */qemu[_-]pid */qemu-retval */qemu-affinity; rm -rf $T > /dev/null 2>&1" | tar -xzf - )
break;
fi
if test "$ret" -eq 255
diff --git a/tools/testing/selftests/rcutorture/bin/srcu_lockdep.sh b/tools/testing/selftests/rcutorture/bin/srcu_lockdep.sh
index 4e98c697def4..c29a39f7d891 100755
--- a/tools/testing/selftests/rcutorture/bin/srcu_lockdep.sh
+++ b/tools/testing/selftests/rcutorture/bin/srcu_lockdep.sh
@@ -44,7 +44,7 @@ nerrs=0
# Test lockdep's handling of deadlocks.
for d in 0 1
do
- for t in 0 1 2
+ for t in 0 1 2 4 5
do
for c in 1 2 3
do
@@ -56,7 +56,6 @@ do
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
@@ -79,6 +78,79 @@ do
done
done
+# Verify that synchronize_srcu_atomic() does not trigger lockdep
+# warnings when called inside rcu_read_lock().
+for c in 1 2 3
+do
+ err=
+ val=$((6*10+c))
+ 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" \
+ --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"
+ err=1
+ fi
+ if test "$ret" -ne 0
+ then
+ err=1
+ echo -n Unexpected failure for > "$RCUTORTURE/res/$ds/$val/kvm.sh.err"
+ elif grep -qE "WARNING: possible (recursive locking|circular locking dependency)" \
+ "$RCUTORTURE/res/$ds/$val/SRCU-P/console.log"
+ then
+ err=1
+ echo -n Unexpected lockdep warning for > "$RCUTORTURE/res/$ds/$val/kvm.sh.err"
+ fi
+ if test -n "$err"
+ then
+ 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"
+ cat "$RCUTORTURE/res/$ds/$val/kvm.sh.err"
+ nerrs=$((nerrs+1))
+ fi
+done
+
+# Verify that synchronize_srcu_atomic() detects IRQ context mismatch
+# when SRCU reader previously ran with IRQs enabled.
+for c in 1 2 3
+do
+ err=
+ val=$((1000+7*10+c))
+ 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" \
+ --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"
+ err=1
+ fi
+ if test "$ret" -eq 0
+ then
+ err=1
+ echo -n Missing lockdep warning for > "$RCUTORTURE/res/$ds/$val/kvm.sh.err"
+ elif ! grep -q "inconsistent {HARDIRQ-ON-R}" "$RCUTORTURE/res/$ds/$val/SRCU-P/console.log"
+ then
+ err=1
+ echo -n Missing lockdep warning for > "$RCUTORTURE/res/$ds/$val/kvm.sh.err"
+ fi
+ if test -n "$err"
+ then
+ 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"
+ cat "$RCUTORTURE/res/$ds/$val/kvm.sh.err"
+ nerrs=$((nerrs+1))
+ fi
+done
+
# Test lockdep-enabled testing of mixed SRCU readers.
for val in 0x1 0xf
do
@@ -89,7 +161,6 @@ do
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 "$val" = 0xf && test "$ret" -eq 0
diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/testing/selftests/rcutorture/bin/torture.sh
index f0083891ee81..e7b578ec152f 100755
--- a/tools/testing/selftests/rcutorture/bin/torture.sh
+++ b/tools/testing/selftests/rcutorture/bin/torture.sh
@@ -68,6 +68,7 @@ do_clocksourcewd="${ifnotaarch64}"
do_rt=yes
do_rcutasksflavors="${ifnotaarch64}" # FIXME: Back to "yes" when SMP=n auto-avoided
do_srcu_lockdep=yes
+do_atomic_srcu=yes
do_rcu_rust=no
# doyesno - Helper function for yes/no arguments
@@ -103,6 +104,7 @@ usage () {
echo " --do-rcu-rust / --do-no-rcu-rust / --no-rcu-rust"
echo " --do-scftorture / --do-no-scftorture / --no-scftorture"
echo " --do-srcu-lockdep / --do-no-srcu-lockdep / --no-srcu-lockdep"
+ echo " --do-atomic-srcu / --do-no-atomic-srcu / --no-atomic-srcu"
echo " --duration [ <minutes> | <hours>h | <days>d ]"
echo " --guest-cpu-limit N"
echo " --kcsan-kmake-arg kernel-make-arguments"
@@ -148,6 +150,7 @@ do
do_kcsan=yes
do_clocksourcewd="${ifnotaarch64}"
do_srcu_lockdep=yes
+ do_atomic_srcu=yes
;;
--do-allmodconfig|--do-no-allmodconfig|--no-allmodconfig)
do_allmodconfig=`doyesno "$1" --do-allmodconfig`
@@ -183,6 +186,7 @@ do
do_kcsan=no
do_clocksourcewd=no
do_srcu_lockdep=no
+ do_atomic_srcu=no
;;
--do-normal|--do-norm|--do-no-normal|--do-no-norm|--no-normal|--no-norm)
do_normal=`doyesno "$1" --do-normal`
@@ -212,6 +216,9 @@ do
--do-srcu-lockdep|--do-no-srcu-lockdep|--no-srcu-lockdep)
do_srcu_lockdep=`doyesno "$1" --do-srcu-lockdep`
;;
+ --do-atomic-srcu|--do-no-atomic-srcu|--no-atomic-srcu)
+ do_atomic_srcu=`doyesno "$1" --do-atomic-srcu`
+ ;;
--duration)
checkarg --duration "(minutes)" $# "$2" '^[0-9][0-9]*\(m\|h\|d\|\)$' '^error'
mult=1
@@ -497,6 +504,23 @@ then
torture_set "rcutorture" tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration "$duration_rcutorture" --configs "$configs_rcutorture" --trust-make
fi
+# Test atomic SRCU across Tree SRCU (SRCU-N and SRCU-P) and Tiny SRCU
+# (SRCU-T). The reader flavor selects srcu_read_lock_atomic() and
+# synchronize_srcu_atomic(). Tiny SRCU requires SMP=n, which aarch64
+# does not support.
+if test "$do_atomic_srcu" = "yes"
+then
+ torture_bootargs="rcutorture.reader_flavor=0x10"
+ configs_atomic_srcu="SRCU-N SRCU-P"
+ if test "$ifnotaarch64" = yes
+ then
+ configs_atomic_srcu="$configs_atomic_srcu SRCU-T"
+ fi
+ torture_set "atomic-srcu" tools/testing/selftests/rcutorture/bin/kvm.sh \
+ --allcpus --duration "$duration_rcutorture" \
+ --configs "$configs_atomic_srcu" --trust-make
+fi
+
if test "$do_locktorture" = "yes"
then
torture_bootargs="torture.disable_onoff_at_boot"