cpu: printk error information when call cpu_up() failed.
PATCH 1/1 cpu: printk error information when call cpu_up() failed.
It is better to printk error information out when calling cpu_up() failed. Users will observe cpu up error conveniently via the kernel log.
Signed-off-by Yuan ZhaoXiong <[email protected]>
--- kernel/cpu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
kernel/cpu.c +6 -2
@@ -1481,12 +1481,16 @@ int bringup_hibernate_cpu(unsigned int sleep_cpu)void bringup_nonboot_cpus (unsigned int setup_max_cpus) {unsigned int cpu; +int error;for_each_present_cpu (cpu) {if (num_online_cpus () >= setup_max_cpus)break ; -if (!cpu_online (cpu)) -cpu_up (cpu,CPUHP_ONLINE ); +if (!cpu_online (cpu)) { + error =cpu_up (cpu,CPUHP_ONLINE ); +if (error) +pr_err ("Error taking CPU%d up: %d\n" , cpu, error); + } } }
Signature · 1 line
2.27.0
Quoted 2 lines · Yuan ZhaoXiong
It is better to printk error information out when calling
cpu_up()failed. Users will observe cpu up error conveniently via the kernel log.
...
kernel/cpu.c int bringup_hibernate_cpu(unsigned int sleep_cpu) · line 1492
Quoted 4 lines
kernel/cpu.c +4
-0+if (!cpu_online (cpu)) { + error =cpu_up (cpu,CPUHP_ONLINE ); +if (error) +pr_err ("Error taking CPU%d up: %d\n" , cpu, error);
What's useful about it? If the CPU does not come up then it won't be online.
The error code is pretty useless too because it does not tell you which part of the online procedure caused it to fail. Just assume it fails with -ENOMEM, then good luck to find the callback which observed the memory allocation fail.
Thanks,
tglx