public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: David Howells <dhowells@redhat.com>
Cc: torvalds@osdl.org, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org,
	Dipankar Sarma <dipankar@in.ibm.com>
Subject: Re: [PATCH 5/5] RCU: Don't try and predeclare inline funcs as it upsets some versions of gcc
Date: Fri, 17 Apr 2009 16:41:14 -0700	[thread overview]
Message-ID: <20090417234114.GF6742@linux.vnet.ibm.com> (raw)
In-Reply-To: <20090415183501.11029.81607.stgit@warthog.procyon.org.uk>

On Wed, Apr 15, 2009 at 07:35:01PM +0100, David Howells wrote:
> Don't try and predeclare inline funcs like this:
> 
> 	static inline void wait_migrated_callbacks(void)
> 	...
> 	static void _rcu_barrier(enum rcu_barrier type)
> 	{
> 		...
> 		wait_migrated_callbacks();
> 	}
> 	...
> 	static inline void wait_migrated_callbacks(void)
> 	{
> 		wait_event(rcu_migrate_wq, !atomic_read(&rcu_migrate_type_count));
> 	}
> 
> as it upsets some versions of gcc under some circumstances:
> 
> 	kernel/rcupdate.c: In function `_rcu_barrier':
> 	kernel/rcupdate.c:125: sorry, unimplemented: inlining failed in call to 'wait_migrated_callbacks': function body not available
> 	kernel/rcupdate.c:152: sorry, unimplemented: called from here
> 
> This can be dealt with by simply putting the static variables (rcu_migrate_*)
> at the top, and moving the implementation of the function up so that it
> replaces its forward declaration.

Looks good to me!

Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

> Signed-off-by: David Howells <dhowells@redhat.com>
> Cc: Dipankar Sarma <dipankar@in.ibm.com>
> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> ---
> 
>  kernel/rcupdate.c |   18 ++++++++----------
>  1 files changed, 8 insertions(+), 10 deletions(-)
> 
> 
> diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
> index 2c7b845..a967c9f 100644
> --- a/kernel/rcupdate.c
> +++ b/kernel/rcupdate.c
> @@ -58,6 +58,10 @@ static DEFINE_MUTEX(rcu_barrier_mutex);
>  static struct completion rcu_barrier_completion;
>  int rcu_scheduler_active __read_mostly;
> 
> +static atomic_t rcu_migrate_type_count = ATOMIC_INIT(0);
> +static struct rcu_head rcu_migrate_head[3];
> +static DECLARE_WAIT_QUEUE_HEAD(rcu_migrate_wq);
> +
>  /*
>   * Awaken the corresponding synchronize_rcu() instance now that a
>   * grace period has elapsed.
> @@ -122,7 +126,10 @@ static void rcu_barrier_func(void *type)
>  	}
>  }
> 
> -static inline void wait_migrated_callbacks(void);
> +static inline void wait_migrated_callbacks(void)
> +{
> +	wait_event(rcu_migrate_wq, !atomic_read(&rcu_migrate_type_count));
> +}
> 
>  /*
>   * Orchestrate the specified type of RCU barrier, waiting for all
> @@ -179,21 +186,12 @@ void rcu_barrier_sched(void)
>  }
>  EXPORT_SYMBOL_GPL(rcu_barrier_sched);
> 
> -static atomic_t rcu_migrate_type_count = ATOMIC_INIT(0);
> -static struct rcu_head rcu_migrate_head[3];
> -static DECLARE_WAIT_QUEUE_HEAD(rcu_migrate_wq);
> -
>  static void rcu_migrate_callback(struct rcu_head *notused)
>  {
>  	if (atomic_dec_and_test(&rcu_migrate_type_count))
>  		wake_up(&rcu_migrate_wq);
>  }
> 
> -static inline void wait_migrated_callbacks(void)
> -{
> -	wait_event(rcu_migrate_wq, !atomic_read(&rcu_migrate_type_count));
> -}
> -
>  static int __cpuinit rcu_barrier_cpu_hotplug(struct notifier_block *self,
>  		unsigned long action, void *hcpu)
>  {
> 

      reply	other threads:[~2009-04-17 23:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-15 18:34 [PATCH 1/5] MN10300: Discard duplicate PFN_xxx() macros David Howells
2009-04-15 18:34 ` [PATCH 2/5] MN10300: Wire up missing system calls David Howells
2009-04-15 18:34 ` [PATCH 3/5] MN10300: Stop gcc from generating uninitialised variable warnings after BUG() David Howells
2009-04-15 18:34 ` [PATCH 4/5] The default CONFIG_BUG=n version of BUG() should have an empty do...while David Howells
2009-04-15 18:35 ` [PATCH 5/5] RCU: Don't try and predeclare inline funcs as it upsets some versions of gcc David Howells
2009-04-17 23:41   ` Paul E. McKenney [this message]

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=20090417234114.GF6742@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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