diff options
author | Toshi Kani <toshi.kani@hp.com> | 2013-08-29 20:22:07 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-09-25 04:38:09 -0400 |
commit | 574b851e99923c884fee4e0d7cf7e7c3dc023ffa (patch) | |
tree | 7498d2dcbc4bd2e3bf03434461ca36d31790a087 /drivers/base/cpu.c | |
parent | f6913f990273a1fbfc0ec501d4998faa4f1ebae6 (diff) |
hotplug / x86: Add hotplug lock to missing places
lock_device_hotplug[_sysfs]() serializes CPU & Memory online/offline
and hotplug operations. However, this lock is not held in the debug
interfaces below that initiate CPU online/offline operations.
- _debug_hotplug_cpu(), cpu0 hotplug test interface enabled by
CONFIG_DEBUG_HOTPLUG_CPU0.
- cpu_probe_store() and cpu_release_store(), cpu hotplug test interface
enabled by CONFIG_ARCH_CPU_PROBE_RELEASE.
This patch changes the above interfaces to hold lock_device_hotplug().
Signed-off-by: Toshi Kani <toshi.kani@hp.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base/cpu.c')
-rw-r--r-- | drivers/base/cpu.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 848ebbd25717..51f5d7fe2f0b 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
@@ -93,7 +93,17 @@ static ssize_t cpu_probe_store(struct device *dev, | |||
93 | const char *buf, | 93 | const char *buf, |
94 | size_t count) | 94 | size_t count) |
95 | { | 95 | { |
96 | return arch_cpu_probe(buf, count); | 96 | ssize_t cnt; |
97 | int ret; | ||
98 | |||
99 | ret = lock_device_hotplug_sysfs(); | ||
100 | if (ret) | ||
101 | return ret; | ||
102 | |||
103 | cnt = arch_cpu_probe(buf, count); | ||
104 | |||
105 | unlock_device_hotplug(); | ||
106 | return cnt; | ||
97 | } | 107 | } |
98 | 108 | ||
99 | static ssize_t cpu_release_store(struct device *dev, | 109 | static ssize_t cpu_release_store(struct device *dev, |
@@ -101,7 +111,17 @@ static ssize_t cpu_release_store(struct device *dev, | |||
101 | const char *buf, | 111 | const char *buf, |
102 | size_t count) | 112 | size_t count) |
103 | { | 113 | { |
104 | return arch_cpu_release(buf, count); | 114 | ssize_t cnt; |
115 | int ret; | ||
116 | |||
117 | ret = lock_device_hotplug_sysfs(); | ||
118 | if (ret) | ||
119 | return ret; | ||
120 | |||
121 | cnt = arch_cpu_release(buf, count); | ||
122 | |||
123 | unlock_device_hotplug(); | ||
124 | return cnt; | ||
105 | } | 125 | } |
106 | 126 | ||
107 | static DEVICE_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); | 127 | static DEVICE_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); |