From 910868740932dd9c7b93c38d8ff0aa7f8287174a Mon Sep 17 00:00:00 2001 From: Hosung Kim Date: Thu, 24 May 2018 10:47:44 +0900 Subject: [PATCH] [COMMON] arm64: smp: show system_state explictly This commit shows system_state explictly for easy debugging during abnormal reboot / panic / power off state. Change-Id: I4917fbda66cabb58b76b19369573980cabed53ca Signed-off-by: Hosung Kim --- arch/arm64/kernel/smp.c | 16 +++++++++++++--- include/linux/kernel.h | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index f1cf3634ade7..59ddf10222bb 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -839,10 +839,11 @@ static DEFINE_RAW_SPINLOCK(stop_lock); */ static void ipi_cpu_stop(unsigned int cpu, struct pt_regs *regs) { + pr_crit("CPU%u: stopping\n", cpu); + if (system_state == SYSTEM_BOOTING || system_state == SYSTEM_RUNNING) { raw_spin_lock(&stop_lock); - pr_crit("CPU%u: stopping\n", cpu); dump_stack(); raw_spin_unlock(&stop_lock); } @@ -971,6 +972,15 @@ void tick_broadcast(const struct cpumask *mask) } #endif +static const char *system_state_show[SYSTEM_END] = { + "SYSTEM_BOOTING", + "SYSTEM_SCHEDULING", + "SYSTEM_RUNNING", + "SYSTEM_HALT", + "SYSTEM_POWER_OFF", + "SYSTEM_RESTART", +}; + void smp_send_stop(void) { unsigned long timeout; @@ -981,8 +991,8 @@ void smp_send_stop(void) cpumask_copy(&mask, cpu_online_mask); cpumask_clear_cpu(smp_processor_id(), &mask); - if (system_state <= SYSTEM_RUNNING) - pr_crit("SMP: stopping secondary CPUs\n"); + pr_crit("SMP: stopping secondary CPUs : %s\n", + system_state_show[system_state]); smp_cross_call(&mask, IPI_CPU_STOP); } diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 4b484ab9e163..6608f302ae9b 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -531,6 +531,7 @@ extern enum system_states { SYSTEM_HALT, SYSTEM_POWER_OFF, SYSTEM_RESTART, + SYSTEM_END, } system_state; #define TAINT_PROPRIETARY_MODULE 0 -- 2.20.1