Skip to content

Commit cae614d

Browse files
committed
EXP cpu: Add CPU-online debugging
This not-for-mainline commit is intended to help track down boot-time CPU-online failures. [ paulmck: Apply kernel test robot feedback. ] Signed-off-by: Paul E. McKenney <[email protected]>
1 parent ec68deb commit cae614d

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

drivers/base/cpu.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ static int cpu_subsys_online(struct device *dev)
5252
int ret;
5353

5454
from_nid = cpu_to_node(cpuid);
55-
if (from_nid == NUMA_NO_NODE)
55+
if (from_nid == NUMA_NO_NODE) {
56+
pr_warn("%s(%d): returned %d due to from_nid == NUMA_NO_NODE.\n", __func__, cpuid, -ENODEV);
5657
return -ENODEV;
58+
}
5759

5860
ret = cpu_device_up(dev);
5961
/*

kernel/cpu.c

+13
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ static int cpuhp_invoke_callback(unsigned int cpu, enum cpuhp_state state,
190190

191191
trace_cpuhp_enter(cpu, st->target, state, cb);
192192
ret = cb(cpu);
193+
if (!ret && bringup)
194+
pr_warn("%s(%d): %ps returned %d\n", __func__, cpu, cb, ret);
193195
trace_cpuhp_exit(cpu, st->state, state, ret);
194196
return ret;
195197
}
@@ -200,6 +202,8 @@ static int cpuhp_invoke_callback(unsigned int cpu, enum cpuhp_state state,
200202
WARN_ON_ONCE(lastp && *lastp);
201203
trace_cpuhp_multi_enter(cpu, st->target, state, cbm, node);
202204
ret = cbm(cpu, node);
205+
if (!ret && bringup)
206+
pr_warn("%s(%d): %ps returned %d\n", __func__, cpu, cbm, ret);
203207
trace_cpuhp_exit(cpu, st->state, state, ret);
204208
return ret;
205209
}
@@ -212,6 +216,8 @@ static int cpuhp_invoke_callback(unsigned int cpu, enum cpuhp_state state,
212216

213217
trace_cpuhp_multi_enter(cpu, st->target, state, cbm, node);
214218
ret = cbm(cpu, node);
219+
if (!ret && bringup)
220+
pr_warn("%s(%d): %ps returned %d\n", __func__, cpu, cbm, ret);
215221
trace_cpuhp_exit(cpu, st->state, state, ret);
216222
if (ret) {
217223
if (!lastp)
@@ -237,6 +243,8 @@ static int cpuhp_invoke_callback(unsigned int cpu, enum cpuhp_state state,
237243

238244
trace_cpuhp_multi_enter(cpu, st->target, state, cbm, node);
239245
ret = cbm(cpu, node);
246+
if (!ret && bringup)
247+
pr_warn("%s(%d): %ps returned %d\n", __func__, cpu, cbm, ret);
240248
trace_cpuhp_exit(cpu, st->state, state, ret);
241249
/*
242250
* Rollback must not fail,
@@ -1341,6 +1349,7 @@ static int _cpu_up(unsigned int cpu, int tasks_frozen, enum cpuhp_state target)
13411349
cpus_write_lock();
13421350

13431351
if (!cpu_present(cpu)) {
1352+
pr_warn("%s(%d): returned %d due to !cpu_present(cpu).\n", __func__, cpu, -EINVAL);
13441353
ret = -EINVAL;
13451354
goto out;
13461355
}
@@ -1357,6 +1366,7 @@ static int _cpu_up(unsigned int cpu, int tasks_frozen, enum cpuhp_state target)
13571366
idle = idle_thread_get(cpu);
13581367
if (IS_ERR(idle)) {
13591368
ret = PTR_ERR(idle);
1369+
pr_warn("%s(%d): returned %d due to IS_ERR(idle_thread_get(cpu)).\n", __func__, cpu, ret);
13601370
goto out;
13611371
}
13621372
}
@@ -1402,6 +1412,7 @@ static int cpu_up(unsigned int cpu, enum cpuhp_state target)
14021412
#if defined(CONFIG_IA64)
14031413
pr_err("please check additional_cpus= boot parameter\n");
14041414
#endif
1415+
pr_warn("%s(%d): returned %d due to !cpu_possible(cpu).\n", __func__, cpu, -EINVAL);
14051416
return -EINVAL;
14061417
}
14071418

@@ -1412,10 +1423,12 @@ static int cpu_up(unsigned int cpu, enum cpuhp_state target)
14121423
cpu_maps_update_begin();
14131424

14141425
if (cpu_hotplug_disabled) {
1426+
pr_warn("%s(%d): returned %d due to cpu_hotplug_disabled.\n", __func__, cpu, -EBUSY);
14151427
err = -EBUSY;
14161428
goto out;
14171429
}
14181430
if (!cpu_smt_allowed(cpu)) {
1431+
pr_warn("%s(%d): returned %d due to !cpu_smt_allowed(cpu).\n", __func__, cpu, -EPERM);
14191432
err = -EPERM;
14201433
goto out;
14211434
}

0 commit comments

Comments
 (0)