All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dengcheng Zhu <dzhu@wavecomp.com>
To: Paul Burton <paul.burton@mips.com>
Cc: pburton@wavecomp.com, ralf@linux-mips.org, linux-mips@linux-mips.org
Subject: Re: [PATCH v2 1/6] MIPS: Make play_dead() work for kexec
Date: Fri, 31 Aug 2018 09:58:34 -0700	[thread overview]
Message-ID: <5B8973BA.5050308@wavecomp.com> (raw)
In-Reply-To: <20180830232053.3vptoq5koytuwxnn@pburton-laptop>

Hi Paul,


On 08/30/2018 04:20 PM, Paul Burton wrote:
> Hi Dengcheng,
>
> On Wed, Jul 11, 2018 at 06:27:43PM -0700, Dengcheng Zhu wrote:
>> diff --git a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c
>> index 03f1026..4615702 100644
>> --- a/arch/mips/kernel/smp-cps.c
>> +++ b/arch/mips/kernel/smp-cps.c
>> @@ -426,12 +406,18 @@ static enum {
>>   	CPU_DEATH_POWER,
>>   } cpu_death;
>>   
>> -void play_dead(void)
>> +void play_dead(bool kexec)
>>   {
>>   	unsigned int cpu, core, vpe_id;
>>   
>>   	local_irq_disable();
>> -	idle_task_exit();
>> +	/*
>> +	 * Don't bother dealing with idle task's mm as we are executing the
>> +	 * new kernel.
>> +	 */
>> +	if (!kexec)
>> +		idle_task_exit();
>> +
>>   	cpu = smp_processor_id();
>>   	core = cpu_core(&cpu_data[cpu]);
>>   	cpu_death = CPU_DEATH_POWER;
>> @@ -454,7 +440,8 @@ void play_dead(void)
>>   	}
>>   
>>   	/* This CPU has chosen its way out */
>> -	(void)cpu_report_death();
>> +	if (!kexec)
>> +		(void)cpu_report_death();
> Is it a problem if we just call cpu_report_death() unconditionally? At a
> glance it looks like we'd just change cpu_hotplug_state for the CPU, but
> since it's going to either power down or hang anyway that seems fine.
>
> If we could do that, then the only other thing the added kexec argument
> is used for is preventing us from calling idle_task_exit(). We could
> instead move that to arch_cpu_idle_dead() and not need to add the extra
> argument to each implementation of play_dead(), which should make this
> patch a little cleaner.

Agreed. Thanks!



Dengcheng

---------------------------------------------------------------------------

*From:* Paul Burton <mailto:paul.burton@mips.com>
*Sent:* Thursday, August 30, 2018 4:20PM
*To:* Dengcheng Zhu <mailto:dzhu@wavecomp.com>
*Cc:* Pburton <mailto:pburton@wavecomp.com>, Ralf 
<mailto:ralf@linux-mips.org>, Linux-mips <mailto:linux-mips@linux-mips.org>
*Subject:* Re: [PATCH v2 1/6] MIPS: Make play_dead() work for kexec

Hi Dengcheng,

On Wed, Jul 11, 2018 at 06:27:43PM -0700, Dengcheng Zhu wrote:

> diff --git a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c
> index 03f1026..4615702 100644
> --- a/arch/mips/kernel/smp-cps.c
> +++ b/arch/mips/kernel/smp-cps.c
> @@ -426,12 +406,18 @@ static enum {
>   	CPU_DEATH_POWER,
>   } cpu_death;
>   
> -void play_dead(void)
> +void play_dead(bool kexec)
>   {
>   	unsigned int cpu, core, vpe_id;
>   
>   	local_irq_disable();
> -	idle_task_exit();
> +	/*
> +	 * Don't bother dealing with idle task's mm as we are executing the
> +	 * new kernel.
> +	 */
> +	if (!kexec)
> +		idle_task_exit();
> +
>   	cpu = smp_processor_id();
>   	core = cpu_core(&cpu_data[cpu]);
>   	cpu_death = CPU_DEATH_POWER;
> @@ -454,7 +440,8 @@ void play_dead(void)
>   	}
>   
>   	/* This CPU has chosen its way out */
> -	(void)cpu_report_death();
> +	if (!kexec)
> +		(void)cpu_report_death();

Is it a problem if we just call cpu_report_death() unconditionally? At a
glance it looks like we'd just change cpu_hotplug_state for the CPU, but
since it's going to either power down or hang anyway that seems fine.

If we could do that, then the only other thing the added kexec argument
is used for is preventing us from calling idle_task_exit(). We could
instead move that to arch_cpu_idle_dead() and not need to add the extra
argument to each implementation of play_dead(), which should make this
patch a little cleaner.

Thanks,
     Paul

  reply	other threads:[~2018-08-31 16:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-12  1:27 [PATCH v2 0/6] MIPS: kexec/kdump: Fix smp reboot and other issues Dengcheng Zhu
2018-07-12  1:27 ` [PATCH v2 1/6] MIPS: Make play_dead() work for kexec Dengcheng Zhu
2018-08-30 23:20   ` Paul Burton
2018-08-31 16:58     ` Dengcheng Zhu [this message]
2018-07-12  1:27 ` [PATCH v2 2/6] MIPS: kexec: Let the new kernel handle all CPUs Dengcheng Zhu
2018-07-12  1:27 ` [PATCH v2 3/6] MIPS: kexec: Deprecate (relocated_)kexec_smp_wait Dengcheng Zhu
2018-07-12  1:27 ` [PATCH v2 4/6] MIPS: kexec: Do not flush system wide caches in machine_kexec() Dengcheng Zhu
2018-07-12  1:27 ` [PATCH v2 5/6] MIPS: kexec: Relax memory restriction Dengcheng Zhu
2018-07-12  1:27 ` [PATCH v2 6/6] MIPS: kexec: Use prepare method from generic platform as default option Dengcheng Zhu

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=5B8973BA.5050308@wavecomp.com \
    --to=dzhu@wavecomp.com \
    --cc=linux-mips@linux-mips.org \
    --cc=paul.burton@mips.com \
    --cc=pburton@wavecomp.com \
    --cc=ralf@linux-mips.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.