mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ashok Raj <ashok.raj@intel.com>
To: Shaohua Li <shaohua.li@intel.com>
Cc: Ashok Raj <ashok.raj@intel.com>, akpm <akpm@osdl.org>,
	lkml <linux-kernel@vger.kernel.org>,
	Zwane Mwaikambo <zwane@arm.linux.org.uk>,
	Srivattsa Vaddagiri <vatsa@in.ibm.com>,
	x86-64 <discuss@x86-64.org>,
	Rusty Russell <rusty@rustycorp.com.au>, ak <ak@muc.de>
Subject: Re: [patch 4/5] try2: x86_64: Dont use broadcast shortcut to make it cpu hotplug safe.
Date: Tue, 7 Jun 2005 05:05:15 -0700	[thread overview]
Message-ID: <20050607050515.A24670@unix-os.sc.intel.com> (raw)
In-Reply-To: <1118128410.3949.3.camel@linux-hp.sh.intel.com>; from shaohua.li@intel.com on Tue, Jun 07, 2005 at 03:13:30PM +0800

Hi Shaohua,

The patch i submitted only has fix for x86_64. I did not yet submit one
for i386 yet. For x86_64, the whole access for __smp_call_function() is 
with call_lock held, so shouldnt be a problem.

Cheers,
ashok
On Tue, Jun 07, 2005 at 03:13:30PM +0800, Shaohua Li wrote:
> On Mon, 2005-06-06 at 12:14 -0700, Ashok Raj wrote:
> > plain text document attachment (no_broadcast_ipi.patch)
> > Broadcast IPI's provide un-expected behaviour for cpu hotplug. CPU's in offline
> > state also end up receiving the IPI. Once the cpus become online
> > they receive these stale IPI's which are bad and introduce unexpected
> > behaviour. 
> > 
> With the patch. smp_call_function still has race. It accesses
> cpu_online_map twice. First calculate online cpu counter and second,
> send the ipi, so it's not atomic. We should do something like this:
> 

Deleted....

> 
> --- a/arch/i386/kernel/smp.c	2005-04-26 08:47:08.000000000 +0800
> +++ b/arch/i386/kernel/smp.c	2005-05-31 16:37:10.565141944 +0800
> @@ -527,10 +527,13 @@ int smp_call_function (void (*func) (voi
>  {
>  	struct call_data_struct data;
>  	int cpus;
> +	cpumask_t mask;
>  
>  	/* Holding any lock stops cpus from going down. */
>  	spin_lock(&call_lock);
> -	cpus = num_online_cpus()-1;
> +	mask = cpu_online_map;
> +	cpu_clear(smp_processor_id(), mask);
> +	cpus = cpus_weight(mask);
>  
>  	if (!cpus) {
>  		spin_unlock(&call_lock);
> @@ -551,7 +554,7 @@ int smp_call_function (void (*func) (voi
>  	mb();
>  	
>  	/* Send a message to all other CPUs and wait for them to respond */
> -	send_IPI_allbutself(CALL_FUNCTION_VECTOR);
> +	send_IPI_mask(mask, CALL_FUNCTION_VECTOR);
>  
>  	/* Wait for response */
>  	while (atomic_read(&data.started) != cpus)
> --- a/arch/x86_64/kernel/smp.c	2005-04-12 10:12:16.000000000 +0800
> +++ b/arch/x86_64/kernel/smp.c	2005-05-31 16:38:07.613469280 +0800
> @@ -303,8 +303,11 @@ static void __smp_call_function (void (*
>  				int nonatomic, int wait)
>  {
>  	struct call_data_struct data;
> -	int cpus = num_online_cpus()-1;
> +	int cpus;
> +	cpumask_t mask = cpu_online_map;
>  
> +	cpu_clear(smp_processor_id(), mask);
> +	cpus = cpus_weight(mask);
>  	if (!cpus)
>  		return;
>  
> @@ -318,7 +321,7 @@ static void __smp_call_function (void (*
>  	call_data = &data;
>  	wmb();
>  	/* Send a message to all other CPUs and wait for them to respond */
> -	send_IPI_allbutself(CALL_FUNCTION_VECTOR);
> +	send_IPI_mask(mask, CALL_FUNCTION_VECTOR);
>  
>  	/* Wait for response */
>  	while (atomic_read(&data.started) != cpus)
> 
> 

-- 
Cheers,
Ashok Raj
- Open Source Technology Center

  reply	other threads:[~2005-06-07 12:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-06 19:14 [patch 0/5] x86_64: try2: CPU hotplug patch series Ashok Raj
2005-06-06 19:14 ` [patch 1/5] try2: x86_64: Change init sections for CPU hotplug support Ashok Raj
2005-06-06 19:14 ` [patch 2/5] try2: x86_64: " Ashok Raj
2005-06-06 22:11   ` Andrew Morton
2005-06-06 22:43     ` Ashok Raj
2005-06-06 19:14 ` [patch 3/5] try2: x86_64: CPU hotplug sibling map cleanup Ashok Raj
2005-06-06 19:14 ` [patch 4/5] try2: x86_64: Dont use broadcast shortcut to make it cpu hotplug safe Ashok Raj
2005-06-06 22:13   ` Andrew Morton
2005-06-07  7:13   ` Shaohua Li
2005-06-07 12:05     ` Ashok Raj [this message]
2005-06-07 15:40     ` Ashok Raj
2005-06-06 19:14 ` [patch 5/5] try2: x86_64: Provide ability to choose using shortcuts for IPI in flat mode Ashok Raj
2005-06-06 22:14   ` Andrew Morton

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=20050607050515.A24670@unix-os.sc.intel.com \
    --to=ashok.raj@intel.com \
    --cc=ak@muc.de \
    --cc=akpm@osdl.org \
    --cc=discuss@x86-64.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustycorp.com.au \
    --cc=shaohua.li@intel.com \
    --cc=vatsa@in.ibm.com \
    --cc=zwane@arm.linux.org.uk \
    /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

all inboxes | Powered by JetHome®