diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-01-12 04:49:53 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-12 13:24:23 -0500 |
commit | 50c668d678fd01284799a6e4f1b91829d83cb9ed (patch) | |
tree | f3e129473515950d93a39b92c6ea2ebcbe3e5174 /arch | |
parent | 2bc1379712e74c5b99adaa6db433c14d8841ab4f (diff) |
Revert "cpumask: use work_on_cpu in acpi-cpufreq.c for drv_read and drv_write"
This reverts commit 7503bfbae89eba07b46441a5d1594647f6b8ab7d.
Dieter Ries reported bootup soft-hangs and bisected it back to
this commit, and reverting this commit gave him a working system.
The commit introduces work_on_cpu() use into the cpufreq code,
but that is subtly problematic from a lock hierarchy POV: the
hotplug-cpu lock is an highlevel lock that is taken before
lowlevel locks, and in this codepath we are called with the
policy lock taken.
Dieter did not have lockdep enabled so we dont have a nice stack
trace proof for this, but using work_on_cpu() in such a lowlevel
place certainly looks wrong, so we revert the patch.
work_on_cpu() needs to be reworked to be more generally usable.
Reported-by: Dieter Ries <clip2@gmx.de>
Tested-by: Dieter Ries <clip2@gmx.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c index 06fcd8f9323c..6f11e029e8c5 100644 --- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | |||
@@ -150,9 +150,8 @@ struct drv_cmd { | |||
150 | u32 val; | 150 | u32 val; |
151 | }; | 151 | }; |
152 | 152 | ||
153 | static long do_drv_read(void *_cmd) | 153 | static void do_drv_read(struct drv_cmd *cmd) |
154 | { | 154 | { |
155 | struct drv_cmd *cmd = _cmd; | ||
156 | u32 h; | 155 | u32 h; |
157 | 156 | ||
158 | switch (cmd->type) { | 157 | switch (cmd->type) { |
@@ -167,12 +166,10 @@ static long do_drv_read(void *_cmd) | |||
167 | default: | 166 | default: |
168 | break; | 167 | break; |
169 | } | 168 | } |
170 | return 0; | ||
171 | } | 169 | } |
172 | 170 | ||
173 | static long do_drv_write(void *_cmd) | 171 | static void do_drv_write(struct drv_cmd *cmd) |
174 | { | 172 | { |
175 | struct drv_cmd *cmd = _cmd; | ||
176 | u32 lo, hi; | 173 | u32 lo, hi; |
177 | 174 | ||
178 | switch (cmd->type) { | 175 | switch (cmd->type) { |
@@ -189,23 +186,30 @@ static long do_drv_write(void *_cmd) | |||
189 | default: | 186 | default: |
190 | break; | 187 | break; |
191 | } | 188 | } |
192 | return 0; | ||
193 | } | 189 | } |
194 | 190 | ||
195 | static void drv_read(struct drv_cmd *cmd) | 191 | static void drv_read(struct drv_cmd *cmd) |
196 | { | 192 | { |
193 | cpumask_t saved_mask = current->cpus_allowed; | ||
197 | cmd->val = 0; | 194 | cmd->val = 0; |
198 | 195 | ||
199 | work_on_cpu(cpumask_any(cmd->mask), do_drv_read, cmd); | 196 | set_cpus_allowed_ptr(current, cmd->mask); |
197 | do_drv_read(cmd); | ||
198 | set_cpus_allowed_ptr(current, &saved_mask); | ||
200 | } | 199 | } |
201 | 200 | ||
202 | static void drv_write(struct drv_cmd *cmd) | 201 | static void drv_write(struct drv_cmd *cmd) |
203 | { | 202 | { |
203 | cpumask_t saved_mask = current->cpus_allowed; | ||
204 | unsigned int i; | 204 | unsigned int i; |
205 | 205 | ||
206 | for_each_cpu(i, cmd->mask) { | 206 | for_each_cpu(i, cmd->mask) { |
207 | work_on_cpu(i, do_drv_write, cmd); | 207 | set_cpus_allowed_ptr(current, cpumask_of(i)); |
208 | do_drv_write(cmd); | ||
208 | } | 209 | } |
210 | |||
211 | set_cpus_allowed_ptr(current, &saved_mask); | ||
212 | return; | ||
209 | } | 213 | } |
210 | 214 | ||
211 | static u32 get_cur_val(const struct cpumask *mask) | 215 | static u32 get_cur_val(const struct cpumask *mask) |
@@ -231,15 +235,10 @@ static u32 get_cur_val(const struct cpumask *mask) | |||
231 | return 0; | 235 | return 0; |
232 | } | 236 | } |
233 | 237 | ||
234 | if (unlikely(!alloc_cpumask_var(&cmd.mask, GFP_KERNEL))) | ||
235 | return 0; | ||
236 | |||
237 | cpumask_copy(cmd.mask, mask); | 238 | cpumask_copy(cmd.mask, mask); |
238 | 239 | ||
239 | drv_read(&cmd); | 240 | drv_read(&cmd); |
240 | 241 | ||
241 | free_cpumask_var(cmd.mask); | ||
242 | |||
243 | dprintk("get_cur_val = %u\n", cmd.val); | 242 | dprintk("get_cur_val = %u\n", cmd.val); |
244 | 243 | ||
245 | return cmd.val; | 244 | return cmd.val; |