From nobody Wed Apr 15 16:26:06 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90032374E6A; Tue, 3 Mar 2026 23:50:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772581839; cv=none; b=TzY/12pSdPvuoc6oJaCluu8gRIaG4Io3aSiO9qEUEtBgUVgVsO0STHfDWgIAD4x1eQMFydxczq2DRMygbqJPWREXLPdQUPEwnhG4T7FjmHcQyvFKbCdNKEnj54rR9ZeCvJ/t/wHWpIkPXlRbmaICyJM3JCQIYSJ6oL3VL0MifEQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772581839; c=relaxed/simple; bh=6aDUX6LAwslTG36vDPsQwQC0nclinqh+8IovqdcwnQI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=iPo/ZxOLi06D91s5Qy859uEEwk5LC5dp3R3Ny9O5Cb8Tbh9KXTLR/tO4C5FjrkmU6NqU7kCf060KgzSqHhPpoPfz+qgcF764iEUdw2NTsXoL4Zen5LwE5ZogfQTP24yFUAJdEZVGPeHecBiXpLGQRqEXXi9qabJyDQciv+mTyvE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EHo3J1EA; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EHo3J1EA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B116C116C6; Tue, 3 Mar 2026 23:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772581839; bh=6aDUX6LAwslTG36vDPsQwQC0nclinqh+8IovqdcwnQI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EHo3J1EA4cRmCP681Jhz4q7tJ9D2I3FeVNGeUxIvDUIGT4iVsB5xq8I1hOBRiDXeT CMncRhVM8l72ag3xd485r+CRhyWiS6PfFLhdxwlD1ZPNWAeTsgd6EuLeJGOqPLCzoO B3dec7pN/jxQcolWQSeW95EGOPZVeRfwuUfMSVQhazffwp6/VVZJOXM3H8XP+Z0KSq 5SG2Spuj3ddzhDti2t/gnCzTVD21yS9WwgFEtBS2wifcirgFeG4hXSVtLYfJZDX4QS x2FIOkdSFoTdsIIlcBVRNrK1/g4RQfcZ4oqbmrVqsgMC07Cm/wh3kIFktNCKwFyq2R +Wwr8ifcLm2OA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id E0D16CE0D66; Tue, 3 Mar 2026 15:50:38 -0800 (PST) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH 01/11] rcutorture: Add a textbook-style trivial preemptible RCU Date: Tue, 3 Mar 2026 15:50:27 -0800 Message-Id: <20260303235037.1967017-1-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <50d2bb98-c912-4ba6-a723-4a4aed506fdf@paulmck-laptop> References: <50d2bb98-c912-4ba6-a723-4a4aed506fdf@paulmck-laptop> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This commit adds a trivial textbook implementation of preemptible RCU to rcutorture ("torture_type=3Dtrivial-preempt"), similar in spirit to the existing "torture_type=3Dtrivial" textbook implementation of non-preemptible RCU. Neither trivial RCU implementation has any value for production use, and are intended only to keep Paul honest in his introductory writings and presentations. [ paulmck: Apply kernel test robot feedback. ] --- include/linux/sched.h | 4 ++ kernel/rcu/Kconfig.debug | 11 ++++ kernel/rcu/rcu.h | 4 ++ kernel/rcu/rcutorture.c | 57 ++++++++++++++++++- kernel/rcu/update.c | 22 +++++++ .../rcutorture/configs/rcu/TRIVIAL-PREEMPT | 12 ++++ .../configs/rcu/TRIVIAL-PREEMPT.boot | 3 + 7 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TRIVIAL-= PREEMPT create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TRIVIAL-= PREEMPT.boot diff --git a/include/linux/sched.h b/include/linux/sched.h index 074ad4ef3d813..fc2cb6804eabe 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -948,6 +948,10 @@ struct task_struct { struct srcu_ctr __percpu *trc_reader_scp; #endif /* #ifdef CONFIG_TASKS_TRACE_RCU */ =20 +#ifdef CONFIG_TRIVIAL_PREEMPT_RCU + int rcu_trivial_preempt_nesting; +#endif /* #ifdef CONFIG_TRIVIAL_PREEMPT_RCU */ + struct sched_info sched_info; =20 struct list_head tasks; diff --git a/kernel/rcu/Kconfig.debug b/kernel/rcu/Kconfig.debug index 625d75392647b..e078e988773d6 100644 --- a/kernel/rcu/Kconfig.debug +++ b/kernel/rcu/Kconfig.debug @@ -228,4 +228,15 @@ config RCU_DYNTICKS_TORTURE =20 This has no value for production and is only for testing. =20 +config TRIVIAL_PREEMPT_RCU + bool "Textbook trivial preemptible RCU in rcutorture" + depends on RCU_EXPERT && RCU_TORTURE_TEST + default n + help + This option enables a textbook preemptible RCU that is + implemented in rcutorture. Its sole purpose is to validate + code used in books, papers, and presentations. + + This has no value for production and is only for testing. + endmenu # "RCU Debugging" diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h index dc5d614b372c1..37e7a8a9e375d 100644 --- a/kernel/rcu/rcu.h +++ b/kernel/rcu/rcu.h @@ -682,4 +682,8 @@ int rcu_stall_notifier_call_chain(unsigned long val, vo= id *v); static inline int rcu_stall_notifier_call_chain(unsigned long val, void *v= ) { return NOTIFY_DONE; } #endif // #else // #if defined(CONFIG_RCU_STALL_COMMON) && defined(CONFIG_= RCU_CPU_STALL_NOTIFIER) =20 +#ifdef CONFIG_TRIVIAL_PREEMPT_RCU +void synchronize_rcu_trivial_preempt(void); +#endif // #ifdef CONFIG_TRIVIAL_PREEMPT_RCU + #endif /* __LINUX_RCU_H */ diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 8a9282a0245cc..3c272413666b2 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -1061,6 +1061,61 @@ static struct rcu_torture_ops trivial_ops =3D { .name =3D "trivial" }; =20 +#ifdef CONFIG_TRIVIAL_PREEMPT_RCU + +/* + * Definitions for trivial CONFIG_PREEMPT=3Dy torture testing. This + * implementation does not work well with large numbers of tasks or with + * long-term preemption. Either or both get you RCU CPU stall warnings. + */ + +static void rcu_sync_torture_init_trivial_preempt(void) +{ + rcu_sync_torture_init(); + if (WARN_ONCE(onoff_interval || shuffle_interval, "%s: Non-zero onoff_int= erval (%d) or shuffle_interval (%d) breaks trivial RCU, resetting to zero",= __func__, onoff_interval, shuffle_interval)) { + onoff_interval =3D 0; + shuffle_interval =3D 0; + } +} + +static int rcu_torture_read_lock_trivial_preempt(void) +{ + struct task_struct *t =3D current; + + WRITE_ONCE(t->rcu_trivial_preempt_nesting, t->rcu_trivial_preempt_nesting= + 1); + smp_mb(); + return 0; +} + +static void rcu_torture_read_unlock_trivial_preempt(int idx) +{ + struct task_struct *t =3D current; + + smp_store_release(&t->rcu_trivial_preempt_nesting, t->rcu_trivial_preempt= _nesting - 1); +} + +static struct rcu_torture_ops trivial_preempt_ops =3D { + .ttype =3D RCU_TRIVIAL_FLAVOR, + .init =3D rcu_sync_torture_init_trivial_preempt, + .readlock =3D rcu_torture_read_lock_trivial_preempt, + .read_delay =3D rcu_read_delay, // just reuse rcu's version. + .readunlock =3D rcu_torture_read_unlock_trivial_preempt, + .readlock_held =3D torture_readlock_not_held, + .get_gp_seq =3D rcu_no_completed, + .sync =3D synchronize_rcu_trivial_preempt, + .exp_sync =3D synchronize_rcu_trivial_preempt, + .irq_capable =3D 0, // In theory it should be, but let's keep it trivial. + .name =3D "trivial-preempt" +}; + +#define TRIVIAL_PREEMPT_OPS &trivial_preempt_ops, + +#else // #ifdef CONFIG_TRIVIAL_PREEMPT_RCU + +#define TRIVIAL_PREEMPT_OPS + +#endif // #else // #ifdef CONFIG_TRIVIAL_PREEMPT_RCU + #ifdef CONFIG_TASKS_RCU =20 /* @@ -4449,7 +4504,7 @@ rcu_torture_init(void) static struct rcu_torture_ops *torture_ops[] =3D { &rcu_ops, &rcu_busted_ops, &srcu_ops, &srcud_ops, &busted_srcud_ops, TASKS_OPS TASKS_RUDE_OPS TASKS_TRACING_OPS - &trivial_ops, + &trivial_ops, TRIVIAL_PREEMPT_OPS }; =20 if (!torture_init_begin(torture_type, verbose)) diff --git a/kernel/rcu/update.c b/kernel/rcu/update.c index d98a5c38e19c5..b62735a678842 100644 --- a/kernel/rcu/update.c +++ b/kernel/rcu/update.c @@ -538,6 +538,28 @@ long torture_sched_setaffinity(pid_t pid, const struct= cpumask *in_mask, bool do EXPORT_SYMBOL_GPL(torture_sched_setaffinity); #endif =20 +#if IS_ENABLED(CONFIG_TRIVIAL_PREEMPT_RCU) +// Trivial and stupid grace-period wait. Defined here so that lockdep +// kernels can find tasklist_lock. +void synchronize_rcu_trivial_preempt(void) +{ + struct task_struct *g; + struct task_struct *t; + + smp_mb(); // Order prior accesses before grace-period start. + rcu_read_lock(); // Protect task list. + for_each_process_thread(g, t) { + if (t =3D=3D current) + continue; // Don't deadlock on ourselves! + // Order later rcu_read_lock() on other tasks after QS. + while (smp_load_acquire(&t->rcu_trivial_preempt_nesting)) + continue; + } + rcu_read_unlock(); +} +EXPORT_SYMBOL_GPL(synchronize_rcu_trivial_preempt); +#endif // #if IS_ENABLED(CONFIG_TRIVIAL_PREEMPT_RCU) + int rcu_cpu_stall_notifiers __read_mostly; // !0 =3D provide stall notifie= rs (rarely useful) EXPORT_SYMBOL_GPL(rcu_cpu_stall_notifiers); =20 diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TRIVIAL-PREEMPT= b/tools/testing/selftests/rcutorture/configs/rcu/TRIVIAL-PREEMPT new file mode 100644 index 0000000000000..8230b14bfe680 --- /dev/null +++ b/tools/testing/selftests/rcutorture/configs/rcu/TRIVIAL-PREEMPT @@ -0,0 +1,12 @@ +CONFIG_SMP=3Dy +CONFIG_NR_CPUS=3D8 +CONFIG_PREEMPT_NONE=3Dn +CONFIG_PREEMPT_VOLUNTARY=3Dn +CONFIG_PREEMPT=3Dy +CONFIG_HZ_PERIODIC=3Dn +CONFIG_NO_HZ_IDLE=3Dy +CONFIG_NO_HZ_FULL=3Dn +CONFIG_DEBUG_LOCK_ALLOC=3Dn +CONFIG_DEBUG_OBJECTS_RCU_HEAD=3Dn +CONFIG_RCU_EXPERT=3Dy +CONFIG_TRIVIAL_PREEMPT_RCU=3Dy diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TRIVIAL-PREEMPT= .boot b/tools/testing/selftests/rcutorture/configs/rcu/TRIVIAL-PREEMPT.boot new file mode 100644 index 0000000000000..299cd3a12df6c --- /dev/null +++ b/tools/testing/selftests/rcutorture/configs/rcu/TRIVIAL-PREEMPT.boot @@ -0,0 +1,3 @@ +rcutorture.torture_type=3Dtrivial-preempt +rcutorture.onoff_interval=3D0 +rcutorture.shuffle_interval=3D0 --=20 2.40.1 From nobody Wed Apr 15 16:26:06 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8FEAF372EEF; Tue, 3 Mar 2026 23:50:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772581839; cv=none; b=qcGikQV5zmNdkdTBR+qLUso3SXhF0ft0rc56+htQ1A6Vh7AcCl7KavNgY4e1Hf2MmCuroEavsYlIqen/SjgVWjTelnTf3EnBKC/zKDNyZCDunuOJrfXhQhiDNZbY2c6t2P5VtMzVOX9AK9xOKGYbsjVUQfvfs5ka9cZWlk2KeOM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772581839; c=relaxed/simple; bh=U5A5O6LHSQqP2dmty8DQIFoZzPOWU0iJi95jYP0ws+w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TnROF4T9NzAL6+juA5Ock+ZNKaFeSSM8DD062qgq7Vuree/MUN5vehjR4YgVgzTSTDJXP5nsB2/ndST/YarIvxi8dDdtZ4F1hnQcOnpSLelJNaKnAew3sF6DWAHkpQL+SHyQTe70e97qQXKc1ETHZ7yJcW9F/VNG4kfGsGNCrrw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UmT9z2EA; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UmT9z2EA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63CF6C2BC9E; Tue, 3 Mar 2026 23:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772581839; bh=U5A5O6LHSQqP2dmty8DQIFoZzPOWU0iJi95jYP0ws+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UmT9z2EAZ+/ViHwJW0GmrEG2y3C0Huhoxbw3kUMsP1JJLEu8t2naY8txPhjt0U/9H uvLs7aKDuEkG2AgWqZzTS1d3Ynq7zQG1gghagEhguHaM7/5BKU5tYWFz4iv6Qp6bc1 3DTIt0jMkZ/qN69LdF832cu9PVULZuRJ7BaGTJbs3vXbR/xQ79kR+KG4kGGdXdYzGP kHFnWiDs7zSUpeahzKzhtyME5j6mJAh9JA794IqHOVF1sjlUpFcLvvmShrYERxvNPK aZHaGyiCkCJgejGFnICc2rNhWm2BWqYiyIeHD7c7c2U+l5FdRBYw0txyW011XLwvBu QejPLhItjmYLw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id E44BACE0DFD; Tue, 3 Mar 2026 15:50:38 -0800 (PST) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH 02/11] kvm-check-branches.sh: Remove in favor of kvm-series.sh Date: Tue, 3 Mar 2026 15:50:28 -0800 Message-Id: <20260303235037.1967017-2-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <50d2bb98-c912-4ba6-a723-4a4aed506fdf@paulmck-laptop> References: <50d2bb98-c912-4ba6-a723-4a4aed506fdf@paulmck-laptop> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The kvm-series.sh script is an order-of-magnitude optimization of kvm-check-branches.sh, so remove the old script. Signed-off-by: Paul E. McKenney --- .../rcutorture/bin/kvm-check-branches.sh | 102 ------------------ 1 file changed, 102 deletions(-) delete mode 100755 tools/testing/selftests/rcutorture/bin/kvm-check-branch= es.sh diff --git a/tools/testing/selftests/rcutorture/bin/kvm-check-branches.sh b= /tools/testing/selftests/rcutorture/bin/kvm-check-branches.sh deleted file mode 100755 index ed0ec7f0927e7..0000000000000 --- a/tools/testing/selftests/rcutorture/bin/kvm-check-branches.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0+ -# -# Run a group of kvm.sh tests on the specified commits. This currently -# unconditionally does three-minute runs on each scenario in CFLIST, -# taking advantage of all available CPUs and trusting the "make" utility. -# In the short term, adjustments can be made by editing this script and -# CFLIST. If some adjustments appear to have ongoing value, this script -# might grow some command-line arguments. -# -# Usage: kvm-check-branches.sh commit1 commit2..commit3 commit4 ... -# -# This script considers its arguments one at a time. If more elaborate -# specification of commits is needed, please use "git rev-list" to -# produce something that this simple script can understand. The reason -# for retaining the simplicity is that it allows the user to more easily -# see which commit came from which branch. -# -# This script creates a yyyy.mm.dd-hh.mm.ss-group entry in the "res" -# directory. The calls to kvm.sh create the usual entries, but this script -# moves them under the yyyy.mm.dd-hh.mm.ss-group entry, each in its own -# directory numbered in run order, that is, "0001", "0002", and so on. -# For successful runs, the large build artifacts are removed. Doing this -# reduces the disk space required by about two orders of magnitude for -# successful runs. -# -# Copyright (C) Facebook, 2020 -# -# Authors: Paul E. McKenney - -if ! git status > /dev/null 2>&1 -then - echo '!!!' This script needs to run in a git archive. 1>&2 - echo '!!!' Giving up. 1>&2 - exit 1 -fi - -# Remember where we started so that we can get back at the end. -curcommit=3D"`git status | head -1 | awk '{ print $NF }'`" - -nfail=3D0 -ntry=3D0 -resdir=3D"tools/testing/selftests/rcutorture/res" -ds=3D"`date +%Y.%m.%d-%H.%M.%S`-group" -if ! test -e $resdir -then - mkdir $resdir || : -fi -mkdir $resdir/$ds -echo Results directory: $resdir/$ds - -RCUTORTURE=3D"`pwd`/tools/testing/selftests/rcutorture"; export RCUTORTURE -PATH=3D${RCUTORTURE}/bin:$PATH; export PATH -. functions.sh -echo Using all `identify_qemu_vcpus` CPUs. - -# Each pass through this loop does one command-line argument. -for gitbr in $@ -do - echo ' --- git branch ' $gitbr - - # Each pass through this loop tests one commit. - for i in `git rev-list "$gitbr"` - do - ntry=3D`expr $ntry + 1` - idir=3D`awk -v ntry=3D"$ntry" 'END { printf "%04d", ntry; }' < /dev/null` - echo ' --- commit ' $i from branch $gitbr - date - mkdir $resdir/$ds/$idir - echo $gitbr > $resdir/$ds/$idir/gitbr - echo $i >> $resdir/$ds/$idir/gitbr - - # Test the specified commit. - git checkout $i > $resdir/$ds/$idir/git-checkout.out 2>&1 - echo git checkout return code: $? "(Commit $ntry: $i)" - kvm.sh --allcpus --duration 3 --trust-make --datestamp "$ds/$idir" > $re= sdir/$ds/$idir/kvm.sh.out 2>&1 - ret=3D$? - echo kvm.sh return code $ret for commit $i from branch $gitbr - echo Run results: $resdir/$ds/$idir - if test "$ret" -ne 0 - then - # Failure, so leave all evidence intact. - nfail=3D`expr $nfail + 1` - else - # Success, so remove large files to save about 1GB. - ( cd $resdir/$ds/$idir/$rrd; rm -f */vmlinux */bzImage */System.map */M= odule.symvers ) - fi - done -done -date - -# Go back to the original commit. -git checkout "$curcommit" - -if test $nfail -ne 0 -then - echo '!!! ' $nfail failures in $ntry 'runs!!!' - exit 1 -else - echo No failures in $ntry runs. - exit 0 -fi --=20 2.40.1 From nobody Wed Apr 15 16:26:06 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8FFB7373BF8; Tue, 3 Mar 2026 23:50:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772581839; cv=none; b=WNDX27GHNKjjNF5/Y52gj7RYDOd7o0ULbIHrzCXsh9VYDOGTR9XTagqfUMgtzeQKbBWapeh+47cxDhZLHXAGU+4nx/HGLxjj4gTXfrs93twriw5X5UPtTDSHU4z8esmlJP2x2p4ceG10RgmIKVk/g/RO59oF7+8kH1PVWeD9afQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772581839; c=relaxed/simple; bh=VoNcyuhOY3K/ZuzJbmeGoA1eSI0q+TFLh+FtBvEGrZ8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YOMl74fDAy6ZcX1OSGzZAJ/S17Bpj042ISbKsXdkIloYIgD27wG7fe9FFEo1Wtw/jN2MtFHPIZqdbaqsWEAzDOwnau9WPSnAzxtIT+Q9B3CTQ6MsY3TH9doo5zKzuncCRdupy9e8ysd/dU9G2Yj9kvRZdsv9rgn0TQxToqfvgsg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=M7/7Ir2n; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="M7/7Ir2n" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67232C2BCB0; Tue, 3 Mar 2026 23:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772581839; bh=VoNcyuhOY3K/ZuzJbmeGoA1eSI0q+TFLh+FtBvEGrZ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M7/7Ir2n8BBJTlz/IdiB+M1HspvCgdYeKBVg/Iw+s8oLku3V6J6HnJsH1Y8sDtvsN wubD+zAckGP0JzRKTUsbzBDBzOkKtsXaNidwINL8aiEKVIxp3yFTIvE373WtmiYIpi ref/fRnKbga9YPDhuFvaFtD/1/KhXAyIFtfpTUXnJKhmSVCAvLJXNbmPesnXkB1iTQ pYX754z4WN1P8bGD4ZXH5UDmxZVFSZentIFgGk4XphY2WNusVGSSEYcPrGUU+9uf3g QGEOEm/7JEjxxH+uY6BJocgoD3s/DEA3wp/Xnky7Aza5DehdRO8DGwSrWmtQO2suFV LOQjfGNXiE8zQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id E7119CE0ED1; Tue, 3 Mar 2026 15:50:38 -0800 (PST) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH 03/11] torture: Make hangs more visible in torture.sh output Date: Tue, 3 Mar 2026 15:50:29 -0800 Message-Id: <20260303235037.1967017-3-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <50d2bb98-c912-4ba6-a723-4a4aed506fdf@paulmck-laptop> References: <50d2bb98-c912-4ba6-a723-4a4aed506fdf@paulmck-laptop> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This commit labels "QEMU killed" lines so that they will be picked up by torture.sh processing. Signed-off-by: Paul E. McKenney --- tools/testing/selftests/rcutorture/bin/kvm-recheck.sh | 2 +- tools/testing/selftests/rcutorture/bin/parse-console.sh | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/testing/selftests/rcutorture/bin/kvm-recheck.sh b/tools/= testing/selftests/rcutorture/bin/kvm-recheck.sh index de65d77b47ff7..4791774b8485a 100755 --- a/tools/testing/selftests/rcutorture/bin/kvm-recheck.sh +++ b/tools/testing/selftests/rcutorture/bin/kvm-recheck.sh @@ -49,7 +49,7 @@ do then if test -f "$i/qemu-retval" && test "`cat $i/qemu-retval`" -eq 137 then - echo QEMU killed + echo "Summary: Potential hang (QEMU killed)" fi configcheck.sh $i/.config $i/ConfigFragment > $i/ConfigFragment.diags 2= >&1 if grep -q '^CONFIG_KCSAN=3Dy$' $i/ConfigFragment.input diff --git a/tools/testing/selftests/rcutorture/bin/parse-console.sh b/tool= s/testing/selftests/rcutorture/bin/parse-console.sh index 21e6ba3615f6a..be1e943ca4d51 100755 --- a/tools/testing/selftests/rcutorture/bin/parse-console.sh +++ b/tools/testing/selftests/rcutorture/bin/parse-console.sh @@ -113,7 +113,6 @@ then then print_warning $title `cat $T.seq` fi - exit 2 fi fi | tee -a $file.diags =20 --=20 2.40.1 From nobody Wed Apr 15 16:26:06 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8FE2326D4F9; Tue, 3 Mar 2026 23:50:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772581839; cv=none; b=VliRKynRQXdxNPrgG1SpbTEtfYB635C87OvIIYU6jkGenQjNUZ0+EOsrT5UWS85wmoz6aL86dvjTiPbBFNYPSmRUxxpULDRAEgnzyP6DjiMsxcJ0+Fg7bmZ0/zPbFtmco+EOkZFE8Dot4h8PSVPEzOEgMEC6gE5xKf1LIaXH9NQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772581839; c=relaxed/simple; bh=C2icL2fQQNUgO6Ny6Y6dB3rlOzYUyWDmQH4NRC/307k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mGkruS0/B9c1E9ER3soXgE5Wa5llEOd1xppTLOKY7ctFDijSbpObYvXqAzqpIpn3e9Kz5iNFBebZwrcbFtgvs1m1JHRIO9dYSFVWMlNkxB2kFtM5Sf71aZwm2/AiC8goVJFUqFlYLCcRhOPU/QE2niuyIKTmHlqndXo7NAaBY3I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NU870Jtd; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NU870Jtd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69139C2BCB1; Tue, 3 Mar 2026 23:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772581839; bh=C2icL2fQQNUgO6Ny6Y6dB3rlOzYUyWDmQH4NRC/307k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NU870JtdXj+AqLvUxd6CtsakRwz++l/mSaZqK8XiELp505nSyYcFSn2rtapjgP3A8 DTNweRS7Wxz1yN7gJgYyBQLDQvWHcokMpy+WKtLRDUEg056bbsSyJRyODnzG6d1KVq L2F1mFzFS0XMrbIQ20e7t1xPpnj13I3iOzCGqH+UBJdY/GykM1eeIdpyvjTH5z3+5r C9+3t33RLX2iFWrvRB/qEu1W6kVtBa11XuHMRFUFpeGlQE+I8bBFKAmVkDUUvF7QMW QyNcaiORMrx2rhhQLvDa+/PJ89Hi6g1hVWtV1hrO6zpzVFwL55lg17ff3hExaxpjQK 35rby2Okn43cA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id E99C7CE0EDC; Tue, 3 Mar 2026 15:50:38 -0800 (PST) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH 04/11] rcutorture: Adjust scenarios for default lazy preemption Date: Tue, 3 Mar 2026 15:50:30 -0800 Message-Id: <20260303235037.1967017-4-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <50d2bb98-c912-4ba6-a723-4a4aed506fdf@paulmck-laptop> References: <50d2bb98-c912-4ba6-a723-4a4aed506fdf@paulmck-laptop> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Currently, most of the rcutorture scenarios do not explicitly set the CONFIG_PREEMPT_LAZY Kconfig option one way or the other. This can result int "improperly set" diagnostics from kvm.sh, which indicate that the scenario in question isn't testing what it is supposed to test, which can result in missed bugs. This commit therefore explicitly sets CONFIG_PREEMPT_LAZY as needed. Signed-off-by: Paul E. McKenney --- tools/testing/selftests/rcutorture/configs/rcu/TINY01 | 1 + tools/testing/selftests/rcutorture/configs/rcu/TREE04 | 2 ++ tools/testing/selftests/rcutorture/configs/rcu/TREE05 | 1 + tools/testing/selftests/rcutorture/configs/rcu/TREE06 | 2 ++ tools/testing/selftests/rcutorture/configs/rcu/TREE10 | 1 + 5 files changed, 7 insertions(+) diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TINY01 b/tools/= testing/selftests/rcutorture/configs/rcu/TINY01 index 0953c52fcfd76..bd5ed7b0da5f0 100644 --- a/tools/testing/selftests/rcutorture/configs/rcu/TINY01 +++ b/tools/testing/selftests/rcutorture/configs/rcu/TINY01 @@ -3,6 +3,7 @@ CONFIG_PREEMPT_NONE=3Dy CONFIG_PREEMPT_VOLUNTARY=3Dn CONFIG_PREEMPT=3Dn CONFIG_PREEMPT_DYNAMIC=3Dn +CONFIG_PREEMPT_LAZY=3Dn #CHECK#CONFIG_TINY_RCU=3Dy CONFIG_HZ_PERIODIC=3Dn CONFIG_NO_HZ_IDLE=3Dy diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TREE04 b/tools/= testing/selftests/rcutorture/configs/rcu/TREE04 index 67caf4276bb01..f49fda1c88811 100644 --- a/tools/testing/selftests/rcutorture/configs/rcu/TREE04 +++ b/tools/testing/selftests/rcutorture/configs/rcu/TREE04 @@ -4,7 +4,9 @@ CONFIG_PREEMPT_NONE=3Dn CONFIG_PREEMPT_VOLUNTARY=3Dy CONFIG_PREEMPT=3Dn CONFIG_PREEMPT_DYNAMIC=3Dn +CONFIG_PREEMPT_LAZY=3Dn #CHECK#CONFIG_TREE_RCU=3Dy +#CHECK#CONFIG_PREEMPT_RCU=3Dn CONFIG_HZ_PERIODIC=3Dn CONFIG_NO_HZ_IDLE=3Dn CONFIG_NO_HZ_FULL=3Dy diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TREE05 b/tools/= testing/selftests/rcutorture/configs/rcu/TREE05 index 9f48c73709ec3..0513aa33c32c4 100644 --- a/tools/testing/selftests/rcutorture/configs/rcu/TREE05 +++ b/tools/testing/selftests/rcutorture/configs/rcu/TREE05 @@ -3,6 +3,7 @@ CONFIG_NR_CPUS=3D8 CONFIG_PREEMPT_NONE=3Dy CONFIG_PREEMPT_VOLUNTARY=3Dn CONFIG_PREEMPT=3Dn +CONFIG_PREEMPT_LAZY=3Dn #CHECK#CONFIG_TREE_RCU=3Dy CONFIG_HZ_PERIODIC=3Dn CONFIG_NO_HZ_IDLE=3Dy diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TREE06 b/tools/= testing/selftests/rcutorture/configs/rcu/TREE06 index db27651de04b8..bfd88c46dbd73 100644 --- a/tools/testing/selftests/rcutorture/configs/rcu/TREE06 +++ b/tools/testing/selftests/rcutorture/configs/rcu/TREE06 @@ -3,7 +3,9 @@ CONFIG_NR_CPUS=3D8 CONFIG_PREEMPT_NONE=3Dy CONFIG_PREEMPT_VOLUNTARY=3Dn CONFIG_PREEMPT=3Dn +CONFIG_PREEMPT_LAZY=3Dn #CHECK#CONFIG_TREE_RCU=3Dy +#CHECK#CONFIG_PREEMPT_RCU=3Dn CONFIG_HZ_PERIODIC=3Dn CONFIG_NO_HZ_IDLE=3Dy CONFIG_NO_HZ_FULL=3Dn diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TREE10 b/tools/= testing/selftests/rcutorture/configs/rcu/TREE10 index 420632b030dc4..b2ce37861e71a 100644 --- a/tools/testing/selftests/rcutorture/configs/rcu/TREE10 +++ b/tools/testing/selftests/rcutorture/configs/rcu/TREE10 @@ -6,6 +6,7 @@ CONFIG_PREEMPT_VOLUNTARY=3Dn CONFIG_PREEMPT=3Dn CONFIG_PREEMPT_DYNAMIC=3Dn #CHECK#CONFIG_TREE_RCU=3Dy +CONFIG_PREEMPT_RCU=3Dn CONFIG_HZ_PERIODIC=3Dn CONFIG_NO_HZ_IDLE=3Dy CONFIG_NO_HZ_FULL=3Dn --=20 2.40.1 From nobody Wed Apr 15 16:26:06 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9FCA6374E6B; Tue, 3 Mar 2026 23:50:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772581839; cv=none; b=Fdst+7TCylOXHISVTryWkt3A5hWfpzW0zy0aU6xLl1HG3huYaPMPSH52rqv1vr+gvNE9uTk5/mBjnFgxSj6z8gbS69svjoQ+cJc9DFzo9tUn6A8qLoLq2pZktTztVQCBk8WOgpSOBdSSHeCQA+F9yEb08pKQnshULrsesDMDQ3g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772581839; c=relaxed/simple; bh=N9cQxTNv/8Ij3OtaHR1FblDaP7r73JkKScSsGG04tCU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XSdOwJ6hh3b27j8E/yQNBpI0KpdMUdoK19eeyW7vNmfW9AT+6sGt4ceHN/tjVPDDdlWU50RGZuPhvwQQlYD/r+e+NrQpTxYEODgOLWl3Kx01SPQMR7jvd4Ndx6V61zlDEIouGX/vZtYryuvxL+WUSEekGUo0rEpSKDbs5XiY5S4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Zf0qSk13; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Zf0qSk13" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7ACB8C2BCAF; Tue, 3 Mar 2026 23:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772581839; bh=N9cQxTNv/8Ij3OtaHR1FblDaP7r73JkKScSsGG04tCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zf0qSk13Sozp7Trb0u0EbE35V1UWFqW/Tqxu9b4/kPsqqQIim7AGJz061j+DWPfFc 4yZ0G765hEG5kekOY5q00SqNMOv+QhgtV68fG3bS6anYsWFkUJBSkxDgq5AhbTHYR+ HHvXJBhdW0gkov8cPNFauXvOBx+XnKufC8JgphyifNZYk5XcSNcWYksGB++qjpZIbx zS24fFpvmlPc+aNTNR2SwR0rB1KUZIjrG0Qeg+5kWcBNbAIZ6xkFP6a5PPPbsxaTfX rqON1FJqbhCAyboP3qwjRPSf0phurX0WsOnId754ayZLdOyj4ZSnld412Zb5p4fM02 OYT5DL5ldF/gg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id EBF48CE0EE1; Tue, 3 Mar 2026 15:50:38 -0800 (PST) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH 05/11] torture: Print informative message for test without recheck file Date: Tue, 3 Mar 2026 15:50:31 -0800 Message-Id: <20260303235037.1967017-5-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <50d2bb98-c912-4ba6-a723-4a4aed506fdf@paulmck-laptop> References: <50d2bb98-c912-4ba6-a723-4a4aed506fdf@paulmck-laptop> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" If a type of torture test lacks a recheck file, a bash diagnostic is printed, which looks like a torture-test bug. This commit gets rid of this false positive by explicitly checking for the file, invoking it if it exists, otherwise printing an informative non-diagnostic message. Signed-off-by: Paul E. McKenney --- tools/testing/selftests/rcutorture/bin/kvm-recheck.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/rcutorture/bin/kvm-recheck.sh b/tools/= testing/selftests/rcutorture/bin/kvm-recheck.sh index 4791774b8485a..63bbbdd5f4ef3 100755 --- a/tools/testing/selftests/rcutorture/bin/kvm-recheck.sh +++ b/tools/testing/selftests/rcutorture/bin/kvm-recheck.sh @@ -39,7 +39,12 @@ do X*) ;; *) - kvm-recheck-${TORTURE_SUITE}.sh $i + if test -f tools/testing/selftests/rcutorture/bin/kvm-recheck-${TORTURE= _SUITE}.sh + then + kvm-recheck-${TORTURE_SUITE}.sh $i + else + echo No kvm-recheck-${TORTURE_SUITE}.sh, so no ${TORTURE_SUITE}-specif= ic analysis. + fi esac if test -f "$i/qemu-retval" && test "`cat $i/qemu-retval`" -ne 0 && test= "`cat $i/qemu-retval`" -ne 137 then --=20 2.40.1 From nobody Wed Apr 15 16:26:06 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B80A23750DD; Tue, 3 Mar 2026 23:50:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772581839; cv=none; b=X4KLf50bEyV0kZaXYRtNHsKgPSbTY0EcKP7jlbN55OfszGp/OGXYyrOVR4ExtiSxgSgNAqC7JIoxSybncIcOET7CJam7Xlzn1bByAzVksTta2QqgP5wLHEAdBQaHzKKqP5hPQxMwLOjVWIpATPTgZNowj3Sk3uT3BF1bOY0wxtY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772581839; c=relaxed/simple; bh=jE1bUAMMD8K+kde9GOcsEF0e368b5WdVOEyr+RwU+Qc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ARKz2NU59RXn3VgaoC5vIzV9xOUdwzA4M3ONoFWUbn1e0GHEtSoNnJncnzafC/ztnza5Qpstkt2382cvAlsfYWYkHmjAyNYLRcq64Bu1IZJLDbu+oBzYWD0Uu/n2zAHs6F7lVJfZ9gI29n6btx+m72Rmp/687VHo+a7KnVzz+Cg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MHrBF/HZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MHrBF/HZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99CE6C2BCB4; Tue, 3 Mar 2026 23:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772581839; bh=jE1bUAMMD8K+kde9GOcsEF0e368b5WdVOEyr+RwU+Qc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MHrBF/HZvwcwIIu7POime9yZpZfmCSV8JJEP14Uv2Wi3oIjy2yd+8eBredfsbgkHA /aHdvw4+uvtxNawsJ+lPl23jelIYoP9O+HI6HUVyWuPM0fpqHFAwliwT7E0lSTvOG0 pNvoyTRi93Y8z+S1Ccejbem4/juQ1ANH9YfCjIUvod1VDOC2J0UYxGwSjqEtDsjPH0 8dDTLC5sDCMyFdBEgrRNRvLV/625CG5WCBWSagh+nOEnXJbqFHWFsoiqdRT0Jif+ok buwEXPliopz8M6UycMB4+wQd9AHQYNirLqs67hOENGaE4l4qUFFZDzRBMGfjTHFlMY KIKSDruMKrukg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id EE4D4CE0EE2; Tue, 3 Mar 2026 15:50:38 -0800 (PST) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH 06/11] rcutorture: Fix numeric "test" comparison in srcu_lockdep.sh Date: Tue, 3 Mar 2026 15:50:32 -0800 Message-Id: <20260303235037.1967017-6-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <50d2bb98-c912-4ba6-a723-4a4aed506fdf@paulmck-laptop> References: <50d2bb98-c912-4ba6-a723-4a4aed506fdf@paulmck-laptop> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This commit switches from "-eq" to "=3D" to handle the non-numeric comparisons in srcu_lockdep.sh. While in the area, adjust SRCU flavor to improve coverage. Signed-off-by: Paul E. McKenney --- tools/testing/selftests/rcutorture/bin/srcu_lockdep.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/rcutorture/bin/srcu_lockdep.sh b/tools= /testing/selftests/rcutorture/bin/srcu_lockdep.sh index 208be7d09a612..4e98c697def48 100755 --- a/tools/testing/selftests/rcutorture/bin/srcu_lockdep.sh +++ b/tools/testing/selftests/rcutorture/bin/srcu_lockdep.sh @@ -50,7 +50,7 @@ do do err=3D val=3D$((d*1000+t*10+c)) - tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration 5s -= -configs "SRCU-P" --kconfig "CONFIG_FORCE_NEED_SRCU_NMI_SAFE=3Dy" --bootarg= s "rcutorture.test_srcu_lockdep=3D$val rcutorture.reader_flavor=3D0x2" --tr= ust-make --datestamp "$ds/$val" > "$T/kvm.sh.out" 2>&1 + tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration 5s -= -configs "SRCU-P" --kconfig "CONFIG_FORCE_NEED_SRCU_NMI_SAFE=3Dy" --bootarg= s "rcutorture.test_srcu_lockdep=3D$val rcutorture.reader_flavor=3D0x4" --tr= ust-make --datestamp "$ds/$val" > "$T/kvm.sh.out" 2>&1 ret=3D$? mv "$T/kvm.sh.out" "$RCUTORTURE/res/$ds/$val" if ! grep -q '^CONFIG_PROVE_LOCKING=3Dy' .config @@ -92,12 +92,12 @@ do nerrs=3D$((nerrs+1)) err=3D1 fi - if test "$val" -eq 0xf && test "$ret" -eq 0 + if test "$val" =3D 0xf && test "$ret" -eq 0 then err=3D1 echo -n Unexpected success for > "$RCUTORTURE/res/$ds/$val/kvm.sh.err" fi - if test "$val" -eq 0x1 && test "$ret" -ne 0 + if test "$val" =3D 0x1 && test "$ret" -ne 0 then err=3D1 echo -n Unexpected failure for > "$RCUTORTURE/res/$ds/$val/kvm.sh.err" --=20 2.40.1 From nobody Wed Apr 15 16:26:06 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1B7A375AD3; Tue, 3 Mar 2026 23:50:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772581839; cv=none; b=lIdLUKtigvBlQZGoRaugDWc2Vu18sSGVQAs92llJzoMjKsqFVFEh3i8+39/X/y3T78A7TmfpNWTbQknk463bkQ2q/y/xPaG0xT7XrA42hVbbcrdRVp8diurzhsQZ5ZnmjJJ9PsR12L2UIXKxWT9WfaXwEhx7BwOULjOSBylrH2s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772581839; c=relaxed/simple; bh=UolUOkfqiM0WjO3JAkjDbdkps04/fjY11ex6OnmY59o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=fritnCXEtKOiGKKMo7iGyZhoVRZ9D7WJd5DIjztVGXqHvGfrxxa8h8fdjfpGlD/F8F7gd4KLmBJzw0tt9XqMdYrgs0ypwZL4UM6Iduu4ogXFlPmkHCwmAYNyhPbHTP1qfMLAbrkRVl3YmfpIMRzawAFhh36L+/ZeQCJ1M+aKQwU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=g+Xq0Lmg; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="g+Xq0Lmg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0476C2BCB0; Tue, 3 Mar 2026 23:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772581839; bh=UolUOkfqiM0WjO3JAkjDbdkps04/fjY11ex6OnmY59o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g+Xq0LmgqodyBcvWXatMM0zB09VVF0KV1PwIQy7aMQA106lB2w1XKnV9CBc8nwSU2 rsM/iPgJd2wkY+hGaDadtmPmfncXRuIw7ulh3+FZEZnABNRtCF8Fg3nXDKhomThFlr 66v/aOttZRFF11zb1QS7x3KnSQxq6aYOCVh6jmIQb4fQ7ohiThalJLJxu7IOtcU2Lc 7PpNWVMzVTRfTUsRP8vjHp0/QLwDukpVY6snKhZXb6WKVFjZI7M5It0pGmlYYLYgR+ zXBW2SenOhMZAzllYQIX6nApNL02E7enHSiJDD+hwcianFtQAmICF4HGO0N2mNMcFe 77v/peM6NB32w== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id F16DDCE0F1B; Tue, 3 Mar 2026 15:50:38 -0800 (PST) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH 07/11] refscale: Ditch ref_scale_shutdown in favor of torture_shutdown_init() Date: Tue, 3 Mar 2026 15:50:33 -0800 Message-Id: <20260303235037.1967017-7-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <50d2bb98-c912-4ba6-a723-4a4aed506fdf@paulmck-laptop> References: <50d2bb98-c912-4ba6-a723-4a4aed506fdf@paulmck-laptop> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The torture_shutdown_init() function spawns a shutdown kthread in a manner very similar to that implemented by ref_scale_shutdown(). This commit therefore re-implements ref_scale_shutdown in terms of torture_shutdown_init(). The initial draft of this patch was generated by version 2.1.16 of the Claude AI/LLM, but trained and configured for use by my employer, and prompted to refer to Linux-kernel source code. This initial draft failed to provide a forward reference to ref_scale_cleanup(), passed zero to torture_shutdown_init() for an unwelcome insta-shutdown, and failed to pass the kvm.sh --duration argument in as a refscale module parameter. On the other hand, it did catch the need to NULL main_task on the post-test self-shutdown code path, which I might well have forgotten to do. This version of the patch fixes those problems, and in fact very little of the initial draft remains. Signed-off-by: Paul E. McKenney [outline more of development process] Signed-off-by: Paul E. McKenney --- kernel/rcu/refscale.c | 51 +++++-------------- .../configs/refscale/ver_functions.sh | 2 +- 2 files changed, 15 insertions(+), 38 deletions(-) diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c index c158b6a947cde..a2d9d75d88a10 100644 --- a/kernel/rcu/refscale.c +++ b/kernel/rcu/refscale.c @@ -92,15 +92,9 @@ torture_param(int, nreaders, -1, "Number of readers, -1 = for 75% of CPUs."); torture_param(int, nruns, 30, "Number of experiments to run."); // Reader delay in nanoseconds, 0 for no delay. torture_param(int, readdelay, 0, "Read-side delay in nanoseconds."); - -#ifdef MODULE -# define REFSCALE_SHUTDOWN 0 -#else -# define REFSCALE_SHUTDOWN 1 -#endif - -torture_param(bool, shutdown, REFSCALE_SHUTDOWN, - "Shutdown at end of scalability tests."); +// Maximum shutdown delay in seconds, or zero for no shutdown. +torture_param(int, shutdown_secs, !IS_MODULE(CONFIG_REPRO_TEST) * 300, + "Shutdown at end of scalability tests or at specified timeout (s)."= ); =20 struct reader_task { struct task_struct *task; @@ -109,12 +103,8 @@ struct reader_task { u64 last_duration_ns; }; =20 -static struct task_struct *shutdown_task; -static wait_queue_head_t shutdown_wq; - static struct task_struct *main_task; static wait_queue_head_t main_wq; -static int shutdown_start; =20 static struct reader_task *reader_tasks; =20 @@ -1357,6 +1347,8 @@ static u64 process_durations(int n) return sum; } =20 +static void ref_scale_cleanup(void); + // The main_func is the main orchestrator, it performs a bunch of // experiments. For every experiment, it orders all the readers // involved to start and waits for them to finish the experiment. It @@ -1443,9 +1435,10 @@ static int main_func(void *arg) =20 oom_exit: // This will shutdown everything including us. - if (shutdown) { - shutdown_start =3D 1; - wake_up(&shutdown_wq); + if (shutdown_secs) { + main_task =3D NULL; // Avoid self-kill deadlock. + ref_scale_cleanup(); + kernel_power_off(); } =20 // Wait for torture to stop us @@ -1463,8 +1456,8 @@ static void ref_scale_print_module_parms(const struct ref_scale_ops *cur_ops, const ch= ar *tag) { pr_alert("%s" SCALE_FLAG - "--- %s: verbose=3D%d verbose_batched=3D%d shutdown=3D%d holdoff=3D%d = lookup_instances=3D%ld loops=3D%d nreaders=3D%d nruns=3D%d readdelay=3D%d\n= ", scale_type, tag, - verbose, verbose_batched, shutdown, holdoff, lookup_instances, loops, n= readers, nruns, readdelay); + "--- %s: verbose=3D%d verbose_batched=3D%d shutdown_secs=3D%d holdoff= =3D%d lookup_instances=3D%ld loops=3D%d nreaders=3D%d nruns=3D%d readdelay= =3D%d\n", scale_type, tag, + verbose, verbose_batched, shutdown_secs, holdoff, lookup_instances, loo= ps, nreaders, nruns, readdelay); } =20 static void @@ -1497,19 +1490,6 @@ ref_scale_cleanup(void) torture_cleanup_end(); } =20 -// Shutdown kthread. Just waits to be awakened, then shuts down system. -static int -ref_scale_shutdown(void *arg) -{ - wait_event_idle(shutdown_wq, shutdown_start); - - smp_mb(); // Wake before output. - ref_scale_cleanup(); - kernel_power_off(); - - return -EINVAL; -} - static int __init ref_scale_init(void) { @@ -1553,13 +1533,10 @@ ref_scale_init(void) ref_scale_print_module_parms(cur_ops, "Start of test"); =20 // Shutdown task - if (shutdown) { - init_waitqueue_head(&shutdown_wq); - firsterr =3D torture_create_kthread(ref_scale_shutdown, NULL, - shutdown_task); + if (shutdown_secs) { + firsterr =3D torture_shutdown_init(shutdown_secs, ref_scale_cleanup); if (torture_init_error(firsterr)) goto unwind; - schedule_timeout_uninterruptible(1); } =20 // Reader tasks (default to ~75% of online CPUs). @@ -1604,7 +1581,7 @@ ref_scale_init(void) unwind: torture_init_end(); ref_scale_cleanup(); - if (shutdown) { + if (shutdown_secs) { WARN_ON(!IS_MODULE(CONFIG_RCU_REF_SCALE_TEST)); kernel_power_off(); } diff --git a/tools/testing/selftests/rcutorture/configs/refscale/ver_functi= ons.sh b/tools/testing/selftests/rcutorture/configs/refscale/ver_functions.= sh index 7484656276012..219fac070af28 100644 --- a/tools/testing/selftests/rcutorture/configs/refscale/ver_functions.sh +++ b/tools/testing/selftests/rcutorture/configs/refscale/ver_functions.sh @@ -11,7 +11,7 @@ # # Adds per-version torture-module parameters to kernels supporting them. per_version_boot_params () { - echo refscale.shutdown=3D1 \ + echo refscale.shutdown_secs=3D$3 \ refscale.verbose=3D0 \ $1 } --=20 2.40.1 From nobody Wed Apr 15 16:26:06 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC5B4375F86; Tue, 3 Mar 2026 23:50:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772581839; cv=none; b=Su2QLG2E1elDkubGk75O+aFpcNPrzU25y4XrJemrdJSB7U1KlkDmYceO3zTSndUuQeHiwaVXNPPtt7v8g/39B8meRKhR+4E6C8/6MFm63MbknzxPmp+UgW6oEQIBWBd+XVziuGBCo9DmeFdWoN0zOob0amFYk3KyXZ8t3AG9n9A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772581839; c=relaxed/simple; bh=KtvoPZmzGoXZhe4BtpSzeDvupGqSiwF6Bmcxh9+tTi8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sM5DUbvjx5G9JyulPgNjayPLUIvUt9LxT9e0UixToJuxNcQkx5IdRjkruh9ensiTcXAqF7vWiBd/sAn78TVwJHiXdhc88SkzB/gocWg+miBaI1I951x+Y1e6AZB6iJMEGko+gXMOU2waaw9/Gp2nc+/uuTzlxfQIrJH+3Cit4Tg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kHx4XrAT; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kHx4XrAT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE07DC116C6; Tue, 3 Mar 2026 23:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772581839; bh=KtvoPZmzGoXZhe4BtpSzeDvupGqSiwF6Bmcxh9+tTi8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kHx4XrATLphoEztESks9wzMChJRxZ/ORv6bQV8NXw95CVUL+rCoT2u+674k4vbXrI eL3Jz7CCrh2wAcxG4V0uJrSI0Lp+arKDnYQxvC3PJWJqcfnE5zNKjFmBjmzAGRYMF6 LJAutMOHE6Ke1Z3syJYTJ9E9Zn//3RGK8xwtQWa8cxxnJnGM1FvTDORyOR6RbJPySH O7bdvEVj9YB1xNVnDQs39+Z8DtyspaAaGogP2FIcCJYwpO7cPrV63hUx+4KBPAMMJS bcV1U0YFJVsfjUarXt65sh9QXBK5avP6F3Ij21xPz4y5OVkf8Ai2e4fOYk2YvQptNp ZZc4jvQgHOIFA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id F3697CE0F21; Tue, 3 Mar 2026 15:50:38 -0800 (PST) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH 08/11] rcuscale: Ditch rcu_scale_shutdown in favor of torture_shutdown_init() Date: Tue, 3 Mar 2026 15:50:34 -0800 Message-Id: <20260303235037.1967017-8-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <50d2bb98-c912-4ba6-a723-4a4aed506fdf@paulmck-laptop> References: <50d2bb98-c912-4ba6-a723-4a4aed506fdf@paulmck-laptop> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The torture_shutdown_init() function spawns a shutdown kthread in a manner very similar to that implemented by rcu_scale_shutdown(). This commit therefore re-implements rcu_scale_shutdown() in terms of torture_shutdown_init(). This patch was generated by Claude given as input the patch making the same transformation of ref_scale_shutdown(). Signed-off-by: Paul E. McKenney --- kernel/rcu/rcuscale.c | 78 +++++-------------- .../configs/rcuscale/ver_functions.sh | 2 +- 2 files changed, 22 insertions(+), 58 deletions(-) diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c index 4ac2b134a9833..ac0b1c6b7dae2 100644 --- a/kernel/rcu/rcuscale.c +++ b/kernel/rcu/rcuscale.c @@ -79,12 +79,6 @@ MODULE_AUTHOR("Paul E. McKenney "= ); * test-end checks, and the pair of calls through pointers. */ =20 -#ifdef MODULE -# define RCUSCALE_SHUTDOWN 0 -#else -# define RCUSCALE_SHUTDOWN 1 -#endif - torture_param(bool, gp_async, false, "Use asynchronous GP wait primitives"= ); torture_param(int, gp_async_max, 1000, "Max # outstanding waits per writer= "); torture_param(bool, gp_exp, false, "Use expedited GP wait primitives"); @@ -92,8 +86,8 @@ torture_param(int, holdoff, 10, "Holdoff time before test= start (s)"); torture_param(int, minruntime, 0, "Minimum run time (s)"); torture_param(int, nreaders, -1, "Number of RCU reader threads"); torture_param(int, nwriters, -1, "Number of RCU updater threads"); -torture_param(bool, shutdown, RCUSCALE_SHUTDOWN, - "Shutdown at end of scalability tests."); +torture_param(int, shutdown_secs, !IS_MODULE(CONFIG_RCU_SCALE_TEST) * 300, + "Shutdown at end of scalability tests or at specified timeout (s)."= ); torture_param(int, verbose, 1, "Enable verbose debugging printk()s"); torture_param(int, writer_holdoff, 0, "Holdoff (us) between GPs, zero to d= isable"); torture_param(int, writer_holdoff_jiffies, 0, "Holdoff (jiffies) between G= Ps, zero to disable"); @@ -123,7 +117,6 @@ static int nrealreaders; static int nrealwriters; static struct task_struct **writer_tasks; static struct task_struct **reader_tasks; -static struct task_struct *shutdown_task; =20 static u64 **writer_durations; static bool *writer_done; @@ -132,7 +125,6 @@ static int *writer_n_durations; static atomic_t n_rcu_scale_reader_started; static atomic_t n_rcu_scale_writer_started; static atomic_t n_rcu_scale_writer_finished; -static wait_queue_head_t shutdown_wq; static u64 t_rcu_scale_writer_started; static u64 t_rcu_scale_writer_finished; static unsigned long b_rcu_gp_test_started; @@ -519,6 +511,8 @@ static void rcu_scale_async_cb(struct rcu_head *rhp) rcu_scale_free(wmbp); } =20 +static void rcu_scale_cleanup(void); + /* * RCU scale writer kthread. Repeatedly does a grace period. */ @@ -622,9 +616,11 @@ rcu_scale_writer(void *arg) b_rcu_gp_test_finished =3D cur_ops->get_gp_seq(); } - if (shutdown) { + if (shutdown_secs) { + writer_tasks[me] =3D NULL; smp_mb(); /* Assign before wake. */ - wake_up(&shutdown_wq); + rcu_scale_cleanup(); + kernel_power_off(); } } } @@ -668,8 +664,8 @@ static void rcu_scale_print_module_parms(struct rcu_scale_ops *cur_ops, const char *ta= g) { pr_alert("%s" SCALE_FLAG - "--- %s: gp_async=3D%d gp_async_max=3D%d gp_exp=3D%d holdoff=3D%d minru= ntime=3D%d nreaders=3D%d nwriters=3D%d writer_holdoff=3D%d writer_holdoff_j= iffies=3D%d verbose=3D%d shutdown=3D%d\n", - scale_type, tag, gp_async, gp_async_max, gp_exp, holdoff, minruntime, n= realreaders, nrealwriters, writer_holdoff, writer_holdoff_jiffies, verbose,= shutdown); + "--- %s: gp_async=3D%d gp_async_max=3D%d gp_exp=3D%d holdoff=3D%d minru= ntime=3D%d nreaders=3D%d nwriters=3D%d writer_holdoff=3D%d writer_holdoff_j= iffies=3D%d verbose=3D%d shutdown_secs=3D%d\n", + scale_type, tag, gp_async, gp_async_max, gp_exp, holdoff, minruntime, n= realreaders, nrealwriters, writer_holdoff, writer_holdoff_jiffies, verbose,= shutdown_secs); } =20 /* @@ -722,6 +718,8 @@ static void kfree_call_rcu(struct rcu_head *rh) kfree(obj); } =20 +static void kfree_scale_cleanup(void); + static int kfree_scale_thread(void *arg) { @@ -791,9 +789,11 @@ kfree_scale_thread(void *arg) rcuscale_seq_diff(b_rcu_gp_test_finished, b_rcu_gp_test_started), PAGES_TO_MB(mem_begin - mem_during)); =20 - if (shutdown) { + if (shutdown_secs) { + kfree_reader_tasks[me] =3D NULL; smp_mb(); /* Assign before wake. */ - wake_up(&shutdown_wq); + kfree_scale_cleanup(); + kernel_power_off(); } } =20 @@ -820,22 +820,6 @@ kfree_scale_cleanup(void) torture_cleanup_end(); } =20 -/* - * shutdown kthread. Just waits to be awakened, then shuts down system. - */ -static int -kfree_scale_shutdown(void *arg) -{ - wait_event_idle(shutdown_wq, - atomic_read(&n_kfree_scale_thread_ended) >=3D kfree_nrealthreads); - - smp_mb(); /* Wake before output. */ - - kfree_scale_cleanup(); - kernel_power_off(); - return -EINVAL; -} - // Used if doing RCU-kfree'ing via call_rcu(). static unsigned long jiffies_at_lazy_cb; static struct rcu_head lazy_test1_rh; @@ -895,13 +879,10 @@ kfree_scale_init(void) =20 kfree_nrealthreads =3D compute_real(kfree_nthreads); /* Start up the kthreads. */ - if (shutdown) { - init_waitqueue_head(&shutdown_wq); - firsterr =3D torture_create_kthread(kfree_scale_shutdown, NULL, - shutdown_task); + if (shutdown_secs) { + firsterr =3D torture_shutdown_init(shutdown_secs, kfree_scale_cleanup); if (torture_init_error(firsterr)) goto unwind; - schedule_timeout_uninterruptible(1); } =20 pr_alert("kfree object size=3D%zu, kfree_by_call_rcu=3D%d\n", @@ -1058,20 +1039,6 @@ rcu_scale_cleanup(void) torture_cleanup_end(); } =20 -/* - * RCU scalability shutdown kthread. Just waits to be awakened, then shuts - * down system. - */ -static int -rcu_scale_shutdown(void *arg) -{ - wait_event_idle(shutdown_wq, atomic_read(&n_rcu_scale_writer_finished) >= =3D nrealwriters); - smp_mb(); /* Wake before output. */ - rcu_scale_cleanup(); - kernel_power_off(); - return -EINVAL; -} - static int __init rcu_scale_init(void) { @@ -1121,13 +1088,10 @@ rcu_scale_init(void) =20 /* Start up the kthreads. */ =20 - if (shutdown) { - init_waitqueue_head(&shutdown_wq); - firsterr =3D torture_create_kthread(rcu_scale_shutdown, NULL, - shutdown_task); + if (shutdown_secs) { + firsterr =3D torture_shutdown_init(shutdown_secs, rcu_scale_cleanup); if (torture_init_error(firsterr)) goto unwind; - schedule_timeout_uninterruptible(1); } reader_tasks =3D kzalloc_objs(reader_tasks[0], nrealreaders); if (reader_tasks =3D=3D NULL) { @@ -1201,7 +1165,7 @@ rcu_scale_init(void) unwind: torture_init_end(); rcu_scale_cleanup(); - if (shutdown) { + if (shutdown_secs) { WARN_ON(!IS_MODULE(CONFIG_RCU_SCALE_TEST)); kernel_power_off(); } diff --git a/tools/testing/selftests/rcutorture/configs/rcuscale/ver_functi= ons.sh b/tools/testing/selftests/rcutorture/configs/rcuscale/ver_functions.= sh index 28070b43f0171..b78ddc243d891 100644 --- a/tools/testing/selftests/rcutorture/configs/rcuscale/ver_functions.sh +++ b/tools/testing/selftests/rcutorture/configs/rcuscale/ver_functions.sh @@ -11,7 +11,7 @@ # # Adds per-version torture-module parameters to kernels supporting them. per_version_boot_params () { - echo rcuscale.shutdown=3D1 \ + echo rcuscale.shutdown_secs=3D$3 \ rcuscale.verbose=3D0 \ $1 } --=20 2.40.1 From nobody Wed Apr 15 16:26:06 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DBDD7375F73; Tue, 3 Mar 2026 23:50:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772581839; cv=none; b=KqIUyK9gRsEXJdJZqRr6jn/8/flOTUXwNy+sL+aZS7WiacFT8agVDUSiDun0YKSxicSJhZPowJwKAyTrkNNR9Gj6BjlXj0WaXdHJTFtet76RW990qIEXZn7uJf69Hm/f1kkDlT5Xh+Ixguyhc2qv0vvXMKNCEY/5ZV2Y6qbsoxU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772581839; c=relaxed/simple; bh=LsxxOfWiPlTxCH05+8fFIJs7Puc5r1ZoF+Dyd6H53mU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BpSNN5a/Qs85HZkmaZcyiboeYZA2QbL0yDh1p1KRNwK+60a3IgBXG7M1BBh10t092CdjMctlUvs5NVp5zaeCJzo8/fT405x+TknqZaZMRI7aBX3z+7jBWFxvJ+XNK7nv1oWhQmcCTeARwUQgA36Pe8EzY8G+TBolUbOeQIp3rmk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gyQS5Zni; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gyQS5Zni" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE0B2C19422; Tue, 3 Mar 2026 23:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772581839; bh=LsxxOfWiPlTxCH05+8fFIJs7Puc5r1ZoF+Dyd6H53mU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gyQS5ZniSMEI8kXWSXrBmfWt13A4RYRWrUhbvZvYLpVCmkgKU7vHO1997mg/EFF62 7DP4jYzjCOZpBcIPknqSA77uh9+/VqXpVO/W8r6611mLtnc/PurNmL8DcrUddVAlx1 V1JrNTuTxjtcnrJlQInMqxgBSK+xFljjRlsnBqm5OaWkB4hf8EMAoh2nN6SP2O+7N6 lJ2wnqBgYvr8MhUwdp5xJJW0bKKRJJ8APPrOA4E4TdJHyq8Cz7JOuUNXqoOn1HVKXf CXNQ0jBpzC3+8cJMB4JoPOx2LAKARq4mTfW3jpEyndeqixEaXG9kNMCRPmSvq3kCoX NSbejYE9cSYRg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 01B6FCE10F3; Tue, 3 Mar 2026 15:50:39 -0800 (PST) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH 09/11] srcu: Fix SRCU read flavor macro comments Date: Tue, 3 Mar 2026 15:50:35 -0800 Message-Id: <20260303235037.1967017-9-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <50d2bb98-c912-4ba6-a723-4a4aed506fdf@paulmck-laptop> References: <50d2bb98-c912-4ba6-a723-4a4aed506fdf@paulmck-laptop> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The SRCU_READ_FLAVOR_FAST and SRCU_READ_FLAVOR_FAST_UPDOWN comments need repair. The former fails to not that SRCU-fast can be used in NMI handlers, and the latter says that it goes with srcu_read_lock_fast() when it really goes with srcu_read_lock_fast_updown(). This commit therefore fixes both comments. Signed-off-by: Paul E. McKenney --- include/linux/srcu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/srcu.h b/include/linux/srcu.h index bb44a0bd76968..81b1938512d5d 100644 --- a/include/linux/srcu.h +++ b/include/linux/srcu.h @@ -69,8 +69,8 @@ int init_srcu_struct_fast_updown(struct srcu_struct *ssp); #define SRCU_READ_FLAVOR_NORMAL 0x1 // srcu_read_lock(). #define SRCU_READ_FLAVOR_NMI 0x2 // srcu_read_lock_nmisafe(). // 0x4 // SRCU-lite is no longer with us. -#define SRCU_READ_FLAVOR_FAST 0x4 // srcu_read_lock_fast(). -#define SRCU_READ_FLAVOR_FAST_UPDOWN 0x8 // srcu_read_lock_fast(). +#define SRCU_READ_FLAVOR_FAST 0x4 // srcu_read_lock_fast(), also NMI-saf= e. +#define SRCU_READ_FLAVOR_FAST_UPDOWN 0x8 // srcu_read_lock_fast_updown(). #define SRCU_READ_FLAVOR_ALL (SRCU_READ_FLAVOR_NORMAL | SRCU_READ_FLAVOR_= NMI | \ SRCU_READ_FLAVOR_FAST | SRCU_READ_FLAVOR_FAST_UPDOWN) // All of the above. --=20 2.40.1 From nobody Wed Apr 15 16:26:06 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC52D375F85; Tue, 3 Mar 2026 23:50:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772581839; cv=none; b=GM4Ovyt/vHGWaQmXKGhJT3sBXSfEFwu3bkqwH8B/VzzkHObHeHXl4N36yBG7VWlYW/R+ghSWw5piKVPMuBnn6amlKoYpN4aBkj+C0xJInG+fpLBLw96E+/KXxr28XRqy/lN1HLNHr9dJnbB/KJcOxLiVaN3gMZWxTVEbmJklggE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772581839; c=relaxed/simple; bh=4tMsyWMAYFo2eyVNnuqFXVGyeJ7PQ6C7oWvMZ7xShEA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DUzoVQOA02y4hGoMMU+veJe8KSZdEte2u0E7agGfZPvgBBoAy76eKhJptS1luemkDdv7TI7qdA8b4Qtr7xj3HGFF7URKtHdi+/ABhZWGy+XwaekdHtbWun5YJtQjpHOqotJm2UKK8yIfedX1sDJf/t/lj2miPydVAG3/TfJVw4k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fgEFo0yk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fgEFo0yk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE349C4AF0B; Tue, 3 Mar 2026 23:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772581839; bh=4tMsyWMAYFo2eyVNnuqFXVGyeJ7PQ6C7oWvMZ7xShEA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fgEFo0yk0UCLaFWQYQlrgEQy2aNi39A9bWywkF6Hx13k6dHa8LehyD34MtPTd8v85 pgaUTbxS4WljOUPLMiLn6BDd+yzawZ8K+XnRkN2r3OtxJYKvS6MxgSZHiY67LTJBc6 KObmRbE7QhLgdZLqe+Y/sBcmpVXAc6sEVyMem2ukdo5xwunmEY1axh+qiBBRxeT75Q sPDIoOyMUrHTsJi8yw7vlIWvFwol8dWsVSV53KeL+4Rm8bNkZl7waZqDRuuNGoHlf3 b5/UyNVObqm9QWspM2Ha2Jg5r/Ratctp+elQ9C2OFRQnU26GHJv6RlqAT2JaSZuu7t CU+A5sm1wNUpQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 04260CE11D1; Tue, 3 Mar 2026 15:50:39 -0800 (PST) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" , Mathieu Desnoyers Subject: [PATCH 10/11] srcu: Fix s/they disables/they disable/ typo in srcu_read_unlock_fast() Date: Tue, 3 Mar 2026 15:50:36 -0800 Message-Id: <20260303235037.1967017-10-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <50d2bb98-c912-4ba6-a723-4a4aed506fdf@paulmck-laptop> References: <50d2bb98-c912-4ba6-a723-4a4aed506fdf@paulmck-laptop> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Typo fix in srcu_read_unlock_fast() header comment. Reported-by: Mathieu Desnoyers Signed-off-by: Paul E. McKenney Reviewed-by: Mathieu Desnoyers --- include/linux/srcutree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/srcutree.h b/include/linux/srcutree.h index 958cb7ef41cbb..ad783d4dd3677 100644 --- a/include/linux/srcutree.h +++ b/include/linux/srcutree.h @@ -259,7 +259,7 @@ static inline struct srcu_ctr __percpu *__srcu_ctr_to_p= tr(struct srcu_struct *ss * srcu_read_unlock_fast(). * * Note that both this_cpu_inc() and atomic_long_inc() are RCU read-side - * critical sections either because they disables interrupts, because + * critical sections either because they disable interrupts, because * they are a single instruction, or because they are read-modify-write * atomic operations, depending on the whims of the architecture. * This matters because the SRCU-fast grace-period mechanism uses either --=20 2.40.1 From nobody Wed Apr 15 16:26:06 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 008B6377EA2; Tue, 3 Mar 2026 23:50:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772581840; cv=none; b=ODCOyFzNcm02vUDqSV0R4ZlvE+9v3L1B//ZidjmWPRYLSznw8niqOwXNrBgYpVLlocTZQXO90wL9MIXu0DnCyLn23ujTazsHoMIONIC/Ykk6u6FVtz0mHGb91BOP0jMAEyCtnOATYGX6P2YYfCHUY1Wvn4WhnqvEA4oNTDB6O34= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772581840; c=relaxed/simple; bh=rcD7aMLeHklXTl+Yf82NJjNoqb+vojvpO5oAEVk22UI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=knyPaVSW+95rtdGEG+5mnzZTcEj4vcY3KNCc0BQI9qyrkb/UhE082WZHb1eEc+A9hVdR2Vhm3jqG4VuTwEB2lMRP3hZGT06X0D+dcOJmz6GtT0eV+CmurT8owug6mgM3QVn1GD9aVJML06Kqpu5nQUfLNbyDVTdNbDBOs9mycbY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=P1FAnAjS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="P1FAnAjS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9679C4AF0D; Tue, 3 Mar 2026 23:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772581839; bh=rcD7aMLeHklXTl+Yf82NJjNoqb+vojvpO5oAEVk22UI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P1FAnAjSZU1FB5Wgie5CLsG9KrBTQ9RtpyFtnGz/Ddllh86xy0uUn41PXwy7xjDUP uS14OUmpNwYW0OGowROToZ40F3D1wrYd9Y193aI61lutBldc8L5cQ/mPgwVq/mrHHj qRxy+SVZ8G4F3aai79bwk1YNf81nEBcnvKvyFZvegMJ1GjndDiX3weGT21SFJMuoMC gcLoXW6nmeTRJ2dNevYHWWw+FvrrCtw8S20bmMi6h5OMpZLAYmlfszqTYAOsqeFXCA kf3T9ffjPXqXlP3FGmliBiVI8CXf1g74Bc1Jd98t+XQr+5nkFKqQnkpxDcUvfBSewe ijWFjOhdPauHg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 06BFDCE11EF; Tue, 3 Mar 2026 15:50:39 -0800 (PST) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" , Alexei Starovoitov Subject: [PATCH 11/11] rcu-tasks: Document that RCU Tasks Trace grace periods now imply RCU grace periods Date: Tue, 3 Mar 2026 15:50:37 -0800 Message-Id: <20260303235037.1967017-11-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <50d2bb98-c912-4ba6-a723-4a4aed506fdf@paulmck-laptop> References: <50d2bb98-c912-4ba6-a723-4a4aed506fdf@paulmck-laptop> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Now that RCU Tasks Trace is implemented in terms of SRCU-fast, the fact that each SRCU-fast grace period implies at least two RCU grace periods in turn means that each RCU Tasks Trace grace period implies at least two grace periods. This commit therefore updates the documentation accordingly. Reported-by: Alexei Starovoitov Signed-off-by: Paul E. McKenney --- Documentation/RCU/Design/Requirements/Requirements.rst | 7 +++++++ include/linux/rcupdate.h | 9 +++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Documentation/RCU/Design/Requirements/Requirements.rst b/Docum= entation/RCU/Design/Requirements/Requirements.rst index b5cdbba3ec2e7..4d886e7c7a956 100644 --- a/Documentation/RCU/Design/Requirements/Requirements.rst +++ b/Documentation/RCU/Design/Requirements/Requirements.rst @@ -2787,6 +2787,13 @@ which avoids the read-side memory barriers, at least= for architectures that apply noinstr to kernel entry/exit code (or that build with ``CONFIG_TASKS_TRACE_RCU_NO_MB=3Dy``. =20 +Now that the implementation is based on SRCU-fast, a call +to synchronize_rcu_tasks_trace() implies at least one call to +synchronize_rcu(), that is, every Tasks Trace RCU grace period contains +at least one plain vanilla RCU grace period. Should there ever +be a synchronize_rcu_tasks_trace_expedited(), this guarantee would +*not* necessarily apply to this hypothetical API member. + The tasks-trace-RCU API is also reasonably compact, consisting of rcu_read_lock_trace(), rcu_read_unlock_trace(), rcu_read_lock_trace_held(), call_rcu_tasks_trace(), diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 04f3f86a41450..18a85c30fd4f3 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h @@ -208,12 +208,9 @@ static inline void exit_tasks_rcu_finish(void) { } /** * rcu_trace_implies_rcu_gp - does an RCU Tasks Trace grace period imply a= n RCU grace period? * - * As an accident of implementation, an RCU Tasks Trace grace period also - * acts as an RCU grace period. However, this could change at any time. - * Code relying on this accident must call this function to verify that - * this accident is still happening. - * - * You have been warned! + * Now that RCU Tasks Trace is implemented in terms of SRCU-fast, a + * call to synchronize_rcu_tasks_trace() is guaranteed to imply at least + * one call to synchronize_rcu(). */ static inline bool rcu_trace_implies_rcu_gp(void) { return true; } =20 --=20 2.40.1