Re: [PATCH 26/28] hazptrtorture: Add torture_type=none clean skip for rcuscale coexistence

From: KunWu Chan

Date: Thu Nov 12 2026 - 10:42:12 EST


On Wed, Nov 11, 2026 at 5:31 AM Paul E. McKenney <paulmck@xxxxxxxxxx> wrote:
>
> On Thu, Nov 05, 2026 at 12:54:44AM +0800, Kunwu Chan wrote:
> > When both HAZPTR_TORTURE_TEST and RCU_SCALE_TEST are built into
> > the same kernel, hazptrtorture calls torture_init_begin() first
> > and rcuscale fails with -EBUSY. torture_type=none makes
> > hazptrtorture return early without registering, allowing the
> > rcuscale hazptr scale type to run in the same boot.
> >
> > Signed-off-by: Kunwu Chan <kunwu.chan@xxxxxxxxx>
>

Thanks Paul for the detailed reply.

> You are only supposed to build one of them into the kernel at a time,
> so the intent of the torture_init_begin() failure paths is to enforce
> this rule. If you want to run both in the same kernel, the way to do
> that is to build both as kernel modules, then do modprobe and then rmmod
> of the first one, followed by modprobe and rmmod of the second one.
>
> So please help me out here. Why do we need to allow both rcuscale and
> hazptrtorture to be built into the same kernel?
>

You're right. I had incorrectly made rcuscale's hazptr scale ops
depend on CONFIG_HAZPTR_TORTURE_TEST.
That led me to enable both tests in the same kernel and add
torture_type=none to keep hazptrtorture from registering.

> If your desire is simply better handling of an error condition, an
> alternative is to force either a Kconfig or build failure when more than
> one of the modules invoking torture_init_begin() is built into the same
> kernel at the same time.
>

The hazptr core is available independently, so that dependency is
unnecessary. I'll remove the guard from patch 23, leave
HAZPTR_TORTURE_TEST disabled in the rcuscale configuration, and
drop the torture_type=none workaround.

Thanks,
Kunwu

> Thanx, Paul
>
> > ---
> > .../selftests/rcutorture/configs/rcuscale/HAZPTR | 13 +++++++++++++
> > .../rcutorture/configs/rcuscale/HAZPTR.boot | 1 +
> > 2 files changed, 14 insertions(+)
> > create mode 100644 tools/testing/selftests/rcutorture/configs/rcuscale/HAZPTR
> > create mode 100644 tools/testing/selftests/rcutorture/configs/rcuscale/HAZPTR.boot
> >
> > diff --git a/tools/testing/selftests/rcutorture/configs/rcuscale/HAZPTR b/tools/testing/selftests/rcutorture/configs/rcuscale/HAZPTR
> > new file mode 100644
> > index 000000000000..c5e9cf0184ae
> > --- /dev/null
> > +++ b/tools/testing/selftests/rcutorture/configs/rcuscale/HAZPTR
> > @@ -0,0 +1,13 @@
> > +CONFIG_SMP=y
> > +CONFIG_NR_CPUS=128
> > +CONFIG_PREEMPT=y
> > +CONFIG_HZ_PERIODIC=n
> > +CONFIG_NO_HZ_IDLE=y
> > +CONFIG_HOTPLUG_CPU=y
> > +CONFIG_DEBUG_KERNEL=y
> > +CONFIG_HAZPTR_TORTURE_TEST=y
> > +CONFIG_HAZPTR_DEBUG=y
> > +CONFIG_HAZPTR_STALL_DETECTOR=y
> > +CONFIG_HAZPTR_STALL_TIMEOUT=1000
> > +CONFIG_HAZPTR_DRAIN_ASSIST=y
> > +CONFIG_RCU_SCALE_TEST=y
> > diff --git a/tools/testing/selftests/rcutorture/configs/rcuscale/HAZPTR.boot b/tools/testing/selftests/rcutorture/configs/rcuscale/HAZPTR.boot
> > new file mode 100644
> > index 000000000000..e9cca4cf453b
> > --- /dev/null
> > +++ b/tools/testing/selftests/rcutorture/configs/rcuscale/HAZPTR.boot
> > @@ -0,0 +1 @@
> > +hazptrtorture.torture_type=none
> > --
> > 2.43.0
> >