diff options
author | Josh Triplett <josh@joshtriplett.org> | 2011-12-03 16:06:50 -0500 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2011-12-11 13:32:20 -0500 |
commit | 2987557f52b97f679f0c324d8f51b8d66e1f2084 (patch) | |
tree | 93264730d265ef1987e45a97989d75b7a966dbab /drivers/base/cpu.c | |
parent | 2d1dc9a600edf33321bcdc1c808b7957d8a3f3e1 (diff) |
driver-core/cpu: Expose hotpluggability to the rest of the kernel
When architectures register CPUs, they indicate whether the CPU allows
hotplugging; notably, x86 and ARM don't allow hotplugging CPU 0.
Userspace can easily query the hotpluggability of a CPU via sysfs;
however, the kernel has no convenient way of accessing that property in
an architecture-independent way. While the kernel can simply try it and
see, some code needs to distinguish between "hotplug failed" and
"hotplug has no hope of working on this CPU"; for example, rcutorture's
CPU hotplug tests want to avoid drowning out real hotplug failures with
expected failures.
Expose this property via a new cpu_is_hotpluggable function, so that the
rest of the kernel can access it in an architecture-independent way.
Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'drivers/base/cpu.c')
-rw-r--r-- | drivers/base/cpu.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 251acea3d359..3991502b21e5 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
@@ -247,6 +247,13 @@ struct sys_device *get_cpu_sysdev(unsigned cpu) | |||
247 | } | 247 | } |
248 | EXPORT_SYMBOL_GPL(get_cpu_sysdev); | 248 | EXPORT_SYMBOL_GPL(get_cpu_sysdev); |
249 | 249 | ||
250 | bool cpu_is_hotpluggable(unsigned cpu) | ||
251 | { | ||
252 | struct sys_device *dev = get_cpu_sysdev(cpu); | ||
253 | return dev && container_of(dev, struct cpu, sysdev)->hotpluggable; | ||
254 | } | ||
255 | EXPORT_SYMBOL_GPL(cpu_is_hotpluggable); | ||
256 | |||
250 | int __init cpu_dev_init(void) | 257 | int __init cpu_dev_init(void) |
251 | { | 258 | { |
252 | int err; | 259 | int err; |