Skip to content

Commit 86fffe4

Browse files
ickletorvalds
authored andcommitted
kernel: remove stop_machine() Kconfig dependency
Currently the full stop_machine() routine is only enabled on SMP if module unloading is enabled, or if the CPUs are hotpluggable. This leads to configurations where stop_machine() is broken as it will then only run the callback on the local CPU with irqs disabled, and not stop the other CPUs or run the callback on them. For example, this breaks MTRR setup on x86 in certain configs since ea8596b ("kprobes/x86: Remove unused text_poke_smp() and text_poke_smp_batch() functions") as the MTRR is only established on the boot CPU. This patch removes the Kconfig option for STOP_MACHINE and uses the SMP and HOTPLUG_CPU config options to compile the correct stop_machine() for the architecture, removing the false dependency on MODULE_UNLOAD in the process. Link: https://lkml.org/lkml/2014/10/8/124 References: https://bugs.freedesktop.org/show_bug.cgi?id=84794 Signed-off-by: Chris Wilson <[email protected]> Acked-by: Ingo Molnar <[email protected]> Cc: "Paul E. McKenney" <[email protected]> Cc: Pranith Kumar <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Vladimir Davydov <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Tejun Heo <[email protected]> Cc: Iulia Manda <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Rusty Russell <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Chuck Ebbert <[email protected]> Cc: Oleg Nesterov <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 98e89cf commit 86fffe4

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

include/linux/stop_machine.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static inline int try_stop_cpus(const struct cpumask *cpumask,
9999
* grabbing every spinlock (and more). So the "read" side to such a
100100
* lock is anything which disables preemption.
101101
*/
102-
#if defined(CONFIG_STOP_MACHINE) && defined(CONFIG_SMP)
102+
#if defined(CONFIG_SMP) || defined(CONFIG_HOTPLUG_CPU)
103103

104104
/**
105105
* stop_machine: freeze the machine on all CPUs and run this function
@@ -118,7 +118,7 @@ int stop_machine(cpu_stop_fn_t fn, void *data, const struct cpumask *cpus);
118118

119119
int stop_machine_from_inactive_cpu(cpu_stop_fn_t fn, void *data,
120120
const struct cpumask *cpus);
121-
#else /* CONFIG_STOP_MACHINE && CONFIG_SMP */
121+
#else /* CONFIG_SMP || CONFIG_HOTPLUG_CPU */
122122

123123
static inline int stop_machine(cpu_stop_fn_t fn, void *data,
124124
const struct cpumask *cpus)
@@ -137,5 +137,5 @@ static inline int stop_machine_from_inactive_cpu(cpu_stop_fn_t fn, void *data,
137137
return stop_machine(fn, data, cpus);
138138
}
139139

140-
#endif /* CONFIG_STOP_MACHINE && CONFIG_SMP */
140+
#endif /* CONFIG_SMP || CONFIG_HOTPLUG_CPU */
141141
#endif /* _LINUX_STOP_MACHINE */

init/Kconfig

-7
Original file line numberDiff line numberDiff line change
@@ -2030,13 +2030,6 @@ config INIT_ALL_POSSIBLE
20302030
it was better to provide this option than to break all the archs
20312031
and have several arch maintainers pursuing me down dark alleys.
20322032

2033-
config STOP_MACHINE
2034-
bool
2035-
default y
2036-
depends on (SMP && MODULE_UNLOAD) || HOTPLUG_CPU
2037-
help
2038-
Need stop_machine() primitive.
2039-
20402033
source "block/Kconfig"
20412034

20422035
config PREEMPT_NOTIFIERS

kernel/stop_machine.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ static int __init cpu_stop_init(void)
531531
}
532532
early_initcall(cpu_stop_init);
533533

534-
#ifdef CONFIG_STOP_MACHINE
534+
#if defined(CONFIG_SMP) || defined(CONFIG_HOTPLUG_CPU)
535535

536536
static int __stop_machine(cpu_stop_fn_t fn, void *data, const struct cpumask *cpus)
537537
{
@@ -631,4 +631,4 @@ int stop_machine_from_inactive_cpu(cpu_stop_fn_t fn, void *data,
631631
return ret ?: done.ret;
632632
}
633633

634-
#endif /* CONFIG_STOP_MACHINE */
634+
#endif /* CONFIG_SMP || CONFIG_HOTPLUG_CPU */

0 commit comments

Comments
 (0)