Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d914d4d4 authored by Aaro Koskinen's avatar Aaro Koskinen Committed by Catalin Marinas
Browse files

arm64: Implement panic_smp_self_stop()



Currently arm64 uses the default implementation of panic_smp_self_stop()
where the CPU runs in a cpu_relax() loop unable to receive IPIs anymore.
As a result, when two CPUs panic() simultaneously we get "SMP: failed to
stop secondary CPUs" warnings and extra delays before a reset, because
smp_send_stop() still tries to stop the other paniced CPU.

Provide an implementation of panic_smp_self_stop() that is identical to
the IPI CPU stop handler, so that the online status of stopped CPUs gets
properly updated.

Acked-by: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@nokia.com>
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent dccc9da2
Loading
Loading
Loading
Loading
+13 −6
Original line number Original line Diff line number Diff line
@@ -841,18 +841,25 @@ void arch_irq_work_raise(void)
}
}
#endif
#endif


/*
static void local_cpu_stop(void)
 * ipi_cpu_stop - handle IPI from smp_send_stop()
 */
static void ipi_cpu_stop(unsigned int cpu)
{
{
	set_cpu_online(cpu, false);
	set_cpu_online(smp_processor_id(), false);


	local_daif_mask();
	local_daif_mask();
	sdei_mask_local_cpu();
	sdei_mask_local_cpu();
	cpu_park_loop();
	cpu_park_loop();
}
}


/*
 * We need to implement panic_smp_self_stop() for parallel panic() calls, so
 * that cpu_online_mask gets correctly updated and smp_send_stop() can skip
 * CPUs that have already stopped themselves.
 */
void panic_smp_self_stop(void)
{
	local_cpu_stop();
}

#ifdef CONFIG_KEXEC_CORE
#ifdef CONFIG_KEXEC_CORE
static atomic_t waiting_for_crash_ipi = ATOMIC_INIT(0);
static atomic_t waiting_for_crash_ipi = ATOMIC_INIT(0);
#endif
#endif
@@ -903,7 +910,7 @@ void handle_IPI(int ipinr, struct pt_regs *regs)


	case IPI_CPU_STOP:
	case IPI_CPU_STOP:
		irq_enter();
		irq_enter();
		ipi_cpu_stop(cpu);
		local_cpu_stop();
		irq_exit();
		irq_exit();
		break;
		break;