public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: rcu@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com,
	rostedt@goodmis.org, "Paul E. McKenney" <paulmck@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	bpf@vger.kernel.org
Subject: [PATCH 16/19] rcutorture: Test SRCU-fast separately from SRCU-fast-updown
Date: Sun,  2 Nov 2025 13:44:33 -0800	[thread overview]
Message-ID: <20251102214436.3905633-16-paulmck@kernel.org> (raw)
In-Reply-To: <082fb8ba-91b8-448e-a472-195eb7b282fd@paulmck-laptop>

This commit causes rcutorture to use the 0x4 value of the reader_flavor
module parameter to test SRCU-fast.  The 0x8 value tests SRCU-fast-updown.
However, most SRCU-fast testing will be via the RCU Tasks Trace wrappers.

[ paulmck: Apply s/0x8/0x4/ missing change per Boqun Feng feedback. ]

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: <bpf@vger.kernel.org>
---
 kernel/rcu/rcutorture.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 587b28258b6e..4a9b6866c0cc 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -693,6 +693,7 @@ static struct rcu_torture_ops rcu_busted_ops = {
 
 DEFINE_STATIC_SRCU(srcu_ctl);
 DEFINE_STATIC_SRCU_FAST(srcu_ctlf);
+DEFINE_STATIC_SRCU_FAST_UPDOWN(srcu_ctlfud);
 static struct srcu_struct srcu_ctld;
 static struct srcu_struct *srcu_ctlp = &srcu_ctl;
 static struct rcu_torture_ops srcud_ops;
@@ -703,7 +704,7 @@ static void srcu_torture_init(void)
 	if (reader_flavor & SRCU_READ_FLAVOR_FAST)
 		srcu_ctlp = &srcu_ctlf;
 	if (reader_flavor & SRCU_READ_FLAVOR_FAST_UPDOWN)
-		srcu_ctlp = &srcu_ctlf;
+		srcu_ctlp = &srcu_ctlfud;
 }
 
 static void srcu_get_gp_data(int *flags, unsigned long *gp_seq)
@@ -736,7 +737,7 @@ static int srcu_torture_read_lock(void)
 		ret += idx << 2;
 	}
 	if (reader_flavor & SRCU_READ_FLAVOR_FAST_UPDOWN) {
-		scp = srcu_read_lock_fast(srcu_ctlp);
+		scp = srcu_read_lock_fast_updown(srcu_ctlp);
 		idx = __srcu_ptr_to_ctr(srcu_ctlp, scp);
 		WARN_ON_ONCE(idx & ~0x1);
 		ret += idx << 3;
@@ -767,9 +768,10 @@ static void srcu_torture_read_unlock(int idx)
 {
 	WARN_ON_ONCE((reader_flavor && (idx & ~reader_flavor)) || (!reader_flavor && (idx & ~0x1)));
 	if (reader_flavor & SRCU_READ_FLAVOR_FAST_UPDOWN)
-		srcu_read_unlock_fast(srcu_ctlp, __srcu_ctr_to_ptr(srcu_ctlp, (idx & 0x8) >> 3));
+		srcu_read_unlock_fast_updown(srcu_ctlp,
+					     __srcu_ctr_to_ptr(srcu_ctlp, (idx & 0x8) >> 3));
 	if (reader_flavor & SRCU_READ_FLAVOR_FAST)
-		srcu_read_unlock_fast(srcu_ctlp, __srcu_ctr_to_ptr(srcu_ctlp, (idx & 0x8) >> 2));
+		srcu_read_unlock_fast(srcu_ctlp, __srcu_ctr_to_ptr(srcu_ctlp, (idx & 0x4) >> 2));
 	if (reader_flavor & SRCU_READ_FLAVOR_NMI)
 		srcu_read_unlock_nmisafe(srcu_ctlp, (idx & 0x2) >> 1);
 	if ((reader_flavor & SRCU_READ_FLAVOR_NORMAL) || !(reader_flavor & SRCU_READ_FLAVOR_ALL))
@@ -919,7 +921,7 @@ static void srcud_torture_init(void)
 {
 	rcu_sync_torture_init();
 	if (reader_flavor & SRCU_READ_FLAVOR_FAST_UPDOWN)
-		WARN_ON(init_srcu_struct_fast(&srcu_ctld));
+		WARN_ON(init_srcu_struct_fast_updown(&srcu_ctld));
 	else if (reader_flavor & SRCU_READ_FLAVOR_FAST)
 		WARN_ON(init_srcu_struct_fast(&srcu_ctld));
 	else
-- 
2.40.1


  parent reply	other threads:[~2025-11-02 21:44 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-02 21:44 [PATCH 0/18] SRCU updates for v6.19 Paul E. McKenney
2025-11-02 21:44 ` [PATCH 01/19] srcu: Permit Tiny SRCU srcu_read_unlock() with interrupts disabled Paul E. McKenney
2025-11-02 21:44 ` [PATCH 02/19] srcu: Create an srcu_expedite_current() function Paul E. McKenney
2025-11-02 21:44 ` [PATCH 03/19] rcutorture: Test srcu_expedite_current() Paul E. McKenney
2025-11-02 21:44 ` [PATCH 04/19] srcu: Create a DEFINE_SRCU_FAST() Paul E. McKenney
2025-11-02 21:44 ` [PATCH 05/19] srcu: Make grace-period determination use ssp->srcu_reader_flavor Paul E. McKenney
2025-11-02 21:44 ` [PATCH 06/19] rcutorture: Exercise DEFINE_STATIC_SRCU_FAST() and init_srcu_struct_fast() Paul E. McKenney
2025-11-02 21:44 ` [PATCH 07/19] srcu: Require special srcu_struct define/init for SRCU-fast readers Paul E. McKenney
2025-11-02 21:44 ` [PATCH 08/19] srcu: Make SRCU-fast readers enforce use of SRCU-fast definition/init Paul E. McKenney
2025-11-02 21:44 ` [PATCH 09/19] doc: Update for SRCU-fast definitions and initialization Paul E. McKenney
2025-11-02 21:44 ` [PATCH 10/19] tracing: Guard __DECLARE_TRACE() use of __DO_TRACE_CALL() with SRCU-fast Paul E. McKenney
2025-11-02 21:44 ` [PATCH 11/19] rcu: Mark diagnostic functions as notrace Paul E. McKenney
2025-11-02 21:44 ` [PATCH 12/19] rcutorture: Permit kvm-again.sh to re-use the build directory Paul E. McKenney
2025-11-02 21:44 ` [PATCH 13/19] srcu: Add SRCU_READ_FLAVOR_FAST_UPDOWN CPP macro Paul E. McKenney
2025-11-02 21:44 ` [PATCH 14/19] torture: Permit negative kvm.sh --kconfig numberic arguments Paul E. McKenney
2025-11-02 21:44 ` [PATCH 15/19] srcu: Create an SRCU-fast-updown API Paul E. McKenney
2025-11-04  7:00   ` Akira Yokosawa
2025-11-04 16:49     ` Paul E. McKenney
2025-11-02 21:44 ` Paul E. McKenney [this message]
2025-11-02 21:44 ` [PATCH 17/19] srcu: Optimize SRCU-fast-updown for arm64 Paul E. McKenney
2025-11-03 12:51   ` Will Deacon
2025-11-03 14:07     ` Catalin Marinas
2025-11-03 17:02     ` Paul E. McKenney
2025-11-03 13:34   ` Mathieu Desnoyers
2025-11-03 17:08     ` Paul E. McKenney
2025-11-03 18:16       ` Mathieu Desnoyers
2025-11-03 19:17         ` Paul E. McKenney
2025-11-03 19:22           ` Mathieu Desnoyers
2025-11-02 21:44 ` [PATCH 18/19] rcutorture: Make srcu{,d}_torture_init() announce the SRCU type Paul E. McKenney
2025-11-02 21:44 ` [PATCH 19/19] rcutorture: Remove redundant rcutorture_one_extend() from rcu_torture_one_read() Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251102214436.3905633-16-paulmck@kernel.org \
    --to=paulmck@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox