diff options
author | Andi Kleen <ak@suse.de> | 2005-07-29 00:15:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-29 00:46:01 -0400 |
commit | e2cac78935ff1705e1eb53be28da704d3482b4f5 (patch) | |
tree | 1a32474c6a7a27a3b143c52d3864eb635453078e /arch | |
parent | b6a68a16dc15c65fe76acb7502a806ae415cd3e4 (diff) |
[PATCH] x86_64: When running cpuid4 need to run on the correct CPU
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/i386/kernel/cpu/intel_cacheinfo.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/arch/i386/kernel/cpu/intel_cacheinfo.c b/arch/i386/kernel/cpu/intel_cacheinfo.c index 1d768b263269..6c55b50cf048 100644 --- a/arch/i386/kernel/cpu/intel_cacheinfo.c +++ b/arch/i386/kernel/cpu/intel_cacheinfo.c | |||
@@ -128,7 +128,7 @@ static int __devinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_le | |||
128 | cpuid_count(4, index, &eax, &ebx, &ecx, &edx); | 128 | cpuid_count(4, index, &eax, &ebx, &ecx, &edx); |
129 | cache_eax.full = eax; | 129 | cache_eax.full = eax; |
130 | if (cache_eax.split.type == CACHE_TYPE_NULL) | 130 | if (cache_eax.split.type == CACHE_TYPE_NULL) |
131 | return -1; | 131 | return -EIO; /* better error ? */ |
132 | 132 | ||
133 | this_leaf->eax.full = eax; | 133 | this_leaf->eax.full = eax; |
134 | this_leaf->ebx.full = ebx; | 134 | this_leaf->ebx.full = ebx; |
@@ -334,6 +334,7 @@ static int __devinit detect_cache_attributes(unsigned int cpu) | |||
334 | struct _cpuid4_info *this_leaf; | 334 | struct _cpuid4_info *this_leaf; |
335 | unsigned long j; | 335 | unsigned long j; |
336 | int retval; | 336 | int retval; |
337 | cpumask_t oldmask; | ||
337 | 338 | ||
338 | if (num_cache_leaves == 0) | 339 | if (num_cache_leaves == 0) |
339 | return -ENOENT; | 340 | return -ENOENT; |
@@ -345,19 +346,26 @@ static int __devinit detect_cache_attributes(unsigned int cpu) | |||
345 | memset(cpuid4_info[cpu], 0, | 346 | memset(cpuid4_info[cpu], 0, |
346 | sizeof(struct _cpuid4_info) * num_cache_leaves); | 347 | sizeof(struct _cpuid4_info) * num_cache_leaves); |
347 | 348 | ||
349 | oldmask = current->cpus_allowed; | ||
350 | retval = set_cpus_allowed(current, cpumask_of_cpu(cpu)); | ||
351 | if (retval) | ||
352 | goto out; | ||
353 | |||
348 | /* Do cpuid and store the results */ | 354 | /* Do cpuid and store the results */ |
355 | retval = 0; | ||
349 | for (j = 0; j < num_cache_leaves; j++) { | 356 | for (j = 0; j < num_cache_leaves; j++) { |
350 | this_leaf = CPUID4_INFO_IDX(cpu, j); | 357 | this_leaf = CPUID4_INFO_IDX(cpu, j); |
351 | retval = cpuid4_cache_lookup(j, this_leaf); | 358 | retval = cpuid4_cache_lookup(j, this_leaf); |
352 | if (unlikely(retval < 0)) | 359 | if (unlikely(retval < 0)) |
353 | goto err_out; | 360 | break; |
354 | cache_shared_cpu_map_setup(cpu, j); | 361 | cache_shared_cpu_map_setup(cpu, j); |
355 | } | 362 | } |
356 | return 0; | 363 | set_cpus_allowed(current, oldmask); |
357 | 364 | ||
358 | err_out: | 365 | out: |
359 | free_cache_attributes(cpu); | 366 | if (retval) |
360 | return -ENOMEM; | 367 | free_cache_attributes(cpu); |
368 | return retval; | ||
361 | } | 369 | } |
362 | 370 | ||
363 | #ifdef CONFIG_SYSFS | 371 | #ifdef CONFIG_SYSFS |