Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Commit 4205e47

Browse files
committed
cpu/hotplug: Provide dynamic range for prepare stage
Mathieu reported that the LTTNG modules are broken as of 4.10-rc1 due to the removal of the cpu hotplug notifiers. Usually I don't care much about out of tree modules, but LTTNG is widely used in distros. There are two ways to solve that: 1) Reserve a hotplug state for LTTNG 2) Add a dynamic range for the prepare states. While #1 is the simplest solution, #2 is the proper one as we can convert in tree users, which do not care about ordering, to the dynamic range as well. Add a dynamic range which allows LTTNG to request states in the prepare stage. Reported-and-tested-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Sebastian Sewior <bigeasy@linutronix.de> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1701101353010.3401@nanos Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 parent 7e164ce commit 4205e47

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

include/linux/cpuhotplug.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ enum cpuhp_state {
7474
CPUHP_ZCOMP_PREPARE,
7575
CPUHP_TIMERS_DEAD,
7676
CPUHP_MIPS_SOC_PREPARE,
77+
CPUHP_BP_PREPARE_DYN,
78+
CPUHP_BP_PREPARE_DYN_END = CPUHP_BP_PREPARE_DYN + 20,
7779
CPUHP_BRINGUP_CPU,
7880
CPUHP_AP_IDLE_DEAD,
7981
CPUHP_AP_OFFLINE,

kernel/cpu.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,10 +1302,24 @@ static int cpuhp_cb_check(enum cpuhp_state state)
13021302
*/
13031303
static int cpuhp_reserve_state(enum cpuhp_state state)
13041304
{
1305-
enum cpuhp_state i;
1305+
enum cpuhp_state i, end;
1306+
struct cpuhp_step *step;
13061307

1307-
for (i = CPUHP_AP_ONLINE_DYN; i <= CPUHP_AP_ONLINE_DYN_END; i++) {
1308-
if (!cpuhp_ap_states[i].name)
1308+
switch (state) {
1309+
case CPUHP_AP_ONLINE_DYN:
1310+
step = cpuhp_ap_states + CPUHP_AP_ONLINE_DYN;
1311+
end = CPUHP_AP_ONLINE_DYN_END;
1312+
break;
1313+
case CPUHP_BP_PREPARE_DYN:
1314+
step = cpuhp_bp_states + CPUHP_BP_PREPARE_DYN;
1315+
end = CPUHP_BP_PREPARE_DYN_END;
1316+
break;
1317+
default:
1318+
return -EINVAL;
1319+
}
1320+
1321+
for (i = state; i <= end; i++, step++) {
1322+
if (!step->name)
13091323
return i;
13101324
}
13111325
WARN(1, "No more dynamic states available for CPU hotplug\n");
@@ -1323,7 +1337,7 @@ static int cpuhp_store_callbacks(enum cpuhp_state state, const char *name,
13231337

13241338
mutex_lock(&cpuhp_state_mutex);
13251339

1326-
if (state == CPUHP_AP_ONLINE_DYN) {
1340+
if (state == CPUHP_AP_ONLINE_DYN || state == CPUHP_BP_PREPARE_DYN) {
13271341
ret = cpuhp_reserve_state(state);
13281342
if (ret < 0)
13291343
goto out;

0 commit comments

Comments
 (0)