linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: tglx@linutronix.de
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH RFC tip/core/rcu] rcutorture: Limit reader duration if irq or bh disabled
Date: Fri, 20 Jul 2018 12:11:21 -0700	[thread overview]
Message-ID: <20180720191121.GA18061@linux.vnet.ibm.com> (raw)

Hello, Thomas,

As discussed on IRC.  Thoughts?

							Thanx, Paul


commit 6ba3f37d31b614d7a41c3a1eb472dfc4e44944af
Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Date:   Fri Jul 20 12:04:12 2018 -0700

    rcutorture: Limit reader duration if irq or bh disabled
    
    There are debug checks in some environments that will complain if the
    duration of a bh-disabled region of code exceeds about 50 milliseconds.
    Because rcu_read_delay() can produce a 50-millisecond delay and because
    there could be up to eight reader segments with such delays, this commit
    limits the maximum delay to 10 milliseconds if either interrupts or
    softirqs are disabled.
    
    Reported-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 28af5db3e7d1..16735a3545d2 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -341,7 +341,7 @@ rcu_read_delay(struct torture_random_state *rrsp, struct rt_read_seg * rtrsp)
 	unsigned long started;
 	unsigned long completed;
 	const unsigned long shortdelay_us = 200;
-	const unsigned long longdelay_ms = 300;
+	unsigned long longdelay_ms = 300;
 	unsigned long long ts;
 
 	/* We want a short delay sometimes to make a reader delay the grace
@@ -351,6 +351,8 @@ rcu_read_delay(struct torture_random_state *rrsp, struct rt_read_seg * rtrsp)
 	if (!(torture_random(rrsp) % (nrealreaders * 2000 * longdelay_ms))) {
 		started = cur_ops->get_gp_seq();
 		ts = rcu_trace_clock_local();
+		if (preempt_count() & (SOFTIRQ_MASK | HARDIRQ_MASK))
+			longdelay_ms = 5; /* Avoid triggering BH limits. */
 		mdelay(longdelay_ms);
 		rtrsp->rt_delay_ms = longdelay_ms;
 		completed = cur_ops->get_gp_seq();


                 reply	other threads:[~2018-07-20 19:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20180720191121.GA18061@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).