Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 125364
b: refs/heads/master
c: b2bb855
h: refs/heads/master
v: v3
  • Loading branch information
Mike Travis committed Dec 17, 2008
1 parent 5ecdc20 commit 82cf212
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1de88cd4a33fcc2fcf70cbce01688723f728675d
refs/heads/master: b2bb85549134c005e997e5a7ed303bda6a1ae738
41 changes: 19 additions & 22 deletions trunk/arch/x86/kernel/cpu/intel_cacheinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,31 +534,16 @@ static void __cpuinit free_cache_attributes(unsigned int cpu)
per_cpu(cpuid4_info, cpu) = NULL;
}

static int __cpuinit detect_cache_attributes(unsigned int cpu)
static void get_cpu_leaves(void *_retval)
{
struct _cpuid4_info *this_leaf;
unsigned long j;
int retval;
cpumask_t oldmask;

if (num_cache_leaves == 0)
return -ENOENT;

per_cpu(cpuid4_info, cpu) = kzalloc(
sizeof(struct _cpuid4_info) * num_cache_leaves, GFP_KERNEL);
if (per_cpu(cpuid4_info, cpu) == NULL)
return -ENOMEM;

oldmask = current->cpus_allowed;
retval = set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
if (retval)
goto out;
int j, *retval = _retval, cpu = smp_processor_id();

/* Do cpuid and store the results */
for (j = 0; j < num_cache_leaves; j++) {
struct _cpuid4_info *this_leaf;
this_leaf = CPUID4_INFO_IDX(cpu, j);
retval = cpuid4_cache_lookup(j, this_leaf);
if (unlikely(retval < 0)) {
*retval = cpuid4_cache_lookup(j, this_leaf);
if (unlikely(*retval < 0)) {
int i;

for (i = 0; i < j; i++)
Expand All @@ -567,9 +552,21 @@ static int __cpuinit detect_cache_attributes(unsigned int cpu)
}
cache_shared_cpu_map_setup(cpu, j);
}
set_cpus_allowed_ptr(current, &oldmask);
}

static int __cpuinit detect_cache_attributes(unsigned int cpu)
{
int retval;

if (num_cache_leaves == 0)
return -ENOENT;

per_cpu(cpuid4_info, cpu) = kzalloc(
sizeof(struct _cpuid4_info) * num_cache_leaves, GFP_KERNEL);
if (per_cpu(cpuid4_info, cpu) == NULL)
return -ENOMEM;

out:
smp_call_function_single(cpu, get_cpu_leaves, &retval, true);
if (retval) {
kfree(per_cpu(cpuid4_info, cpu));
per_cpu(cpuid4_info, cpu) = NULL;
Expand Down

0 comments on commit 82cf212

Please sign in to comment.