All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Christoph Hellwig <hch@infradead.org>,
	Ingo Molnar <mingo@kernel.org>, Jan Kara <jack@suse.cz>,
	Jens Axboe <jens.axboe@oracle.com>
Subject: Re: [PATCH 08/11] smp: Move __smp_call_function_single() below its safe version
Date: Mon, 10 Feb 2014 21:29:11 +0100	[thread overview]
Message-ID: <20140210202911.GD16642@quack.suse.cz> (raw)
In-Reply-To: <1391876320-25068-9-git-send-email-fweisbec@gmail.com>

On Sat 08-02-14 17:18:37, Frederic Weisbecker wrote:
> Move this function closer to __smp_call_function_single(). These functions
> have very similar behavior and should be displayed in the same block
> for clarity.
  Whatever :). You can add:
Reviewed-by: Jan Kara <jack@suse.cz>

								Honza
> 
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Christoph Hellwig <hch@infradead.org>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Jan Kara <jack@suse.cz>
> Cc: Jens Axboe <jens.axboe@oracle.com>
> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> ---
>  kernel/smp.c | 64 ++++++++++++++++++++++++++++++------------------------------
>  1 file changed, 32 insertions(+), 32 deletions(-)
> 
> diff --git a/kernel/smp.c b/kernel/smp.c
> index 64bb0d4..fa04ab9 100644
> --- a/kernel/smp.c
> +++ b/kernel/smp.c
> @@ -237,6 +237,38 @@ int smp_call_function_single(int cpu, smp_call_func_t func, void *info,
>  }
>  EXPORT_SYMBOL(smp_call_function_single);
>  
> +/**
> + * __smp_call_function_single(): Run a function on a specific CPU
> + * @cpu: The CPU to run on.
> + * @csd: Pre-allocated and setup data structure
> + * @wait: If true, wait until function has completed on specified CPU.
> + *
> + * Like smp_call_function_single(), but allow caller to pass in a
> + * pre-allocated data structure. Useful for embedding @data inside
> + * other structures, for instance.
> + */
> +int __smp_call_function_single(int cpu, struct call_single_data *csd, int wait)
> +{
> +	int err = 0;
> +	int this_cpu;
> +
> +	this_cpu = get_cpu();
> +	/*
> +	 * Can deadlock when called with interrupts disabled.
> +	 * We allow cpu's that are not yet online though, as no one else can
> +	 * send smp call function interrupt to this cpu and as such deadlocks
> +	 * can't happen.
> +	 */
> +	WARN_ON_ONCE(cpu_online(this_cpu) && wait && irqs_disabled()
> +		     && !oops_in_progress);
> +
> +	err = generic_exec_single(cpu, csd, csd->func, csd->info, wait);
> +	put_cpu();
> +
> +	return err;
> +}
> +EXPORT_SYMBOL_GPL(__smp_call_function_single);
> +
>  /*
>   * smp_call_function_any - Run a function on any of the given cpus
>   * @mask: The mask of cpus it can run on.
> @@ -281,38 +313,6 @@ call:
>  EXPORT_SYMBOL_GPL(smp_call_function_any);
>  
>  /**
> - * __smp_call_function_single(): Run a function on a specific CPU
> - * @cpu: The CPU to run on.
> - * @csd: Pre-allocated and setup data structure
> - * @wait: If true, wait until function has completed on specified CPU.
> - *
> - * Like smp_call_function_single(), but allow caller to pass in a
> - * pre-allocated data structure. Useful for embedding @data inside
> - * other structures, for instance.
> - */
> -int __smp_call_function_single(int cpu, struct call_single_data *csd, int wait)
> -{
> -	int err = 0;
> -	int this_cpu;
> -
> -	this_cpu = get_cpu();
> -	/*
> -	 * Can deadlock when called with interrupts disabled.
> -	 * We allow cpu's that are not yet online though, as no one else can
> -	 * send smp call function interrupt to this cpu and as such deadlocks
> -	 * can't happen.
> -	 */
> -	WARN_ON_ONCE(cpu_online(this_cpu) && wait && irqs_disabled()
> -		     && !oops_in_progress);
> -
> -	err = generic_exec_single(cpu, csd, csd->func, csd->info, wait);
> -	put_cpu();
> -
> -	return err;
> -}
> -EXPORT_SYMBOL_GPL(__smp_call_function_single);
> -
> -/**
>   * smp_call_function_many(): Run a function on a set of other CPUs.
>   * @mask: The set of cpus to run on (only runs on online subset).
>   * @func: The function to run. This must be fast and non-blocking.
> -- 
> 1.8.3.1
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  reply	other threads:[~2014-02-10 20:29 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-08 16:18 [RFC PATCH 00/11] smp: Single IPI cleanups Frederic Weisbecker
2014-02-08 16:18 ` [PATCH 01/11] block: Stop abusing csd.list for fifo_time Frederic Weisbecker
2014-02-08 16:18 ` [PATCH 02/11] block: Remove useless IPI struct initialization Frederic Weisbecker
2014-02-10 20:21   ` Jan Kara
2014-02-08 16:18 ` [PATCH 03/11] block: Stop abusing rq->csd.list in blk-softirq Frederic Weisbecker
2014-02-08 16:18 ` [PATCH 04/11] smp: Iterate functions through llist_for_each_entry_safe() Frederic Weisbecker
2014-02-08 16:18 ` [PATCH 05/11] smp: Remove unused list_head from csd Frederic Weisbecker
2014-02-08 16:18 ` [PATCH 06/11] smp: Teach __smp_call_function_single() to check for offline cpus Frederic Weisbecker
2014-02-08 16:18 ` [PATCH 07/11] smp: Consolidate the various smp_call_function_single() declensions Frederic Weisbecker
2014-02-10 20:27   ` Jan Kara
2014-02-08 16:18 ` [PATCH 08/11] smp: Move __smp_call_function_single() below its safe version Frederic Weisbecker
2014-02-10 20:29   ` Jan Kara [this message]
2014-02-08 16:18 ` [PATCH 09/11] watchdog: Simplify a little the IPI call Frederic Weisbecker
2014-02-10 12:26   ` Michal Hocko
2014-02-10 14:46   ` Don Zickus
2014-02-08 16:18 ` [PATCH 10/11] smp: Remove wait argument from __smp_call_function_single() Frederic Weisbecker
2014-02-08 16:42   ` Christoph Hellwig
2014-02-08 16:46     ` Frederic Weisbecker
2014-02-08 16:54       ` Christoph Hellwig
2014-02-08 16:18 ` [PATCH 11/11] smp: Enhance and precise the role & requirements of __smp_call_function_single() Frederic Weisbecker
  -- strict thread matches above, loose matches on Subject: below --
2014-02-24 15:39 [PATCH 00/11] smp: Single IPI cleanups v2 Frederic Weisbecker
2014-02-24 15:39 ` [PATCH 08/11] smp: Move __smp_call_function_single() below its safe version Frederic Weisbecker

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=20140210202911.GD16642@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=hch@infradead.org \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.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 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.