[COMMON] arm64: smp: show system_state explictly
authorHosung Kim <hosung0.kim@samsung.com>
Thu, 24 May 2018 01:47:44 +0000 (10:47 +0900)
committerYoungmin Nam <youngmin.nam@samsung.com>
Fri, 29 Jun 2018 09:17:57 +0000 (18:17 +0900)
This commit shows system_state explictly for easy
debugging during abnormal reboot / panic / power off
state.

Change-Id: I4917fbda66cabb58b76b19369573980cabed53ca
Signed-off-by: Hosung Kim <hosung0.kim@samsung.com>
arch/arm64/kernel/smp.c
include/linux/kernel.h

index f1cf3634ade74fb6b813f95f7760a2f30ffb6691..59ddf10222bbe105700b90761b97e5fedf1443f3 100644 (file)
@@ -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);
        }
 
index 4b484ab9e1635e6b412038fa2204d3f297a7c97d..6608f302ae9b6806d52cf9de1769f9e2d45794eb 100644 (file)
@@ -531,6 +531,7 @@ extern enum system_states {
        SYSTEM_HALT,
        SYSTEM_POWER_OFF,
        SYSTEM_RESTART,
+       SYSTEM_END,
 } system_state;
 
 #define TAINT_PROPRIETARY_MODULE       0