diff mbox

[tip/core/rcu,14/14] rcu: Fix rcu_is_cpu_idle() #ifdef in TINY_RCU

Message ID 1339791195-26389-14-git-send-email-paulmck@linux.vnet.ibm.com
State Superseded
Headers show

Commit Message

Paul E. McKenney June 15, 2012, 8:13 p.m. UTC
From: "Paul E. McKenney" <paul.mckenney@linaro.org>

The rcu_is_cpu_idle() function is used if CONFIG_DEBUG_LOCK_ALLOC,
but TINY_RCU defines it only when CONFIG_PROVE_RCU.  This causes
build failures when CONFIG_DEBUG_LOCK_ALLOC=y but CONFIG_PROVE_RCU=n.
This commit therefore adjusts the #ifdefs for rcu_is_cpu_idle() so
that it is defined when CONFIG_DEBUG_LOCK_ALLOC=y.

Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcutiny.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Comments

Josh Triplett June 15, 2012, 9:28 p.m. UTC | #1
On Fri, Jun 15, 2012 at 01:13:15PM -0700, Paul E. McKenney wrote:
> From: "Paul E. McKenney" <paul.mckenney@linaro.org>
> 
> The rcu_is_cpu_idle() function is used if CONFIG_DEBUG_LOCK_ALLOC,
> but TINY_RCU defines it only when CONFIG_PROVE_RCU.  This causes
> build failures when CONFIG_DEBUG_LOCK_ALLOC=y but CONFIG_PROVE_RCU=n.
> This commit therefore adjusts the #ifdefs for rcu_is_cpu_idle() so
> that it is defined when CONFIG_DEBUG_LOCK_ALLOC=y.
> 
> Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

Given that an earlier patch in this series makes rcupdate.h
unconditionally prototype rcu_is_cpu_idle, shouldn't rcutiny.c define it
unconditionally?  (And do so before the earlier patch in this series
makes it available unconditionally?)

- Josh Triplett

>  kernel/rcutiny.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/rcutiny.c b/kernel/rcutiny.c
> index 37a5444..547b1fe 100644
> --- a/kernel/rcutiny.c
> +++ b/kernel/rcutiny.c
> @@ -172,7 +172,7 @@ void rcu_irq_enter(void)
>  	local_irq_restore(flags);
>  }
>  
> -#ifdef CONFIG_PROVE_RCU
> +#ifdef CONFIG_DEBUG_LOCK_ALLOC
>  
>  /*
>   * Test whether RCU thinks that the current CPU is idle.
> @@ -183,7 +183,7 @@ int rcu_is_cpu_idle(void)
>  }
>  EXPORT_SYMBOL(rcu_is_cpu_idle);
>  
> -#endif /* #ifdef CONFIG_PROVE_RCU */
> +#endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
>  
>  /*
>   * Test whether the current CPU was interrupted from idle.  Nested
> -- 
> 1.7.8
>
Paul E. McKenney June 15, 2012, 10:57 p.m. UTC | #2
On Fri, Jun 15, 2012 at 02:28:28PM -0700, Josh Triplett wrote:
> On Fri, Jun 15, 2012 at 01:13:15PM -0700, Paul E. McKenney wrote:
> > From: "Paul E. McKenney" <paul.mckenney@linaro.org>
> > 
> > The rcu_is_cpu_idle() function is used if CONFIG_DEBUG_LOCK_ALLOC,
> > but TINY_RCU defines it only when CONFIG_PROVE_RCU.  This causes
> > build failures when CONFIG_DEBUG_LOCK_ALLOC=y but CONFIG_PROVE_RCU=n.
> > This commit therefore adjusts the #ifdefs for rcu_is_cpu_idle() so
> > that it is defined when CONFIG_DEBUG_LOCK_ALLOC=y.
> > 
> > Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
> > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> 
> Given that an earlier patch in this series makes rcupdate.h
> unconditionally prototype rcu_is_cpu_idle, shouldn't rcutiny.c define it
> unconditionally?  (And do so before the earlier patch in this series
> makes it available unconditionally?)

Or update that earlier patch so that it keeps rcu_is_cpu_idle() under
#ifdef CONFIG_DEBUG_LOCK_ALLOC.  Either way, good catch!

Hmmm...  I want it under CONFIG_DEBUG_LOCK_ALLOC for TINY_RCU (memory
footprint and all that), but unconditional for TREE_RCU.  That can
be arranged...

						Thanx, Paul

> - Josh Triplett
> 
> >  kernel/rcutiny.c |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/kernel/rcutiny.c b/kernel/rcutiny.c
> > index 37a5444..547b1fe 100644
> > --- a/kernel/rcutiny.c
> > +++ b/kernel/rcutiny.c
> > @@ -172,7 +172,7 @@ void rcu_irq_enter(void)
> >  	local_irq_restore(flags);
> >  }
> >  
> > -#ifdef CONFIG_PROVE_RCU
> > +#ifdef CONFIG_DEBUG_LOCK_ALLOC
> >  
> >  /*
> >   * Test whether RCU thinks that the current CPU is idle.
> > @@ -183,7 +183,7 @@ int rcu_is_cpu_idle(void)
> >  }
> >  EXPORT_SYMBOL(rcu_is_cpu_idle);
> >  
> > -#endif /* #ifdef CONFIG_PROVE_RCU */
> > +#endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
> >  
> >  /*
> >   * Test whether the current CPU was interrupted from idle.  Nested
> > -- 
> > 1.7.8
> > 
>
Josh Triplett June 15, 2012, 11:05 p.m. UTC | #3
On Fri, Jun 15, 2012 at 03:57:49PM -0700, Paul E. McKenney wrote:
> On Fri, Jun 15, 2012 at 02:28:28PM -0700, Josh Triplett wrote:
> > On Fri, Jun 15, 2012 at 01:13:15PM -0700, Paul E. McKenney wrote:
> > > From: "Paul E. McKenney" <paul.mckenney@linaro.org>
> > > 
> > > The rcu_is_cpu_idle() function is used if CONFIG_DEBUG_LOCK_ALLOC,
> > > but TINY_RCU defines it only when CONFIG_PROVE_RCU.  This causes
> > > build failures when CONFIG_DEBUG_LOCK_ALLOC=y but CONFIG_PROVE_RCU=n.
> > > This commit therefore adjusts the #ifdefs for rcu_is_cpu_idle() so
> > > that it is defined when CONFIG_DEBUG_LOCK_ALLOC=y.
> > > 
> > > Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
> > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > 
> > Given that an earlier patch in this series makes rcupdate.h
> > unconditionally prototype rcu_is_cpu_idle, shouldn't rcutiny.c define it
> > unconditionally?  (And do so before the earlier patch in this series
> > makes it available unconditionally?)
> 
> Or update that earlier patch so that it keeps rcu_is_cpu_idle() under
> #ifdef CONFIG_DEBUG_LOCK_ALLOC.  Either way, good catch!
> 
> Hmmm...  I want it under CONFIG_DEBUG_LOCK_ALLOC for TINY_RCU (memory
> footprint and all that), but unconditional for TREE_RCU.  That can
> be arranged...

Seems reasonable to me, as long as the availability of the prototype at
compile time always matches the availability of the function at link
time.

- Josh Triplett
diff mbox

Patch

diff --git a/kernel/rcutiny.c b/kernel/rcutiny.c
index 37a5444..547b1fe 100644
--- a/kernel/rcutiny.c
+++ b/kernel/rcutiny.c
@@ -172,7 +172,7 @@  void rcu_irq_enter(void)
 	local_irq_restore(flags);
 }
 
-#ifdef CONFIG_PROVE_RCU
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
 
 /*
  * Test whether RCU thinks that the current CPU is idle.
@@ -183,7 +183,7 @@  int rcu_is_cpu_idle(void)
 }
 EXPORT_SYMBOL(rcu_is_cpu_idle);
 
-#endif /* #ifdef CONFIG_PROVE_RCU */
+#endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
 
 /*
  * Test whether the current CPU was interrupted from idle.  Nested