Re: [PATCH v2 4/7] srcu: Add irqsave variants of the atomic SRCU readers

From: Paul E. McKenney

Date: Wed Nov 11 2026 - 21:16:44 EST


On Wed, Nov 11, 2026 at 08:32:48PM -0500, Mathieu Desnoyers wrote:
> On 2026-11-11 19:07, Paul E. McKenney wrote:
> [...]
> > Although that doesn't help on my laptop, it does work on my x86 test
> > system.
>
> Is the laptop a hybrid CPU, with P-cores and E-cores? KVM gives its
> guests no PMU on those. kvm_init_pmu_capability() in arch/x86/kvm/pmu.c
> clears enable_pmu under X86_FEATURE_HYBRID_CPU.
>
> > Perhaps something like the following would be helpful in keeping this
> > well-tested?
>
> Yes, that would help. Three comments on the patch:

Thank you for the review and comments!

> [...]
> > + qemu_args='--qemu-args "-cpu host,pmu=on"'
> [...]
> > + --configs "SRCU-P" ${qemu_args} --trust-make
>
> 1) The quotes inside the variable stay literal. The expansion is split
> on spaces, so kvm.sh gets three words:
>
> --qemu-args
> "-cpu
> host,pmu=on"
>
> A kvm.sh --dryrun with these arguments stops with:
>
> --qemu-args (qemu arguments) ""-cpu" must match "^-"
>
> Keeping only the value in the variable works:
>
> qemu_arg="-cpu host,pmu=on"
> [...]
> --configs "SRCU-P" ${qemu_arg:+--qemu-args "$qemu_arg"} --trust-make
>
> It expands to two words when set, and to nothing when empty. I
> checked it with kvm.sh --dryrun only.

I used the same trick that I have used elsewhere, keeping a separate
variable for the tag ("--qemu-args") and the argument itself, as shown
in the diff below on top of my earlier patch.

Maybe I should use your more impressive display of bash substitution. ;-)

> 2) nmi_readers and nmi_calls both default to true. So the two boot
> arguments change nothing. They are fine if you want them explicit.

I should probably drop them? I will figure it out.

> 3) The "atomic-srcu" run just above also runs readers in NMI, by
> default. It still starts without a PMU, so it keeps printing the
> "went untested" lines. It could take the same qemu argument.

I will add it there, also.

And to the --do-rcutorture stuff as well.

Thanx, Paul

------------------------------------------------------------------------

diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/testing/selftests/rcutorture/bin/torture.sh
index b411a7b33abee..26901c376d3e5 100755
--- a/tools/testing/selftests/rcutorture/bin/torture.sh
+++ b/tools/testing/selftests/rcutorture/bin/torture.sh
@@ -528,8 +528,10 @@ then
if test "$ifnotaarch64" = yes
then
configs_atomic_srcu="$configs_atomic_srcu SRCU-T"
- qemu_args='--qemu-args "-cpu host,pmu=on"'
+ qemu_tag='--qemu-args'
+ qemu_args="-cpu host,pmu=on"
else
+ qemu_tag=
qemu_args=
fi
torture_set "atomic-srcu" tools/testing/selftests/rcutorture/bin/kvm.sh \
@@ -537,10 +539,10 @@ then
--configs "$configs_atomic_srcu" --trust-make

# Half the readers then use srcu_read_lock_atomic_irqsave().
- torture_bootargs="rcutorture.reader_flavor=0x10 rcutorture.atomic_irqsave=1 rcutorture.nmi_readers=1 rcutorture.nmi_calls=1"
+ torture_bootargs="rcutorture.reader_flavor=0x10 rcutorture.atomic_irqsave=1 rcutorture.nmi_readers=1"
torture_set "atomic-srcu-irqsave" tools/testing/selftests/rcutorture/bin/kvm.sh \
--allcpus --duration "$duration_rcutorture" \
- --configs "SRCU-P" ${qemu_args} --trust-make
+ --configs "SRCU-P" "${qemu_tag}" "${qemu_args}" --trust-make
fi

if test "$do_locktorture" = "yes"