* [PATCH] cpu: printk error information when call cpu_up() failed.
@ 2022-11-28 13:28 Yuan ZhaoXiong
2022-12-01 11:40 ` Thomas Gleixner
0 siblings, 1 reply; 2+ messages in thread
From: Yuan ZhaoXiong @ 2022-11-28 13:28 UTC (permalink / raw)
To: tglx, steven.price, Jason, juri.lelli, tony.luck, frederic,
yuanzhx326, sathyanarayanan.kuppuswamy
Cc: linux-kernel
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 <yuanzhx326@gmail.com>
---
kernel/cpu.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/kernel/cpu.c b/kernel/cpu.c
index bbad5e375d3b..28b0202e7744 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -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);
+ }
}
}
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] cpu: printk error information when call cpu_up() failed.
2022-11-28 13:28 [PATCH] cpu: printk error information when call cpu_up() failed Yuan ZhaoXiong
@ 2022-12-01 11:40 ` Thomas Gleixner
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2022-12-01 11:40 UTC (permalink / raw)
To: Yuan ZhaoXiong, steven.price, Jason, juri.lelli, tony.luck,
frederic, yuanzhx326, sathyanarayanan.kuppuswamy
Cc: linux-kernel
On Mon, Nov 28 2022 at 21:28, Yuan ZhaoXiong wrote:
> It is better to printk error information out when calling cpu_up() failed.
> Users will observe cpu up error conveniently via the kernel log.
...
> + 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-01 11:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-28 13:28 [PATCH] cpu: printk error information when call cpu_up() failed Yuan ZhaoXiong
2022-12-01 11:40 ` Thomas Gleixner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox