public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Xiaotian Feng <dfeng@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	Rusty Russell <rusty@rustcorp.com.au>,
	Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>
Subject: Re: [PATCH] fix cpu hotplug test failures on powerpc
Date: Wed, 16 Dec 2009 11:16:32 +0100	[thread overview]
Message-ID: <1260958592.17860.25.camel@laptop> (raw)
In-Reply-To: <1260954957-1518-1-git-send-email-dfeng@redhat.com>

On Wed, 2009-12-16 at 17:15 +0800, Xiaotian Feng wrote:
> Sachin found cpu hotplug test failures on powerpc, which made kernel
> hangs on his POWER box. This is addressed in
> http://marc.info/?l=linux-kernel&m=126052886204649&w=2
> 
> commit 6ad4c18(sched: Fix balance vs hotplug race), switches to
> cpu_active_mask, but at some specific situation, kernel may cause
> some cpu inactive but online.
> 
> In some powerpc machine, hotplug cpu0 is allowed. If cpu0 is the
> last alive cpu, when we tried to offline cpu0, we'll inactive cpu0
> in cpu_down(), after goes into __cpu_down(), kernel found num_online_cpus
> is 1, returned -EBUSY but cpu0 is not changed back to active. So
> cpu0 is inactive but online.
> 
> The fix is to set cpu inactive when we're going to bring down the specific
> cpu in _cpu_down().

Good spotting, thanks! Some comments below.

> Reported-by: Sachin Sant <sachinp@in.ibm.com>
> Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
> Tested-by: Sachin Sant <sachinp@in.ibm.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Rusty Russell <rusty@rustcorp.com.au>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: H. Peter Anvin <hpa@zytor.com>
> Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
> ---
>  kernel/cpu.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/cpu.c b/kernel/cpu.c
> index 291ac58..a1e7165 100644
> --- a/kernel/cpu.c
> +++ b/kernel/cpu.c
> @@ -209,6 +209,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
>  		return -ENOMEM;
>  
>  	cpu_hotplug_begin();
> +	set_cpu_active(cpu, false);
>  	err = __raw_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE | mod,
>  					hcpu, -1, &nr_calls);
>  	if (err == NOTIFY_BAD) {
> @@ -280,8 +281,6 @@ int __ref cpu_down(unsigned int cpu)
>  		goto out;
>  	}
>  
> -	set_cpu_active(cpu, false);
> -
>  	/*
>  	 * Make sure the all cpus did the reschedule and are not
>  	 * using stale version of the cpu_active_mask.

That renders the synchronize_sched() call down there useless, so might
as well remove it then.

> @@ -387,12 +386,6 @@ int disable_nonboot_cpus(void)
>  	 */
>  	cpumask_clear(frozen_cpus);
>  
> -	for_each_online_cpu(cpu) {
> -		if (cpu == first_cpu)
> -			continue;
> -		set_cpu_active(cpu, false);
> -	}
> -
>  	synchronize_sched();

And here too.

>  	printk("Disabling non-boot CPUs ...\n");




      reply	other threads:[~2009-12-16 10:16 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-11 10:53 [Next] CPU Hotplug test failures on powerpc Sachin Sant
2009-12-14  2:48 ` Benjamin Herrenschmidt
2009-12-14  4:37   ` Sachin Sant
2009-12-14 10:22 ` Peter Zijlstra
2009-12-14 11:11   ` Sachin Sant
2009-12-14 12:19     ` Peter Zijlstra
2009-12-14 21:17       ` Benjamin Herrenschmidt
2009-12-15  9:44         ` Sachin Sant
2009-12-15 10:43           ` Peter Zijlstra
2009-12-15 13:47             ` Sachin Sant
2009-12-15 15:03               ` Peter Zijlstra
2009-12-16  5:38                 ` Sachin Sant
2009-12-16  7:14                   ` Peter Zijlstra
2009-12-16  6:56               ` Xiaotian Feng
2009-12-16  6:25 ` Xiaotian Feng
2009-12-16  6:41   ` Sachin Sant
2009-12-16  6:45     ` Xiaotian Feng
2009-12-16  6:54       ` Sachin Sant
2009-12-16  7:18         ` Peter Zijlstra
2009-12-16  7:57           ` Xiaotian Feng
2009-12-16  8:24             ` Sachin Sant
2009-12-16  9:07               ` Xiaotian Feng
2009-12-16  9:15               ` [PATCH] fix cpu hotplug " Xiaotian Feng
2009-12-16 10:16                 ` Peter Zijlstra [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=1260958592.17860.25.camel@laptop \
    --to=peterz@infradead.org \
    --cc=dfeng@redhat.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rusty@rustcorp.com.au \
    /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