forked from luck/tmp_suning_uos_patched
[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>
This commit is contained in:
parent
b6a68a16dc
commit
e2cac78935
@ -128,7 +128,7 @@ static int __devinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_le
|
|||||||
cpuid_count(4, index, &eax, &ebx, &ecx, &edx);
|
cpuid_count(4, index, &eax, &ebx, &ecx, &edx);
|
||||||
cache_eax.full = eax;
|
cache_eax.full = eax;
|
||||||
if (cache_eax.split.type == CACHE_TYPE_NULL)
|
if (cache_eax.split.type == CACHE_TYPE_NULL)
|
||||||
return -1;
|
return -EIO; /* better error ? */
|
||||||
|
|
||||||
this_leaf->eax.full = eax;
|
this_leaf->eax.full = eax;
|
||||||
this_leaf->ebx.full = ebx;
|
this_leaf->ebx.full = ebx;
|
||||||
@ -334,6 +334,7 @@ static int __devinit detect_cache_attributes(unsigned int cpu)
|
|||||||
struct _cpuid4_info *this_leaf;
|
struct _cpuid4_info *this_leaf;
|
||||||
unsigned long j;
|
unsigned long j;
|
||||||
int retval;
|
int retval;
|
||||||
|
cpumask_t oldmask;
|
||||||
|
|
||||||
if (num_cache_leaves == 0)
|
if (num_cache_leaves == 0)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
@ -345,19 +346,26 @@ static int __devinit detect_cache_attributes(unsigned int cpu)
|
|||||||
memset(cpuid4_info[cpu], 0,
|
memset(cpuid4_info[cpu], 0,
|
||||||
sizeof(struct _cpuid4_info) * num_cache_leaves);
|
sizeof(struct _cpuid4_info) * num_cache_leaves);
|
||||||
|
|
||||||
|
oldmask = current->cpus_allowed;
|
||||||
|
retval = set_cpus_allowed(current, cpumask_of_cpu(cpu));
|
||||||
|
if (retval)
|
||||||
|
goto out;
|
||||||
|
|
||||||
/* Do cpuid and store the results */
|
/* Do cpuid and store the results */
|
||||||
|
retval = 0;
|
||||||
for (j = 0; j < num_cache_leaves; j++) {
|
for (j = 0; j < num_cache_leaves; j++) {
|
||||||
this_leaf = CPUID4_INFO_IDX(cpu, j);
|
this_leaf = CPUID4_INFO_IDX(cpu, j);
|
||||||
retval = cpuid4_cache_lookup(j, this_leaf);
|
retval = cpuid4_cache_lookup(j, this_leaf);
|
||||||
if (unlikely(retval < 0))
|
if (unlikely(retval < 0))
|
||||||
goto err_out;
|
break;
|
||||||
cache_shared_cpu_map_setup(cpu, j);
|
cache_shared_cpu_map_setup(cpu, j);
|
||||||
}
|
}
|
||||||
return 0;
|
set_cpus_allowed(current, oldmask);
|
||||||
|
|
||||||
err_out:
|
out:
|
||||||
free_cache_attributes(cpu);
|
if (retval)
|
||||||
return -ENOMEM;
|
free_cache_attributes(cpu);
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_SYSFS
|
#ifdef CONFIG_SYSFS
|
||||||
|
Loading…
Reference in New Issue
Block a user