linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] ARM: Stop secondary cpus in machine_halt()
Date: Mon, 26 Jul 2010 13:31:13 +0100	[thread overview]
Message-ID: <20100726123113.GC23399@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20100712164810.GB9897@n2100.arm.linux.org.uk>

On Mon, Jul 12, 2010 at 05:48:10PM +0100, Russell King - ARM Linux wrote:
> Hmm... what about kexec on a SMP system, or we try to reboot a SMP
> system?
> 
> The x86 code suggests that we put smp_send_stop() inside
> machine_shutdown() (and move that function into arch/arm/kernel/process.c)
> and call it from machine_halt() and machine_reboot().
> 
> This will cover the kexec and reboot cases too.

As no one's commented on this, I'm going to apply it later today for
the next merge window - it seems to be the right way to solve this
problem, and makes us reflect what x86 does.

> So, something like this:
> 
> diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
> index 598ca61..4acce99 100644
> --- a/arch/arm/kernel/machine_kexec.c
> +++ b/arch/arm/kernel/machine_kexec.c
> @@ -37,10 +37,6 @@ void machine_kexec_cleanup(struct kimage *image)
>  {
>  }
>  
> -void machine_shutdown(void)
> -{
> -}
> -
>  void machine_crash_shutdown(struct pt_regs *regs)
>  {
>  }
> diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
> index a4a9cc8..ceb2aa4 100644
> --- a/arch/arm/kernel/process.c
> +++ b/arch/arm/kernel/process.c
> @@ -189,19 +189,29 @@ int __init reboot_setup(char *str)
>  
>  __setup("reboot=", reboot_setup);
>  
> -void machine_halt(void)
> +void machine_shutdown(void)
>  {
> +#ifdef CONFIG_SMP
> +	smp_send_stop();
> +#endif
>  }
>  
> +void machine_halt(void)
> +{
> +	machine_shutdown();
> +	while (1);
> +}
>  
>  void machine_power_off(void)
>  {
> +	machine_shutdown();
>  	if (pm_power_off)
>  		pm_power_off();
>  }
>  
>  void machine_restart(char *cmd)
>  {
> +	machine_shutdown();
>  	arm_pm_restart(reboot_mode, cmd);
>  }
>  
> diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
> index b8c3d0f..11f631b 100644
> --- a/arch/arm/kernel/smp.c
> +++ b/arch/arm/kernel/smp.c
> @@ -467,10 +467,13 @@ static DEFINE_SPINLOCK(stop_lock);
>   */
>  static void ipi_cpu_stop(unsigned int cpu)
>  {
> -	spin_lock(&stop_lock);
> -	printk(KERN_CRIT "CPU%u: stopping\n", cpu);
> -	dump_stack();
> -	spin_unlock(&stop_lock);
> +	if (system_state == SYSTEM_BOOTING ||
> +	    system_state == SYSTEM_RUNNING) {
> +		spin_lock(&stop_lock);
> +		printk(KERN_CRIT "CPU%u: stopping\n", cpu);
> +		dump_stack();
> +		spin_unlock(&stop_lock);
> +	}
>  
>  	set_cpu_online(cpu, false);
>  
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2010-07-26 12:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-01 22:47 [PATCH] ARM: Stop secondary cpus in machine_halt() Olof Johansson
2010-07-01 23:11 ` Russell King - ARM Linux
2010-07-02  0:10   ` Olof Johansson
2010-07-03 18:46 ` [PATCH v2] " Olof Johansson
2010-07-12 16:48   ` Russell King - ARM Linux
2010-07-26 12:31     ` Russell King - ARM Linux [this message]
2010-07-26 15:26       ` Olof Johansson

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=20100726123113.GC23399@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).