mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: mingo@kernel.org, laijs@cn.fujitsu.com, dipankar@in.ibm.com,
	akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
	josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org,
	rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com,
	dvhart@linux.intel.com, fweisbec@gmail.com, oleg@redhat.com,
	bobby.prani@gmail.com,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: [PATCH RFC tip/core/rcu 3/5] rcutorture: Ensure that normal GPs advance without expedited GPs
Date: Tue, 30 Jun 2015 14:48:28 -0700	[thread overview]
Message-ID: <1435700910-9104-3-git-send-email-paulmck@linux.vnet.ibm.com> (raw)
In-Reply-To: <1435700910-9104-1-git-send-email-paulmck@linux.vnet.ibm.com>

From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>

Currently, rcutorture runs between 25% and 50% of grace periods as
expedited grace periods.  This means that on large configurations,
there are expected to be a number of expedited grace periods executing
concurrently with each normal grace period.  Now that normal grace periods
can be assisted by expedited grace periods, rcutorture would be unable to
detect a bug that prevented normal grace periods from completing if there
was no expedited grace period helping it.

This commit therefore alternates 30-second phases that run expedited
grace periods and 30-second phases that do not, so that this sort of
bug will provoke an RCU CPU stall warning.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcu/rcutorture.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 59aa76b4460e..c62c1c34d73c 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -54,6 +54,11 @@
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Paul E. McKenney <paulmck@us.ibm.com> and Josh Triplett <josh@joshtriplett.org>");
 
+#ifdef CONFIG_RCU_CPU_STALL_TIMEOUT
+#define NOEXP_SECS_DEFAULT (CONFIG_RCU_CPU_STALL_TIMEOUT + 10)
+#else /* #ifdef CONFIG_RCU_CPU_STALL_TIMEOUT */
+#define NOEXP_SECS_DEFAULT 30
+#endif /* #else #ifdef CONFIG_RCU_CPU_STALL_TIMEOUT */
 
 torture_param(int, cbflood_inter_holdoff, HZ,
 	      "Holdoff between floods (jiffies)");
@@ -75,6 +80,8 @@ torture_param(int, irqreader, 1, "Allow RCU readers from irq handlers");
 torture_param(int, n_barrier_cbs, 0,
 	     "# of callbacks/kthreads for barrier testing");
 torture_param(int, nfakewriters, 4, "Number of RCU fake writer threads");
+torture_param(int, noexp_secs, NOEXP_SECS_DEFAULT,
+	      "Time to suppress/enable expedited GPs (s), 0 to disable");
 torture_param(int, nreaders, -1, "Number of RCU reader threads");
 torture_param(int, object_debug, 0,
 	     "Enable debug-object double call_rcu() testing");
@@ -192,6 +199,8 @@ static u64 notrace rcu_trace_clock_local(void)
 }
 #endif /* #else #ifdef CONFIG_RCU_TRACE */
 
+static unsigned long rcutorture_noexp;
+
 static unsigned long boost_starttime;	/* jiffies of next boost test start. */
 static DEFINE_MUTEX(boost_mutex);	/* protect setting boost_starttime */
 					/*  and boost task create/destroy. */
@@ -894,6 +903,8 @@ rcu_torture_writer(void *arg)
 	bool gp_cond1 = gp_cond, gp_exp1 = gp_exp, gp_normal1 = gp_normal;
 	bool gp_sync1 = gp_sync;
 	int i;
+	int noexp_jiffies = noexp_secs * HZ;
+	unsigned long noexp_jiffies_next = jiffies - 1;
 	struct rcu_torture *rp;
 	struct rcu_torture *old_rp;
 	static DEFINE_TORTURE_RANDOM(rand);
@@ -942,6 +953,10 @@ rcu_torture_writer(void *arg)
 	do {
 		rcu_torture_writer_state = RTWS_FIXED_DELAY;
 		schedule_timeout_uninterruptible(1);
+		if (time_after(jiffies, noexp_jiffies_next)) {
+			rcutorture_noexp = jiffies + noexp_jiffies;
+			noexp_jiffies_next = rcutorture_noexp + noexp_jiffies;
+		}
 		rp = rcu_torture_alloc();
 		if (rp == NULL)
 			continue;
@@ -966,6 +981,9 @@ rcu_torture_writer(void *arg)
 				cur_ops->deferred_free(old_rp);
 				break;
 			case RTWS_EXP_SYNC:
+				if (time_before(jiffies, rcutorture_noexp) &&
+				    cur_ops->sync && gp_sync1)
+					goto noexp;
 				rcu_torture_writer_state = RTWS_EXP_SYNC;
 				cur_ops->exp_sync();
 				rcu_torture_pipe_update(old_rp);
@@ -982,6 +1000,7 @@ rcu_torture_writer(void *arg)
 				rcu_torture_pipe_update(old_rp);
 				break;
 			case RTWS_SYNC:
+noexp:
 				rcu_torture_writer_state = RTWS_SYNC;
 				cur_ops->sync();
 				rcu_torture_pipe_update(old_rp);
@@ -1036,7 +1055,8 @@ rcu_torture_fakewriter(void *arg)
 		    torture_random(&rand) % (nfakewriters * 8) == 0) {
 			cur_ops->cb_barrier();
 		} else if (gp_normal == gp_exp) {
-			if (torture_random(&rand) & 0x80)
+			if (time_before(jiffies, rcutorture_noexp) ||
+			    torture_random(&rand) & 0x80)
 				cur_ops->sync();
 			else
 				cur_ops->exp_sync();
-- 
1.8.1.5


  parent reply	other threads:[~2015-06-30 21:48 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30 21:48 [PATCH RFC tip/core/rcu 0/5] Expedited grace periods encouraging normal ones Paul E. McKenney
2015-06-30 21:48 ` [PATCH RFC tip/core/rcu 1/5] rcu: Prepare for expedited GP driving normal GP Paul E. McKenney
2015-06-30 21:48   ` [PATCH RFC tip/core/rcu 2/5] rcu: Short-circuit normal GPs via expedited GPs Paul E. McKenney
2015-07-01 10:03     ` Peter Zijlstra
2015-07-01 13:42       ` Paul E. McKenney
2015-07-01 20:59       ` Paul E. McKenney
2015-07-01 10:05     ` Peter Zijlstra
2015-07-01 13:41       ` Paul E. McKenney
2015-07-01 13:48         ` Peter Zijlstra
2015-07-01 14:03           ` Paul E. McKenney
2015-07-02 12:03             ` Peter Zijlstra
2015-07-02 14:06               ` Paul E. McKenney
2015-07-02 16:48                 ` Peter Zijlstra
2015-07-02 19:35                   ` Paul E. McKenney
2015-07-06 14:52                     ` Peter Zijlstra
2015-06-30 21:48   ` Paul E. McKenney [this message]
2015-06-30 21:48   ` [PATCH RFC tip/core/rcu 4/5] rcu: Wake grace-period kthread at end of expedited grace period Paul E. McKenney
2015-06-30 21:48   ` [PATCH RFC tip/core/rcu 5/5] rcu: Limit expedited helping to every 10 ms or every 4th GP Paul E. McKenney
2015-06-30 21:56     ` Eric Dumazet
2015-06-30 22:10       ` Paul E. McKenney
2015-07-01 10:07     ` Peter Zijlstra
2015-07-01 13:45       ` Paul E. McKenney
2015-07-01 19:30       ` Paul E. McKenney
2015-06-30 22:00 ` [PATCH RFC tip/core/rcu 0/5] Expedited grace periods encouraging normal ones josh
2015-06-30 22:12   ` Paul E. McKenney
2015-06-30 23:46     ` josh
2015-07-01  0:15       ` Paul E. McKenney
2015-07-01  0:42         ` Josh Triplett
2015-07-01  3:37           ` Paul E. McKenney
2015-07-01 10:12             ` Peter Zijlstra
2015-07-01 14:01               ` Paul E. McKenney
2015-07-01 14:08                 ` Eric Dumazet
2015-07-01 15:58                   ` Paul E. McKenney
2015-07-01 15:43             ` Josh Triplett
2015-07-01 15:59               ` Paul E. McKenney
2015-07-01 10:09       ` Peter Zijlstra
2015-07-01 10:55         ` Peter Zijlstra
2015-07-01 14:00           ` Paul E. McKenney
2015-07-01 14:17             ` Peter Zijlstra
2015-07-01 16:17               ` Paul E. McKenney
2015-07-01 17:02                 ` Peter Zijlstra
2015-07-01 20:09                   ` Paul E. McKenney
2015-07-01 21:20                     ` josh
2015-07-01 21:49                       ` Paul E. McKenney
2015-07-02  7:47                     ` Ingo Molnar
2015-07-02 13:58                       ` Paul E. McKenney
2015-07-02 18:35                         ` Ingo Molnar
2015-07-02 18:47                           ` Mathieu Desnoyers
2015-07-02 19:23                             ` Paul E. McKenney
2015-07-02 21:07                               ` Mathieu Desnoyers
2015-07-02 19:22                           ` Paul E. McKenney
2015-07-02  1:11                 ` Mike Galbraith
2015-07-02  1:34                   ` josh
2015-07-02  1:59                     ` Mike Galbraith
2015-07-02  2:18                       ` Paul E. McKenney
2015-07-02  2:50                         ` Mike Galbraith
2015-07-02  3:15                           ` 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=1435700910-9104-3-git-send-email-paulmck@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=bobby.prani@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=dvhart@linux.intel.com \
    --cc=edumazet@google.com \
    --cc=fweisbec@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.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

Powered by JetHome