Subject: [PATCH 10/13] arm64/kexec: Revert change to machine_shutdown()

From: [email-masked] (Mark Rutland)
Date: Mon, 15 Sep 2014 20:20:21 +0100

Hi Geoff,

On Tue, Sep 09, 2014 at 11:49:05PM +0100, Geoff Levand wrote:
> Commit 90f51a09ef83 ("arm64: Fix machine_shutdown() definition") changed the
> implementation of machine_shutdown() from calling smp_send_stop() to
> calling disable_nonboot_cpus().  Revert that part of the commit so that
> machine_shutdown() once again calls smp_send_stop().

I don't think this is the right way to go. I think we should be using
the hotplug infrastructure (i.e. disable_nonboot_cpus()) rather than
rolling our own, and we should be paying attention to the return value.

So as far as I can tell, disable_nonboot_cpus is the right thing to
call, but machine_shutdown is the wrong place to call it (due to not
returning an error code). We need to call it when we can still abort the
kexec.

Mark.
 
> With the application of another patch in this series, (arm64: Use cpu_ops for
> smp_stop), smp_send_stop() will do the correct thing for a kexec reboot. This
> change also corrects the source code comment for the machine_shutdown() routine.
> 
> Signed-off-by: Geoff Levand <[email-masked]>
> ---
>  arch/arm64/kernel/process.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
> index 0a3414b..cd0ae9d 100644
> --- a/arch/arm64/kernel/process.c
> +++ b/arch/arm64/kernel/process.c
> @@ -101,15 +101,12 @@ void arch_cpu_idle_dead(void)
>  /*
>   * Called by kexec, immediately prior to machine_kexec().
>   *
> - * This must completely disable all secondary CPUs; simply causing those CPUs
> - * to execute e.g. a RAM-based pin loop is not sufficient. This allows the
> - * kexec'd kernel to use any and all RAM as it sees fit, without having to
> - * avoid any code or data used by any SW CPU pin loop. The CPU hotplug
> - * functionality embodied in disable_nonboot_cpus() to achieve this.
> + * This must shutdown all secondary CPUs.  The functionality
> + * embodied in smp_send_stop() will achieve this.
>   */
>  void machine_shutdown(void)
>  {
> -	disable_nonboot_cpus();
> +	smp_send_stop();
>  }
>  
>  /*
> -- 
> 1.9.1
> 
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>