mirror of https://lore.kernel.org/lkml/
 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>
Subject: [PATCH rcu 17/18] rcutorture: Add per-reader-segment preemption diagnostics
Date: Thu, 12 Dec 2024 10:49:56 -0800	[thread overview]
Message-ID: <20241212184957.2127441-17-paulmck@kernel.org> (raw)
In-Reply-To: <62e4d9a4-18ad-49b3-9656-23e17b78033f@paulmck-laptop>

For preemptible RCU, this commit adds an indication for each
reader segments to whether the rcu_torture_reader() task was
on the ->blkd_tasks lists, though only in kernels built with
CONFIG_RCU_TORTURE_TEST_LOG_CPU=y.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 kernel/rcu/rcutorture.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index ab354bb7f1b68..41b661bf000a7 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -464,10 +464,8 @@ rcu_read_delay(struct torture_random_state *rrsp, struct rt_read_seg *rtrsp)
 		rtrsp->rt_delay_us = shortdelay_us;
 	}
 	if (!preempt_count() &&
-	    !(torture_random(rrsp) % (nrealreaders * 500))) {
+	    !(torture_random(rrsp) % (nrealreaders * 500)))
 		torture_preempt_schedule();  /* QS only if preemptible. */
-		rtrsp->rt_preempted = true;
-	}
 }
 
 static void rcu_torture_read_unlock(int idx)
@@ -1961,8 +1959,11 @@ static void rcutorture_one_extend(int *readstate, int newstate, bool insoftirq,
 	if (IS_ENABLED(CONFIG_RCU_TORTURE_TEST_LOG_CPU)) {
 		int cpu = raw_smp_processor_id();
 		rtrsp->rt_cpu = cpu;
-		if (!first)
+		if (!first) {
 			rtrsp[-1].rt_end_cpu = cpu;
+			if (cur_ops->reader_blocked)
+				rtrsp[-1].rt_preempted = cur_ops->reader_blocked();
+		}
 	}
 
 	/*
-- 
2.40.1


  parent reply	other threads:[~2024-12-12 18:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-12 18:49 [PATCH rcu 0/18] RCU torture-test updates for v6.14 Paul E. McKenney
2024-12-12 18:49 ` [PATCH rcu 01/18] torture: Add dowarn argument to torture_sched_setaffinity() Paul E. McKenney
2024-12-12 18:49 ` [PATCH rcu 02/18] rcutorture: Add random real-time preemption Paul E. McKenney
2024-12-12 18:49 ` [PATCH rcu 03/18] rcutorture: Make the TREE03 scenario do preemption Paul E. McKenney
2024-12-12 18:49 ` [PATCH rcu 04/18] rcutorture: Decorate failing reader segments with CPU ID Paul E. McKenney
2024-12-12 18:49 ` [PATCH rcu 05/18] rcutorture: Use finer-grained timeouts for rcu_torture_writer() polling Paul E. McKenney
2024-12-12 18:49 ` [PATCH rcu 06/18] rcutorture: Add ->cond_sync_exp_full function to rcu_ops structure Paul E. McKenney
2024-12-12 18:49 ` [PATCH rcu 07/18] rcutorture: Check preemption for failing reader Paul E. McKenney
2024-12-12 18:49 ` [PATCH rcu 08/18] rcutorture: Decorate failing reader segments with last CPU ID Paul E. McKenney
2024-12-12 18:49 ` [PATCH rcu 09/18] rcutorture: Add full read-side contexts to "busted" torture type Paul E. McKenney
2024-12-12 18:49 ` [PATCH rcu 10/18] rcutorture: Pretty-print rcutorture reader segments Paul E. McKenney
2024-12-12 18:49 ` [PATCH rcu 11/18] rcutorture: Make rcutorture_one_extend() check reader state Paul E. McKenney
2024-12-12 18:49 ` [PATCH rcu 12/18] rcutorture: Ignore attempts to test preemption and forward progress Paul E. McKenney
2024-12-12 18:49 ` [PATCH rcu 13/18] rcutorture: Add documentation for recent conditional and polled APIs Paul E. McKenney
2024-12-12 18:49 ` [PATCH rcu 14/18] rcutorture: Add parameters to control polled/conditional wait interval Paul E. McKenney
2024-12-12 18:49 ` [PATCH rcu 15/18] rcutorture: Add preempt_count() to rcutorture_one_extend_check() diagnostics Paul E. McKenney
2024-12-12 18:49 ` [PATCH rcu 16/18] rcutorture: Read CPU ID for decoration protected by both reader types Paul E. McKenney
2024-12-12 18:49 ` Paul E. McKenney [this message]
2024-12-12 18:49 ` [PATCH rcu 18/18] rcutorture: Use symbols for SRCU reader flavors 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=20241212184957.2127441-17-paulmck@kernel.org \
    --to=paulmck@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®