aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel/microcode.c
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2006-02-28 19:58:53 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-02-28 23:53:43 -0500
commit5cf6c541f5b3902bdcc2d311d70f8e730aaff1be (patch)
tree2298029c0e4d0e40853983d4e8f88627bb564947 /arch/i386/kernel/microcode.c
parentec72070b1201203387e0c32a23ed17e35a24b170 (diff)
[PATCH] x86 microcode driver vs hotplug CPUs.
This driver loops over 'num_online_cpus', but it doesn't account for holes in the online map created by offlined cpus, and assumes that the cpu numbers stay linear. Signed-off-by: Dave Jones <davej@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/i386/kernel/microcode.c')
-rw-r--r--arch/i386/kernel/microcode.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c
index d3fdf0057d82..5390b521aca0 100644
--- a/arch/i386/kernel/microcode.c
+++ b/arch/i386/kernel/microcode.c
@@ -74,6 +74,7 @@
74#include <linux/kernel.h> 74#include <linux/kernel.h>
75#include <linux/init.h> 75#include <linux/init.h>
76#include <linux/sched.h> 76#include <linux/sched.h>
77#include <linux/cpumask.h>
77#include <linux/module.h> 78#include <linux/module.h>
78#include <linux/slab.h> 79#include <linux/slab.h>
79#include <linux/vmalloc.h> 80#include <linux/vmalloc.h>
@@ -250,8 +251,8 @@ static int find_matching_ucodes (void)
250 error = -EINVAL; 251 error = -EINVAL;
251 goto out; 252 goto out;
252 } 253 }
253 254
254 for (cpu_num = 0; cpu_num < num_online_cpus(); cpu_num++) { 255 for_each_online_cpu(cpu_num) {
255 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; 256 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
256 if (uci->err != MC_NOTFOUND) /* already found a match or not an online cpu*/ 257 if (uci->err != MC_NOTFOUND) /* already found a match or not an online cpu*/
257 continue; 258 continue;
@@ -293,7 +294,7 @@ static int find_matching_ucodes (void)
293 error = -EFAULT; 294 error = -EFAULT;
294 goto out; 295 goto out;
295 } 296 }
296 for (cpu_num = 0; cpu_num < num_online_cpus(); cpu_num++) { 297 for_each_online_cpu(cpu_num) {
297 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; 298 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
298 if (uci->err != MC_NOTFOUND) /* already found a match or not an online cpu*/ 299 if (uci->err != MC_NOTFOUND) /* already found a match or not an online cpu*/
299 continue; 300 continue;
@@ -304,7 +305,9 @@ static int find_matching_ucodes (void)
304 } 305 }
305 } 306 }
306 /* now check if any cpu has matched */ 307 /* now check if any cpu has matched */
307 for (cpu_num = 0, allocated_flag = 0, sum = 0; cpu_num < num_online_cpus(); cpu_num++) { 308 allocated_flag = 0;
309 sum = 0;
310 for_each_online_cpu(cpu_num) {
308 if (ucode_cpu_info[cpu_num].err == MC_MARKED) { 311 if (ucode_cpu_info[cpu_num].err == MC_MARKED) {
309 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; 312 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
310 if (!allocated_flag) { 313 if (!allocated_flag) {
@@ -415,12 +418,12 @@ static int do_microcode_update (void)
415 } 418 }
416 419
417out_free: 420out_free:
418 for (i = 0; i < num_online_cpus(); i++) { 421 for_each_online_cpu(i) {
419 if (ucode_cpu_info[i].mc) { 422 if (ucode_cpu_info[i].mc) {
420 int j; 423 int j;
421 void *tmp = ucode_cpu_info[i].mc; 424 void *tmp = ucode_cpu_info[i].mc;
422 vfree(tmp); 425 vfree(tmp);
423 for (j = i; j < num_online_cpus(); j++) { 426 for_each_online_cpu(j) {
424 if (ucode_cpu_info[j].mc == tmp) 427 if (ucode_cpu_info[j].mc == tmp)
425 ucode_cpu_info[j].mc = NULL; 428 ucode_cpu_info[j].mc = NULL;
426 } 429 }