cpu/hotplug: print warning message in proper places for online or offline cpu
Subsystems (2)
PATCH 1/1 cpu/hotplug: print warning message in proper places for online or offline cpu
When we online or offline a CPU, unexpected errors may occur for a number of reasons. So if a function called within _cpu_down() or _cpu_up() returns a error code indicating a failed operation, the warning message should be printed rather than fallow the failed __cpu_notify().
Signed-off-by Chen Yucong <[email protected]>
--- kernel/cpu.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
kernel/cpu.c +7 -3
@@ -317,8 +317,8 @@ static int notify_prepare(unsigned int cpu) ret =__cpu_notify (CPU_UP_PREPARE , cpu,-1 , &nr_calls);if (ret) { nr_calls--; -printk (KERN_WARNING "%s: attempt to bring up CPU %u failed\n" , - __func__, cpu); +pr_warn ("%s: attempt to bring up CPU %u failed\n" , + __func__, cpu);__cpu_notify (CPU_UP_CANCELED , cpu, nr_calls,NULL ); }return ret;
@@ -353,6 +353,8 @@ static int bringup_cpu(unsigned int cpu) ret =__cpu_up (cpu, idle);if (ret) {cpu_notify (CPU_UP_CANCELED , cpu); +pr_warn ("%s: attempt to bring up CPU %u failed\n" , + __func__, cpu);return ret; } ret =bringup_wait_for_ap (cpu);
@@ -662,7 +664,7 @@ static int notify_down_prepare(unsigned int cpu) nr_calls--;__cpu_notify (CPU_DOWN_FAILED , cpu, nr_calls,NULL );pr_warn ("%s: attempt to take down CPU %u failed\n" , - __func__, cpu); + __func__, cpu); }return err; }
@@ -737,6 +739,8 @@ static int takedown_cpu(unsigned int cpu)irq_unlock_sparse ();/* Unpark the hotplug thread so we can rollback there */ kthread_unpark (per_cpu_ptr (&cpuhp_state, cpu)->thread); +pr_warn ("%s: attempt to take down CPU %u failed\n" , + __func__, cpu);return err; }BUG_ON (cpu_online (cpu));
Signature · 1 line
1.7.10.4