All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Gautham R Shenoy <ego@in.ibm.com>
Cc: linux-kernel@vger.kernel.org, cl@linux-foundation.org,
	mingo@elte.hu, akpm@linux-foundation.org,
	manfred@colorfullife.com, dipankar@in.ibm.com,
	josht@linux.vnet.ibm.com, schamp@sgi.com, niv@us.ibm.com,
	dvhltc@us.ibm.com, laijs@cn.fujitsu.com, rostedt@goodmis.org,
	peterz@infradead.org, penberg@cs.helsinki.fi,
	andi@firstfloor.org, tglx@linutronix.de
Subject: Re: [PATCH, RFC] v7 scalable classic RCU implementation
Date: Fri, 17 Oct 2008 08:46:20 -0700	[thread overview]
Message-ID: <20081017154620.GH6706@linux.vnet.ibm.com> (raw)
In-Reply-To: <20081017153513.GC23228@in.ibm.com>

On Fri, Oct 17, 2008 at 09:05:13PM +0530, Gautham R Shenoy wrote:
> On Fri, Oct 17, 2008 at 02:04:52PM +0530, Gautham R Shenoy wrote:
> > On Fri, Oct 10, 2008 at 09:09:30AM -0700, Paul E. McKenney wrote:
> > > Hello!
> > Hi Paul,
> > 
> > Looks interesting. Couple of minor nits. Comments interspersed. Search for "=>"
> Search is too tedius, even for me. Trimming it down.

The "/" command in "vi" works pretty well for me.  ;-)

These are the same as the ones in your earlier note, correct?

							Thanx, Paul

> > > +};
> > > +
> > > +/* Values for signaled field in struc rcu_data. */
> 				   ^^^^^^^^^^^^^^^^^^
> 			   should be struct rcu_state.
> > > +#define RCU_SAVE_DYNTICK	0	/* Need to scan dyntick state. */
> > > +#define RCU_FORCE_QS		1	/* Need to force quiescent state. */
> > > +#ifdef CONFIG_NO_HZ
> > > +#define RCU_SIGNAL_INIT		RCU_SAVE_DYNTICK
> > > +#else /* #ifdef CONFIG_NO_HZ */
> > > +#define RCU_SIGNAL_INIT		RCU_FORCE_QS
> > > +#endif /* #else #ifdef CONFIG_NO_HZ */
> > > +
> > > +}
> > > +
> 
> 
> 
> > > +#ifdef CONFIG_SMP
> > > +
> > > +/*
> > > + * If the specified CPU is offline, tell the caller that it is in
> > > + * a quiescent state.  Otherwise, whack it with a reschedule IPI.
> > > + * Grace periods can end up waiting on an offline CPU when that
> > > + * CPU is in the process of coming online -- it will be added to the
> > > + * rcu_node bitmasks before it actually makes it online.
> 
>         This can also happen when a CPU has just gone offline,
>         but RCU hasn't yet marked it as offline. However, it's impact
>         on delaying the grace period may not be high as in the
>         CPU-online case.
> > 
> > > + * Because this
> > > + * race is quite rare, we check for it after detecting that the grace
> > > + * period has been delayed rather than checking each and every CPU
> > > + * each and every time we start a new grace period.
> > > + */
> > > +static int rcu_implicit_offline_qs(struct rcu_data *rdp)
> > > +{
> > > +	/*
> > > +	 * If the CPU is offline, it is in a quiescent state.  We can
> > > +	 * trust its state not to change because interrupts are disabled.
> > > +	 */
> > > +	if (cpu_is_offline(rdp->cpu)) {
> > > +		rdp->offline_fqs++;
> > > +		return 1;
> > > +	}
> > > +
> > > +	/* The CPU is online, so send it a reschedule IPI. */
> > > +	if (rdp->cpu != smp_processor_id())
> 
> 	This check is safe here since this callpath is invoked
> 	from a softirq, and thus the system cannot do a stop_machine()
> 	as yet. This implies that the cpu in question cannot go offline
> 	until we're done.
> 
> > > +		smp_send_reschedule(rdp->cpu);
> > > +	else
> > > +		set_need_resched();
> > > +	rdp->resched_ipi++;
> > > +	return 0;
> > > +}
> > > +
> > > +#endif /* #ifdef CONFIG_SMP */
> > > +/*
> 
> > > + * Record the specified "completed" value, which is later used to validate
> > > + * dynticks counter manipulations.  Specify "rsp->complete - 1" to
> 					       ^^^^^^^^^^^^^^^^^^^
> 					       "rsp->completed - 1" ?
> 
> 
> > > + * unconditionally invalidate any future dynticks manipulations (which is
> > > + * useful at the beginning of a grace period).
> 
> 
> > > +
> > > +static void print_other_cpu_stall(struct rcu_state *rsp)
> > > +{
> > > +	int cpu;
> > > +	long delta;
> > > +	unsigned long flags;
> > > +	struct rcu_node *rnp = rcu_get_root(rsp);
> > > +	struct rcu_node *rnp_cur = rsp->level[NUM_RCU_LVLS - 1];
> > > +	struct rcu_node *rnp_end = &rsp->node[NUM_RCU_NODES];
> > > +
> > > +	/* Only let one CPU complain about others per time interval. */
> > > +
> > > +	spin_lock_irqsave(&rnp->lock, flags);
> > > +	delta = jiffies - rsp->jiffies_stall;
> > > +	if (delta < RCU_STALL_RAT_DELAY || rsp->gpnum != rsp->completed) {
> 	----------------> [1]
> 	See comment in check_cpu_stall()
> 
> > > +		spin_unlock_irqrestore(&rnp->lock, flags);
> > > +		return;
> > > +	}
> > > +	rsp->jiffies_stall = jiffies + RCU_SECONDS_TILL_STALL_RECHECK;
> > > +	spin_unlock_irqrestore(&rnp->lock, flags);
> > > +
> > > +	/* OK, time to rat on our buddy... */
> > > +
> > > +	printk(KERN_ERR "RCU detected CPU stalls:");
> > > +	for (; rnp_cur < rnp_end; rnp_cur++) {
> > > +		if (rnp_cur->qsmask == 0)
> > > +			continue;
> > > +		for (cpu = 0; cpu <= rnp_cur->grphi - rnp_cur->grplo; cpu++)
> > > +			if (rnp_cur->qsmask & (1UL << cpu))
> > > +				printk(" %d", rnp_cur->grplo + cpu);
> > > +	}
> > > +	printk(" (detected by %d, t=%ld jiffies)\n",
> > > +	       smp_processor_id(), (long)(jiffies - rsp->gp_start));
> > > +	force_quiescent_state(rsp, 0);  /* Kick them all. */
> > > +}
> > > +
> > > +static void print_cpu_stall(struct rcu_state *rsp)
> > > +{
> > > +	unsigned long flags;
> > > +	struct rcu_node *rnp = rcu_get_root(rsp);
> > > +
> > > +	printk(KERN_ERR "RCU detected CPU %d stall (t=%lu jiffies)\n",
> > > +			smp_processor_id(), jiffies - rsp->gp_start);
> > > +	dump_stack();
> > > +	spin_lock_irqsave(&rnp->lock, flags);
> > > +	if ((long)(jiffies - rsp->jiffies_stall) >= 0)
> > > +		rsp->jiffies_stall =
> > > +			jiffies + RCU_SECONDS_TILL_STALL_RECHECK;
> > > +	spin_unlock_irqrestore(&rnp->lock, flags);
> > > +	set_need_resched();  /* kick ourselves to get things going. */
> > > +}
> > > +
> > > +static void check_cpu_stall(struct rcu_state *rsp, struct rcu_data *rdp)
> > > +{
> > > +	long delta;
> > > +	struct rcu_node *rnp;
> > > +
> > > +	delta = jiffies - rsp->jiffies_stall;
> > > +	rnp = rdp->mynode;
> > > +	if ((rnp->qsmask & rdp->grpmask) && delta >= 0) {
> > > +
> > > +		/* We haven't checked in, so go dump stack. */
> > > +		print_cpu_stall(rsp);
> > > +
> > > +	} else if (rsp->gpnum != rsp->completed &&
> > > +		   delta >= RCU_STALL_RAT_DELAY) {
> > 
> 		If this condition is true, then,
> 		rsp->gpnum != rsp->completed. Hence, we will always enter
> 		the if() condition in print_other_cpu_stall() at
> 		[1] (See above), and return without ratting our buddy.
> 
> 		That defeats the purpose of the stall check or I am
> 		missing the obvious, which is quite possible :-)
> > > +
> > > +		/* They had two time units to dump stack, so complain. */
> > > +		print_other_cpu_stall(rsp);
> > > +	}
> > > +}
> > > +
> > > +#else /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
> > > +
> > > +static void record_gp_stall_check_time(struct rcu_state *rsp)
> > > +{
> > > +}
> 
> 
> > > +
> > > +static void __cpuinit rcu_online_cpu(int cpu)
> > > +{
> > > +#ifdef CONFIG_NO_HZ
> > > +	struct rcu_dynticks *rdtp = &per_cpu(rcu_dynticks, cpu);
> > > +
> > > +	rdtp->dynticks_nesting = 1;
> > > +	rdtp->dynticks |= 1; 	/* need consecutive #s even for hotplug. */
> > > +	rdtp->dynticks_nmi = (rdtp->dynticks + 1) & ~0x1;
> 	rdtp->dynticks is odd. Hence rdtp->dynticks + 1 should be even.
> 	Why is the additional & ~0x1 ?
> 
> 
> > 
> > > +#endif /* #ifdef CONFIG_NO_HZ */
> > > +	rcu_init_percpu_data(cpu, &rcu_state);
> -- 
> Thanks and Regards
> gautham

  reply	other threads:[~2008-10-17 15:46 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-21 23:43 [PATCH, RFC, tip/core/rcu] scalable classic RCU implementation Paul E. McKenney
2008-08-22  4:37 ` Ingo Molnar
2008-08-22 13:47   ` Paul E. McKenney
2008-08-22 17:22     ` Paul E. McKenney
2008-08-22 18:16       ` Josh Triplett
2008-08-23 16:07       ` Ingo Molnar
2008-08-24  2:44         ` Paul E. McKenney
2008-08-22 23:29 ` Josh Triplett
2008-08-23  1:53   ` Paul E. McKenney
2008-08-25 22:02     ` Josh Triplett
2008-08-26 16:05       ` Paul E. McKenney
2008-08-27  0:38         ` Josh Triplett
2008-08-27 18:34           ` Paul E. McKenney
2008-08-27 20:23             ` Josh Triplett
2008-08-27 20:41               ` Paul E. McKenney
2008-08-25 10:34   ` Peter Zijlstra
2008-08-25 15:16     ` Paul E. McKenney
2008-08-25 15:26       ` Peter Zijlstra
2008-08-27 18:28         ` Paul E. McKenney
2008-08-24  8:08 ` Manfred Spraul
2008-08-24 16:32   ` Paul E. McKenney
2008-08-24 18:25     ` Manfred Spraul
2008-08-24 21:19       ` Paul E. McKenney
2008-08-25  0:07 ` [PATCH, RFC, tip/core/rcu] v2 " Paul E. McKenney
2008-08-30  0:49   ` [PATCH, RFC, tip/core/rcu] v3 " Paul E. McKenney
2008-08-30  9:33     ` Peter Zijlstra
2008-08-30 14:10       ` Paul E. McKenney
2008-08-30 15:40         ` Peter Zijlstra
2008-08-30 19:38           ` Paul E. McKenney
2008-09-02 13:26           ` Mathieu Desnoyers
2008-09-02 13:41             ` Peter Zijlstra
2008-09-02 14:55               ` Paul E. McKenney
2008-08-30  9:58     ` Lai Jiangshan
2008-08-30 13:32       ` Manfred Spraul
2008-08-30 14:34         ` Paul E. McKenney
2008-08-31 10:58           ` Manfred Spraul
2008-08-31 17:20             ` Paul E. McKenney
2008-08-31 17:45               ` Manfred Spraul
2008-08-31 17:55                 ` Paul E. McKenney
2008-08-31 18:18                   ` Manfred Spraul
2008-08-31 19:23                     ` Paul E. McKenney
2008-08-30 14:29       ` Paul E. McKenney
2008-09-01  9:38     ` Andi Kleen
2008-09-02  1:05       ` Paul E. McKenney
2008-09-02  6:18         ` Andi Kleen
2008-09-05 15:29     ` [PATCH, RFC] v4 " Paul E. McKenney
2008-09-05 19:33       ` Andrew Morton
2008-09-05 23:04         ` Paul E. McKenney
2008-09-05 23:52           ` Andrew Morton
2008-09-06  4:16             ` Paul E. McKenney
2008-09-06 16:37       ` Manfred Spraul
2008-09-07 17:25         ` Paul E. McKenney
2008-09-07 10:18       ` [RFC, PATCH] Add a CPU_STARTING notifier (was: Re: [PATCH, RFC] v4 scalable classic RCU implementation) Manfred Spraul
2008-09-07 11:07         ` Andi Kleen
2008-09-07 19:46         ` Paul E. McKenney
2008-09-15 16:02       ` [PATCH, RFC] v4 scalable classic RCU implementation Paul E. McKenney
2008-09-16 16:52         ` Manfred Spraul
2008-09-16 17:30           ` Paul E. McKenney
2008-09-16 17:48             ` Manfred Spraul
2008-09-16 18:22               ` Paul E. McKenney
2008-09-21 11:09               ` Manfred Spraul
2008-09-21 21:14                 ` Paul E. McKenney
2008-09-23 23:53         ` [PATCH, RFC] v6 " Paul E. McKenney
2008-09-25  7:26           ` Ingo Molnar
2008-09-25 14:05             ` Paul E. McKenney
2008-09-25  7:29           ` Ingo Molnar
2008-09-25 14:18             ` Paul E. McKenney
2008-10-10 16:09           ` [PATCH, RFC] v7 " Paul E. McKenney
2008-10-12 15:52             ` Manfred Spraul
2008-10-12 22:46               ` Paul E. McKenney
2008-10-13 18:03                 ` Manfred Spraul
2008-10-15  1:11                   ` Paul E. McKenney
2008-10-15  8:13                     ` Manfred Spraul
2008-10-15 15:26                       ` Paul E. McKenney
2008-10-22 18:41                         ` Manfred Spraul
2008-10-22 21:02                           ` Paul E. McKenney
2008-10-22 21:24                             ` Manfred Spraul
2008-10-27 16:45                               ` Paul E. McKenney
2008-10-27 19:48                                 ` Manfred Spraul
2008-10-27 23:52                                   ` Paul E. McKenney
2008-10-28  5:30                                     ` Manfred Spraul
2008-10-28 15:17                                       ` Paul E. McKenney
2008-10-28 17:21                                         ` Manfred Spraul
2008-10-28 17:35                                           ` Paul E. McKenney
2008-10-17  8:34             ` Gautham R Shenoy
2008-10-17 15:35               ` Gautham R Shenoy
2008-10-17 15:46                 ` Paul E. McKenney [this message]
2008-10-17 15:43               ` Paul E. McKenney
2008-12-08 18:42               ` Paul E. McKenney
2008-11-02 20:10             ` Manfred Spraul
2008-11-03 20:33               ` Paul E. McKenney
2008-11-05 19:48                 ` Manfred Spraul
2008-11-05 21:27                   ` Paul E. McKenney
2008-11-15 23:20             ` [PATCH, RFC] v8 " 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=20081017154620.GH6706@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=cl@linux-foundation.org \
    --cc=dipankar@in.ibm.com \
    --cc=dvhltc@us.ibm.com \
    --cc=ego@in.ibm.com \
    --cc=josht@linux.vnet.ibm.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.com \
    --cc=mingo@elte.hu \
    --cc=niv@us.ibm.com \
    --cc=penberg@cs.helsinki.fi \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=schamp@sgi.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.