diff mbox

[tip/core/rcu,13/15] rcu: Move TINY_PREEMPT_RCU away from raw_local_irq_save()

Message ID 1346352988-32444-13-git-send-email-paulmck@linux.vnet.ibm.com
State Accepted
Commit 7a11e2058f02feb6884efb067f328012c318a13f
Headers show

Commit Message

Paul E. McKenney Aug. 30, 2012, 6:56 p.m. UTC
From: "Paul E. McKenney" <paul.mckenney@linaro.org>

The use of raw_local_irq_save() is unnecessary, given that local_irq_save()
really does disable interrupts.  Also, it appears to interfere with lockdep.
Therefore, this commit moves to local_irq_save().

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Tested-by: Fengguang Wu <fengguang.wu@intel.com>
---
 kernel/rcutiny_plugin.h |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

Comments

Josh Triplett Aug. 31, 2012, 6:34 p.m. UTC | #1
On Thu, Aug 30, 2012 at 11:56:26AM -0700, Paul E. McKenney wrote:
> From: "Paul E. McKenney" <paul.mckenney@linaro.org>
> 
> The use of raw_local_irq_save() is unnecessary, given that local_irq_save()
> really does disable interrupts.  Also, it appears to interfere with lockdep.
> Therefore, this commit moves to local_irq_save().

It looks like the non-raw versions also include tracing, which typically
has recursive dependency problems with RCU.  Can all of these call sites
safely call into tracing without recursing back into RCU?

- Josh Triplett

> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Tested-by: Fengguang Wu <fengguang.wu@intel.com>
> ---
>  kernel/rcutiny_plugin.h |   10 +++++-----
>  1 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/rcutiny_plugin.h b/kernel/rcutiny_plugin.h
> index 918fd1e..3d01902 100644
> --- a/kernel/rcutiny_plugin.h
> +++ b/kernel/rcutiny_plugin.h
> @@ -278,7 +278,7 @@ static int rcu_boost(void)
>  	    rcu_preempt_ctrlblk.exp_tasks == NULL)
>  		return 0;  /* Nothing to boost. */
>  
> -	raw_local_irq_save(flags);
> +	local_irq_save(flags);
>  
>  	/*
>  	 * Recheck with irqs disabled: all tasks in need of boosting
> @@ -287,7 +287,7 @@ static int rcu_boost(void)
>  	 */
>  	if (rcu_preempt_ctrlblk.boost_tasks == NULL &&
>  	    rcu_preempt_ctrlblk.exp_tasks == NULL) {
> -		raw_local_irq_restore(flags);
> +		local_irq_restore(flags);
>  		return 0;
>  	}
>  
> @@ -317,7 +317,7 @@ static int rcu_boost(void)
>  	t = container_of(tb, struct task_struct, rcu_node_entry);
>  	rt_mutex_init_proxy_locked(&mtx, t);
>  	t->rcu_boost_mutex = &mtx;
> -	raw_local_irq_restore(flags);
> +	local_irq_restore(flags);
>  	rt_mutex_lock(&mtx);
>  	rt_mutex_unlock(&mtx);  /* Keep lockdep happy. */
>  
> @@ -991,9 +991,9 @@ static void rcu_trace_sub_qlen(struct rcu_ctrlblk *rcp, int n)
>  {
>  	unsigned long flags;
>  
> -	raw_local_irq_save(flags);
> +	local_irq_save(flags);
>  	rcp->qlen -= n;
> -	raw_local_irq_restore(flags);
> +	local_irq_restore(flags);
>  }
>  
>  /*
> -- 
> 1.7.8
>
Paul E. McKenney Sept. 4, 2012, 11:03 p.m. UTC | #2
On Fri, Aug 31, 2012 at 11:34:31AM -0700, Josh Triplett wrote:
> On Thu, Aug 30, 2012 at 11:56:26AM -0700, Paul E. McKenney wrote:
> > From: "Paul E. McKenney" <paul.mckenney@linaro.org>
> > 
> > The use of raw_local_irq_save() is unnecessary, given that local_irq_save()
> > really does disable interrupts.  Also, it appears to interfere with lockdep.
> > Therefore, this commit moves to local_irq_save().
> 
> It looks like the non-raw versions also include tracing, which typically
> has recursive dependency problems with RCU.  Can all of these call sites
> safely call into tracing without recursing back into RCU?

The rcu_trace_sub_qlen() version is the most suspicious, but it is the
one that Fengguang found to be causing the problem:

	https://lkml.org/lkml/2012/8/21/551

							Thanx, Paul

> - Josh Triplett
> 
> > Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> > Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
> > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > Tested-by: Fengguang Wu <fengguang.wu@intel.com>
> > ---
> >  kernel/rcutiny_plugin.h |   10 +++++-----
> >  1 files changed, 5 insertions(+), 5 deletions(-)
> > 
> > diff --git a/kernel/rcutiny_plugin.h b/kernel/rcutiny_plugin.h
> > index 918fd1e..3d01902 100644
> > --- a/kernel/rcutiny_plugin.h
> > +++ b/kernel/rcutiny_plugin.h
> > @@ -278,7 +278,7 @@ static int rcu_boost(void)
> >  	    rcu_preempt_ctrlblk.exp_tasks == NULL)
> >  		return 0;  /* Nothing to boost. */
> >  
> > -	raw_local_irq_save(flags);
> > +	local_irq_save(flags);
> >  
> >  	/*
> >  	 * Recheck with irqs disabled: all tasks in need of boosting
> > @@ -287,7 +287,7 @@ static int rcu_boost(void)
> >  	 */
> >  	if (rcu_preempt_ctrlblk.boost_tasks == NULL &&
> >  	    rcu_preempt_ctrlblk.exp_tasks == NULL) {
> > -		raw_local_irq_restore(flags);
> > +		local_irq_restore(flags);
> >  		return 0;
> >  	}
> >  
> > @@ -317,7 +317,7 @@ static int rcu_boost(void)
> >  	t = container_of(tb, struct task_struct, rcu_node_entry);
> >  	rt_mutex_init_proxy_locked(&mtx, t);
> >  	t->rcu_boost_mutex = &mtx;
> > -	raw_local_irq_restore(flags);
> > +	local_irq_restore(flags);
> >  	rt_mutex_lock(&mtx);
> >  	rt_mutex_unlock(&mtx);  /* Keep lockdep happy. */
> >  
> > @@ -991,9 +991,9 @@ static void rcu_trace_sub_qlen(struct rcu_ctrlblk *rcp, int n)
> >  {
> >  	unsigned long flags;
> >  
> > -	raw_local_irq_save(flags);
> > +	local_irq_save(flags);
> >  	rcp->qlen -= n;
> > -	raw_local_irq_restore(flags);
> > +	local_irq_restore(flags);
> >  }
> >  
> >  /*
> > -- 
> > 1.7.8
> > 
>
diff mbox

Patch

diff --git a/kernel/rcutiny_plugin.h b/kernel/rcutiny_plugin.h
index 918fd1e..3d01902 100644
--- a/kernel/rcutiny_plugin.h
+++ b/kernel/rcutiny_plugin.h
@@ -278,7 +278,7 @@  static int rcu_boost(void)
 	    rcu_preempt_ctrlblk.exp_tasks == NULL)
 		return 0;  /* Nothing to boost. */
 
-	raw_local_irq_save(flags);
+	local_irq_save(flags);
 
 	/*
 	 * Recheck with irqs disabled: all tasks in need of boosting
@@ -287,7 +287,7 @@  static int rcu_boost(void)
 	 */
 	if (rcu_preempt_ctrlblk.boost_tasks == NULL &&
 	    rcu_preempt_ctrlblk.exp_tasks == NULL) {
-		raw_local_irq_restore(flags);
+		local_irq_restore(flags);
 		return 0;
 	}
 
@@ -317,7 +317,7 @@  static int rcu_boost(void)
 	t = container_of(tb, struct task_struct, rcu_node_entry);
 	rt_mutex_init_proxy_locked(&mtx, t);
 	t->rcu_boost_mutex = &mtx;
-	raw_local_irq_restore(flags);
+	local_irq_restore(flags);
 	rt_mutex_lock(&mtx);
 	rt_mutex_unlock(&mtx);  /* Keep lockdep happy. */
 
@@ -991,9 +991,9 @@  static void rcu_trace_sub_qlen(struct rcu_ctrlblk *rcp, int n)
 {
 	unsigned long flags;
 
-	raw_local_irq_save(flags);
+	local_irq_save(flags);
 	rcp->qlen -= n;
-	raw_local_irq_restore(flags);
+	local_irq_restore(flags);
 }
 
 /*