Re: [PATCH 04/13] rcutorture: Add atomic-SRCU support to torture.sh

From: Paul E. McKenney

Date: Wed Sep 09 2026 - 18:43:10 EST


On Tue, Sep 08, 2026 at 04:34:41PM -0700, Paul E. McKenney wrote:
> On Mon, Sep 07, 2026 at 03:58:20PM +0800, Kunwu Chan wrote:
> > From: Kunwu Chan <kunwu.chan@xxxxxxxxx>
> >
> > Add the --do-atomic-srcu argument to torture.sh, which runs the
> > SRCU-N, SRCU-P, and SRCU-T scenarios, thus covering both Tree SRCU
> > (SRCU-N and SRCU-P) and Tiny SRCU (SRCU-T), with
> > rcutorture.reader_flavor=0x10 appended to the boot parameters so
> > that it takes precedence over each scenario's own reader-flavor
> > setting. This exercises srcu_read_lock_atomic(),
> > srcu_read_unlock_atomic(), and synchronize_srcu_atomic().
> >
> > As with other torture.sh tests, the --do-kcsan argument runs a
> > KCSAN+PROVE_LOCKING variant of this test.
> >
> > Signed-off-by: Kunwu Chan <kunwu.chan@xxxxxxxxx>
>
> Queued for testing and review, thank you!

I did take the liberty of changing "do_atomic_srcu=no" to
"do_atomic_srcu=yes" in order to increase test coverage.

Thanx, Paul

> > ---
> > .../selftests/rcutorture/bin/torture.sh | 24 +++++++++++++++++++
> > 1 file changed, 24 insertions(+)
> >
> > diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/testing/selftests/rcutorture/bin/torture.sh
> > index f0083891ee81..8885812d866a 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=no
> > 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"
> > --
> > 2.43.0
> >