Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 91079
b: refs/heads/master
c: fb0f330
h: refs/heads/master
i:
  91077: 281399c
  91075: 8c1ff1a
  91071: 351f76a
v: v3
  • Loading branch information
Mike Travis authored and Ingo Molnar committed Apr 19, 2008
1 parent 72e1a1e commit eecc984
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 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: 9f0e8d0400d925c3acd5f4e01dbeb736e4011882
refs/heads/master: fb0f330e62d71f7c535251438068199af320cf73
30 changes: 23 additions & 7 deletions trunk/arch/x86/kernel/cpu/intel_cacheinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,20 +591,34 @@ static ssize_t show_size(struct _cpuid4_info *this_leaf, char *buf)
return sprintf (buf, "%luK\n", this_leaf->size / 1024);
}

static ssize_t show_shared_cpu_map(struct _cpuid4_info *this_leaf, char *buf)
static ssize_t show_shared_cpu_map_func(struct _cpuid4_info *this_leaf,
int type, char *buf)
{
ptrdiff_t len = PTR_ALIGN(buf + PAGE_SIZE - 1, PAGE_SIZE) - buf;
int n = 0;
int len = cpumask_scnprintf_len(nr_cpu_ids);
char *mask_str = kmalloc(len, GFP_KERNEL);

if (mask_str) {
cpumask_scnprintf(mask_str, len, this_leaf->shared_cpu_map);
n = sprintf(buf, "%s\n", mask_str);
kfree(mask_str);
if (len > 1) {
cpumask_t *mask = &this_leaf->shared_cpu_map;

n = type?
cpulist_scnprintf(buf, len-2, *mask):
cpumask_scnprintf(buf, len-2, *mask);
buf[n++] = '\n';
buf[n] = '\0';
}
return n;
}

static inline ssize_t show_shared_cpu_map(struct _cpuid4_info *leaf, char *buf)
{
return show_shared_cpu_map_func(leaf, 0, buf);
}

static inline ssize_t show_shared_cpu_list(struct _cpuid4_info *leaf, char *buf)
{
return show_shared_cpu_map_func(leaf, 1, buf);
}

static ssize_t show_type(struct _cpuid4_info *this_leaf, char *buf) {
switch(this_leaf->eax.split.type) {
case CACHE_TYPE_DATA:
Expand Down Expand Up @@ -640,6 +654,7 @@ define_one_ro(ways_of_associativity);
define_one_ro(number_of_sets);
define_one_ro(size);
define_one_ro(shared_cpu_map);
define_one_ro(shared_cpu_list);

static struct attribute * default_attrs[] = {
&type.attr,
Expand All @@ -650,6 +665,7 @@ static struct attribute * default_attrs[] = {
&number_of_sets.attr,
&size.attr,
&shared_cpu_map.attr,
&shared_cpu_list.attr,
NULL
};

Expand Down

0 comments on commit eecc984

Please sign in to comment.