Subject: Re: [PATCH] net: disable preemption before call smp_processor_id()

From: "Paul E. McKenney" <[email-masked]>
Date: Sat, 7 Aug 2010 21:57:51 -0700

On Sat, Aug 07, 2010 at 08:37:00PM -0700, David Miller wrote:
> From: Changli Gao <[email-masked]>
> Date: Sat,  7 Aug 2010 17:26:02 +0800
> 
> > Although netif_rx() isn't expected to be called in process context with
> > preemption enabled, it'd better handle this case. And this is why get_cpu()
> > is used in the non-RPS #ifdef branch. If tree RCU is selected,
> > rcu_read_lock() won't disable preemption, so preempt_disable() should be
> > called explictly.
> > 
> > Signed-off-by: Changli Gao <[email-masked]>
> 
> Applied, thanks Changli.
> 
> Paul, perhaps the comment above rcu_read_lock()'s definition should
> be updated in rcupdate.h?  It says blocking is not allowed inside
> of a read side critical section, but obviously with tree-rcu that
> is not the case.
> 
> Either we should add a mention of tree-rcu's semantics or just remote
> this part of the comment altogether.

Good point, that last sentence is quite obsolete.  It also survived a
recent cleanup.  :-/

If I cover preemptible RCU's semantics, a first cut comes out like this:

 * In non-preemptible RCU implementations (TREE_RCU and TINY_RCU), it
 * is illegal to block while in an RCU read-side critical section.  In
 * preemptible RCU implementations (TREE_PREEMPT_RCU and TINY_PREEMPT_RCU)
 * in CONFIG_PREEMPT kernel builds, RCU read-side critical sections may
 * be preempted, but explicit blocking is illegal.  Finally, in preemptible
 * RCU implementations in real-time (CONFIG_PREEMPT_RT) kernel builds,
 * RCU read-side critical sections may be preempted and they may also
 * block, but only when acquiring spinlocks that are subject to priority
 * inheritance.

Does that seem reasonable?

							Thanx, Paul