linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	xen-devel@lists.xensource.com,
	julie Sullivan <kernelmail.jms@gmail.com>,
	linux-kernel@vger.kernel.org, chengxu@linux.vnet.ibm.com
Subject: Re: PROBLEM: 3.0-rc kernels unbootable since -rc3
Date: Tue, 12 Jul 2011 13:46:20 -0700	[thread overview]
Message-ID: <20110712204620.GL2326@linux.vnet.ibm.com> (raw)
In-Reply-To: <20110712195731.GB20811@dumpdata.com>

On Tue, Jul 12, 2011 at 03:57:32PM -0400, Konrad Rzeszutek Wilk wrote:
> On Tue, Jul 12, 2011 at 09:10:36PM +0200, Peter Zijlstra wrote:
> > On Tue, 2011-07-12 at 11:59 -0700, Paul E. McKenney wrote:
> > > OK, so the infinite loop in task_waking_fair() happens even if RCU callbacks
> > > are deferred until after the scheduler is fully initialized.  Sounds like
> > > one for the scheduler guys.  ;-) 
> > 
> > https://lkml.org/lkml/2011/7/12/150
> 
> Such a simple patch. And yes, it fixes the issue. You can add
> Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> if it hasn't yet
> showed up in Ingo's tree.
> 
> Paul, thanks for help on this and providing ideas to test!

Konrad, thank you for all the testing!

Julie, if you apply Peter's patch, do you also need the patch shown
below?

Ravi, could you please retest with the patch below as well?

							Thanx, Paul

------------------------------------------------------------------------

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 7e59ffb..ba06207 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -84,9 +84,32 @@ DEFINE_PER_CPU(struct rcu_data, rcu_bh_data);
 
 static struct rcu_state *rcu_state;
 
+/*
+ * The rcu_scheduler_active variable transitions from zero to one just
+ * before the first task is spawned.  So when this variable is zero, RCU
+ * can assume that there is but one task, allowing RCU to (for example)
+ * optimized synchronize_sched() to a simple barrier().  When this variable
+ * is one, RCU must actually do all the hard work required to detect real
+ * grace periods.  This variable is also used to suppress boot-time false
+ * positives from lockdep-RCU error checking.
+ */
 int rcu_scheduler_active __read_mostly;
 EXPORT_SYMBOL_GPL(rcu_scheduler_active);
 
+/*
+ * The rcu_scheduler_fully_active variable transitions from zero to one
+ * during the early_initcall() processing, which is after the scheduler
+ * is capable of creating new tasks.  So RCU processing (for example,
+ * creating tasks for RCU priority boosting) must be delayed until after
+ * rcu_scheduler_fully_active transitions from zero to one.  We also
+ * currently delay invocation of any RCU callbacks until after this point.
+ *
+ * It might later prove better for people registering RCU callbacks during
+ * early boot to take responsibility for these callbacks, but one step at
+ * a time.
+ */
+static int rcu_scheduler_fully_active __read_mostly;
+
 #ifdef CONFIG_RCU_BOOST
 
 /*
@@ -98,7 +121,6 @@ DEFINE_PER_CPU(unsigned int, rcu_cpu_kthread_status);
 DEFINE_PER_CPU(int, rcu_cpu_kthread_cpu);
 DEFINE_PER_CPU(unsigned int, rcu_cpu_kthread_loops);
 DEFINE_PER_CPU(char, rcu_cpu_has_work);
-static char rcu_kthreads_spawnable;
 
 #endif /* #ifdef CONFIG_RCU_BOOST */
 
@@ -1467,6 +1489,8 @@ static void rcu_process_callbacks(struct softirq_action *unused)
  */
 static void invoke_rcu_callbacks(struct rcu_state *rsp, struct rcu_data *rdp)
 {
+	if (unlikely(!ACCESS_ONCE(rcu_scheduler_fully_active)))
+		return;
 	if (likely(!rsp->boost)) {
 		rcu_do_batch(rsp, rdp);
 		return;
diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h
index 14dc7dd..75113cb 100644
--- a/kernel/rcutree_plugin.h
+++ b/kernel/rcutree_plugin.h
@@ -1532,7 +1532,7 @@ static int __cpuinit rcu_spawn_one_cpu_kthread(int cpu)
 	struct sched_param sp;
 	struct task_struct *t;
 
-	if (!rcu_kthreads_spawnable ||
+	if (!rcu_scheduler_fully_active ||
 	    per_cpu(rcu_cpu_kthread_task, cpu) != NULL)
 		return 0;
 	t = kthread_create(rcu_cpu_kthread, (void *)(long)cpu, "rcuc%d", cpu);
@@ -1639,7 +1639,7 @@ static int __cpuinit rcu_spawn_one_node_kthread(struct rcu_state *rsp,
 	struct sched_param sp;
 	struct task_struct *t;
 
-	if (!rcu_kthreads_spawnable ||
+	if (!rcu_scheduler_fully_active ||
 	    rnp->qsmaskinit == 0)
 		return 0;
 	if (rnp->node_kthread_task == NULL) {
@@ -1665,7 +1665,7 @@ static int __init rcu_spawn_kthreads(void)
 	int cpu;
 	struct rcu_node *rnp;
 
-	rcu_kthreads_spawnable = 1;
+	rcu_scheduler_fully_active = 1;
 	for_each_possible_cpu(cpu) {
 		per_cpu(rcu_cpu_has_work, cpu) = 0;
 		if (cpu_online(cpu))
@@ -1687,7 +1687,7 @@ static void __cpuinit rcu_prepare_kthreads(int cpu)
 	struct rcu_node *rnp = rdp->mynode;
 
 	/* Fire up the incoming CPU's kthread and leaf rcu_node kthread. */
-	if (rcu_kthreads_spawnable) {
+	if (rcu_scheduler_fully_active) {
 		(void)rcu_spawn_one_cpu_kthread(cpu);
 		if (rnp->node_kthread_task == NULL)
 			(void)rcu_spawn_one_node_kthread(rcu_state, rnp);
@@ -1726,6 +1726,13 @@ static void rcu_cpu_kthread_setrt(int cpu, int to_rt)
 {
 }
 
+static int __init rcu_scheduler_really_started(void)
+{
+	rcu_scheduler_fully_active = 1;
+	return 0;
+}
+early_initcall(rcu_scheduler_really_started);
+
 static void __cpuinit rcu_prepare_kthreads(int cpu)
 {
 }

  reply	other threads:[~2011-07-12 20:46 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-06 21:10 PROBLEM: 3.0-rc kernels unbootable since -rc3 julie Sullivan
2011-07-06 21:23 ` Paul E. McKenney
2011-07-07 19:31   ` Paul E. McKenney
2011-07-07 19:47   ` julie Sullivan
2011-07-07 19:58     ` Paul E. McKenney
2011-07-07 20:28       ` julie Sullivan
2011-07-07 20:47       ` julie Sullivan
2011-07-08  0:29         ` Paul E. McKenney
2011-07-09 10:09           ` Paul E. McKenney
2011-07-10  0:45             ` julie Sullivan
2011-07-10  3:25               ` Paul E. McKenney
2011-07-10 16:38                 ` julie Sullivan
2011-07-10 17:16                   ` Paul E. McKenney
2011-07-10 17:35                     ` Paul E. McKenney
2011-07-10 20:30                       ` julie Sullivan
2011-07-10 21:46                         ` Paul E. McKenney
2011-07-10 21:50                           ` julie Sullivan
2011-07-10 23:14                             ` Paul E. McKenney
2011-07-11 16:24                               ` Konrad Rzeszutek Wilk
2011-07-11 17:13                                 ` Paul E. McKenney
2011-07-11 19:30                                   ` Konrad Rzeszutek Wilk
2011-07-11 20:15                                     ` Paul E. McKenney
2011-07-11 21:09                                       ` Konrad Rzeszutek Wilk
2011-07-12 10:55                                         ` Paul E. McKenney
2011-07-12 14:12                                           ` Konrad Rzeszutek Wilk
2011-07-12 14:49                                             ` Paul E. McKenney
2011-07-12 15:07                                               ` Paul E. McKenney
2011-07-12 15:15                                               ` Paul E. McKenney
2011-07-12 15:22                                                 ` Paul E. McKenney
2011-07-12 16:32                                                   ` PROBLEM: 3.0-rc kernels unbootable since -rc3 - under Xen, 32-bit guest only Konrad Rzeszutek Wilk
2011-07-12 16:46                                                     ` Paul E. McKenney
2011-07-12 16:03                                               ` PROBLEM: 3.0-rc kernels unbootable since -rc3 Konrad Rzeszutek Wilk
2011-07-12 16:39                                                 ` Paul E. McKenney
2011-07-12 18:01                                                   ` Konrad Rzeszutek Wilk
2011-07-12 18:59                                                     ` Paul E. McKenney
2011-07-12 19:07                                                       ` Konrad Rzeszutek Wilk
2011-07-12 20:52                                                         ` Paul E. McKenney
2011-07-12 19:10                                                       ` Peter Zijlstra
2011-07-12 19:57                                                         ` Konrad Rzeszutek Wilk
2011-07-12 20:46                                                           ` Paul E. McKenney [this message]
2011-07-12 21:04                                                             ` Julie Sullivan
2011-07-12 21:07                                                               ` Paul E. McKenney
2011-07-12 20:05                                                         ` Paul E. McKenney
2011-07-12  6:33                                     ` [Xen-devel] " Sander Eikelenboom
2011-07-12 14:05                                       ` Paul E. McKenney
     [not found]                               ` <CAAVPGOMSprJSkzziH6hJv9PweOONzsMaRZEK2ZSrV3xFBReTPw@mail.gmail.com>
     [not found]                                 ` <20110711214301.GP2245@linux.vnet.ibm.com>
2011-07-12 21:15                                   ` Julie Sullivan
2011-07-12 21:29                                     ` Paul E. McKenney
2011-07-12 21:35                                       ` Julie Sullivan
2011-07-12 21:49                                       ` Julie Sullivan
2011-07-12 22:00                                         ` Paul E. McKenney
2011-07-13  7:18                                           ` RKK
2011-07-13 15:47                                             ` Paul E. McKenney
2011-07-13 20:57                                           ` Julie Sullivan
2011-07-13 21:23                                             ` Paul E. McKenney
2011-07-07 17:28 ` julie Sullivan

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=20110712204620.GL2326@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=chengxu@linux.vnet.ibm.com \
    --cc=jeremy@goop.org \
    --cc=kernelmail.jms@gmail.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=xen-devel@lists.xensource.com \
    /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).