Commit 5d692961 authored by Matthew McClintock's avatar Matthew McClintock Committed by Kumar Gala

powerpc/85xx: Minor fixups for kexec on 85xx

Make kexec_down_cpus atmoic since it will be incremented by all cores as
they are coming down.

Remove duplicate calls to mpc85xx_smp_kexec_down, now it's called by the
crash and normal kexec pathway only once.

Increase the timeout to wait for other cores to shutdown.
Signed-off-by: default avatarMatthew McClintock <msm@freescale.com>
Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
parent edb85800
...@@ -121,17 +121,15 @@ struct smp_ops_t smp_85xx_ops = { ...@@ -121,17 +121,15 @@ struct smp_ops_t smp_85xx_ops = {
}; };
#ifdef CONFIG_KEXEC #ifdef CONFIG_KEXEC
static int kexec_down_cpus = 0; atomic_t kexec_down_cpus = ATOMIC_INIT(0);
void mpc85xx_smp_kexec_cpu_down(int crash_shutdown, int secondary) void mpc85xx_smp_kexec_cpu_down(int crash_shutdown, int secondary)
{ {
/* When crashing, this gets called on all CPU's we only local_irq_disable();
* take down the non-boot cpus */
if (smp_processor_id() != boot_cpuid)
{
local_irq_disable();
kexec_down_cpus++;
if (secondary) {
atomic_inc(&kexec_down_cpus);
/* loop forever */
while (1); while (1);
} }
} }
...@@ -144,14 +142,14 @@ static void mpc85xx_smp_kexec_down(void *arg) ...@@ -144,14 +142,14 @@ static void mpc85xx_smp_kexec_down(void *arg)
static void mpc85xx_smp_machine_kexec(struct kimage *image) static void mpc85xx_smp_machine_kexec(struct kimage *image)
{ {
int timeout = 2000; int timeout = INT_MAX;
int i; int i, num_cpus = num_present_cpus();
set_cpus_allowed(current, cpumask_of_cpu(boot_cpuid));
smp_call_function(mpc85xx_smp_kexec_down, NULL, 0); if (image->type == KEXEC_TYPE_DEFAULT)
smp_call_function(mpc85xx_smp_kexec_down, NULL, 0);
while ( (kexec_down_cpus != (num_online_cpus() - 1)) && while ( (atomic_read(&kexec_down_cpus) != (num_cpus - 1)) &&
( timeout > 0 ) ) ( timeout > 0 ) )
{ {
timeout--; timeout--;
...@@ -160,7 +158,7 @@ static void mpc85xx_smp_machine_kexec(struct kimage *image) ...@@ -160,7 +158,7 @@ static void mpc85xx_smp_machine_kexec(struct kimage *image)
if ( !timeout ) if ( !timeout )
printk(KERN_ERR "Unable to bring down secondary cpu(s)"); printk(KERN_ERR "Unable to bring down secondary cpu(s)");
for (i = 0; i < num_present_cpus(); i++) for (i = 0; i < num_cpus; i++)
{ {
if ( i == smp_processor_id() ) continue; if ( i == smp_processor_id() ) continue;
mpic_reset_core(i); mpic_reset_core(i);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment