linux-mips
[Top] [All Lists]

Re: [PATCH V2] MIPS: Fix poweroff failure when HOTPLUG_CPU configured.

To: Ralf Baechle <ralf@linux-mips.org>
Subject: Re: [PATCH V2] MIPS: Fix poweroff failure when HOTPLUG_CPU configured.
From: Huacai Chen <chenhc@lemote.com>
Date: Tue, 14 Aug 2012 22:24:23 +0800
Cc: linux-mips@linux-mips.org, linux-kernel@vger.kernel.org, Fuxin Zhang <zhangfx@lemote.com>, Zhangjin Wu <wuzhangjin@gmail.com>, Hongliang Tao <taohl@lemote.com>, Hua Yan <yanh@lemote.com>, Yong Zhang <yong.zhang@windriver.com>, stable@vger.kernel.org
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=Q/o1rFV1LG7kCmY/t0T98tzzzUre3tu2hZizdNYnh8g=; b=M6UGzd9sLMNKrLMumU4z1uxQohro0if5ni9aEPZE0TWS4n/lJ2wZZpyrRB9i1U8PF+ +hYs66X6XJhsdvmCAhlXpOi7xN9EvyA918JXCF3Cp758cU+rMupQvjrxmK4JmFXQl/Iy S/T0jApEtvEzOpzPAlAaECapwzgPt7FyGN4Vi3G10CJ8sQLpf5SAyvfzwzOAWrbc8/Rt 9JqimXa/ToJ9SmRupWgwb9PfQNI/h1Hm7VExwG3PygvUJzuhdzsJJV/Ibth3aMMhnSGs QwAsht5qEPIZPp2nxFxKWu4sxpPWl+cP4uQOReneezQRv/KPrOKlpepuznDAwVjJ4kSo Ck6g==
In-reply-to: <20120814114856.GA17040@linux-mips.org>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
References: <1344862344-27434-1-git-send-email-chenhc@lemote.com> <20120814114856.GA17040@linux-mips.org>
Sender: linux-mips-bounce@linux-mips.org
On Tue, Aug 14, 2012 at 7:48 PM, Ralf Baechle <ralf@linux-mips.org> wrote:
> On Mon, Aug 13, 2012 at 08:52:24PM +0800, Huacai Chen wrote:
>
>> When poweroff machine, kernel_power_off() call disable_nonboot_cpus().
>> And if we have HOTPLUG_CPU configured, disable_nonboot_cpus() is not an
>> empty function but attempt to actually disable the nonboot cpus. Since
>> system state is SYSTEM_POWER_OFF, play_dead() won't be called and thus
>> disable_nonboot_cpus() hangs. Therefore, we make this patch to avoid
>> poweroff failure.
>
>> diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
>> index e9a5fd7..69b17a9 100644
>> --- a/arch/mips/kernel/process.c
>> +++ b/arch/mips/kernel/process.c
>> @@ -72,9 +72,7 @@ void __noreturn cpu_idle(void)
>>                       }
>>               }
>>  #ifdef CONFIG_HOTPLUG_CPU
>> -             if (!cpu_online(cpu) && !cpu_isset(cpu, cpu_callin_map) &&
>> -                 (system_state == SYSTEM_RUNNING ||
>> -                  system_state == SYSTEM_BOOTING))
>> +             if (!cpu_online(cpu) && !cpu_isset(cpu, cpu_callin_map))
>
> Looks good - but I'm wondering if the "!cpu_isset(cpu, cpu_callin_map)"
> can be removed as well?
For X86, IA64, ARM, SPARC64 and most other arch, "!cpu_online(cpu)" is
the only condition of play_dead(). I keep "!cpu_isset(cpu,
cpu_callin_map)" because this does't refuse poweroff and I don't know
why the old condition of play_dead() is so complex.

>
> Also, which -stable branches is this patch applicable?
3.3, 3.4 and 3.5 branch can use it, 3.2 and earlier kernels should do
some small changes.

>
>   Ralf
>

<Prev in Thread] Current Thread [Next in Thread>