diff mbox

[PATCH/RFC] sysfs cache code rewrite

Message ID 20090107094611.GD7376@localdomain (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Nathan Lynch Jan. 7, 2009, 9:46 a.m. UTC
Benjamin Herrenschmidt wrote:
> 
> > I don't know quite the detail of the new cpumask stuff ... It could be
> > as simple as passing a pointer instead of the value in the
> > cpumask_scnprintf call though...
> 
> Actually, I'll do more tests and if that ends up being the only needed
> change, I'll push your patch with that small change out to powerpc next
> tonight.

Sorry about that, here's an incremental... let me know if you want the
whole thing re-posted.

Thanks.

Comments

Benjamin Herrenschmidt Jan. 7, 2009, 10:15 a.m. UTC | #1
On Wed, 2009-01-07 at 03:46 -0600, Nathan Lynch wrote:
> Benjamin Herrenschmidt wrote:
> > 
> > > I don't know quite the detail of the new cpumask stuff ... It could be
> > > as simple as passing a pointer instead of the value in the
> > > cpumask_scnprintf call though...
> > 
> > Actually, I'll do more tests and if that ends up being the only needed
> > change, I'll push your patch with that small change out to powerpc next
> > tonight.
> 
> Sorry about that, here's an incremental... let me know if you want the
> whole thing re-posted.

Nah, that's fine. I did that exact change in the patch before putting
in my tree. I haven't had a chance to test boot tho, did you ?

Cheers,
Ben.

> Thanks.
> 
> 
> diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c
> index f3e3ae3..b33f041 100644
> --- a/arch/powerpc/kernel/cacheinfo.c
> +++ b/arch/powerpc/kernel/cacheinfo.c
> @@ -611,7 +611,7 @@ static ssize_t shared_cpu_map_show(struct kobject *k, struct kobj_attribute *att
>  	len = PAGE_SIZE - 2;
>  
>  	if (len > 1) {
> -		n = cpumask_scnprintf(buf, len, cache->shared_cpu_map);
> +		n = cpumask_scnprintf(buf, len, &cache->shared_cpu_map);
>  		buf[n++] = '\n';
>  		buf[n] = '\0';
>  	}
Nathan Lynch Jan. 7, 2009, 6:48 p.m. UTC | #2
Benjamin Herrenschmidt wrote:
> On Wed, 2009-01-07 at 03:46 -0600, Nathan Lynch wrote:
> > Benjamin Herrenschmidt wrote:
> > > 
> > > > I don't know quite the detail of the new cpumask stuff ... It could be
> > > > as simple as passing a pointer instead of the value in the
> > > > cpumask_scnprintf call though...
> > > 
> > > Actually, I'll do more tests and if that ends up being the only needed
> > > change, I'll push your patch with that small change out to powerpc next
> > > tonight.
> > 
> > Sorry about that, here's an incremental... let me know if you want the
> > whole thing re-posted.
> 
> Nah, that's fine. I did that exact change in the patch before putting
> in my tree. I haven't had a chance to test boot tho, did you ?

I have now, on Power6, with latest Linus -git snapshot; comes up fine
and the shared_cpu_map attrs display as expected.  This one is in
shared processor mode so we only have L1 information:

# uname -r
2.6.28-git9-autokern1
# grep -r . /sys/devices/system/cpu/cpu*/cache
/sys/devices/system/cpu/cpu0/cache/index0/type:Data
/sys/devices/system/cpu/cpu0/cache/index0/level:1
/sys/devices/system/cpu/cpu0/cache/index0/shared_cpu_map:00000000,00000000,00000000,00000003
/sys/devices/system/cpu/cpu0/cache/index0/size:64K
/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size:128
/sys/devices/system/cpu/cpu0/cache/index0/number_of_sets:128
/sys/devices/system/cpu/cpu0/cache/index0/ways_of_associativity:4
/sys/devices/system/cpu/cpu0/cache/index1/type:Instruction
/sys/devices/system/cpu/cpu0/cache/index1/level:1
/sys/devices/system/cpu/cpu0/cache/index1/shared_cpu_map:00000000,00000000,00000000,00000003
/sys/devices/system/cpu/cpu0/cache/index1/size:64K
/sys/devices/system/cpu/cpu0/cache/index1/coherency_line_size:128
/sys/devices/system/cpu/cpu0/cache/index1/number_of_sets:128
/sys/devices/system/cpu/cpu0/cache/index1/ways_of_associativity:4
/sys/devices/system/cpu/cpu1/cache/index0/type:Data
/sys/devices/system/cpu/cpu1/cache/index0/level:1
/sys/devices/system/cpu/cpu1/cache/index0/shared_cpu_map:00000000,00000000,00000000,00000003
/sys/devices/system/cpu/cpu1/cache/index0/size:64K
/sys/devices/system/cpu/cpu1/cache/index0/coherency_line_size:128
/sys/devices/system/cpu/cpu1/cache/index0/number_of_sets:128
/sys/devices/system/cpu/cpu1/cache/index0/ways_of_associativity:4
/sys/devices/system/cpu/cpu1/cache/index1/type:Instruction
/sys/devices/system/cpu/cpu1/cache/index1/level:1
/sys/devices/system/cpu/cpu1/cache/index1/shared_cpu_map:00000000,00000000,00000000,00000003
/sys/devices/system/cpu/cpu1/cache/index1/size:64K
/sys/devices/system/cpu/cpu1/cache/index1/coherency_line_size:128
/sys/devices/system/cpu/cpu1/cache/index1/number_of_sets:128
/sys/devices/system/cpu/cpu1/cache/index1/ways_of_associativity:4
/sys/devices/system/cpu/cpu2/cache/index0/type:Data
/sys/devices/system/cpu/cpu2/cache/index0/level:1
/sys/devices/system/cpu/cpu2/cache/index0/shared_cpu_map:00000000,00000000,00000000,0000000c
/sys/devices/system/cpu/cpu2/cache/index0/size:64K
/sys/devices/system/cpu/cpu2/cache/index0/coherency_line_size:128
/sys/devices/system/cpu/cpu2/cache/index0/number_of_sets:128
/sys/devices/system/cpu/cpu2/cache/index0/ways_of_associativity:4
/sys/devices/system/cpu/cpu2/cache/index1/type:Instruction
/sys/devices/system/cpu/cpu2/cache/index1/level:1
/sys/devices/system/cpu/cpu2/cache/index1/shared_cpu_map:00000000,00000000,00000000,0000000c
/sys/devices/system/cpu/cpu2/cache/index1/size:64K
/sys/devices/system/cpu/cpu2/cache/index1/coherency_line_size:128
/sys/devices/system/cpu/cpu2/cache/index1/number_of_sets:128
/sys/devices/system/cpu/cpu2/cache/index1/ways_of_associativity:4
/sys/devices/system/cpu/cpu3/cache/index0/type:Data
/sys/devices/system/cpu/cpu3/cache/index0/level:1
/sys/devices/system/cpu/cpu3/cache/index0/shared_cpu_map:00000000,00000000,00000000,0000000c
/sys/devices/system/cpu/cpu3/cache/index0/size:64K
/sys/devices/system/cpu/cpu3/cache/index0/coherency_line_size:128
/sys/devices/system/cpu/cpu3/cache/index0/number_of_sets:128
/sys/devices/system/cpu/cpu3/cache/index0/ways_of_associativity:4
/sys/devices/system/cpu/cpu3/cache/index1/type:Instruction
/sys/devices/system/cpu/cpu3/cache/index1/level:1
/sys/devices/system/cpu/cpu3/cache/index1/shared_cpu_map:00000000,00000000,00000000,0000000c
/sys/devices/system/cpu/cpu3/cache/index1/size:64K
/sys/devices/system/cpu/cpu3/cache/index1/coherency_line_size:128
/sys/devices/system/cpu/cpu3/cache/index1/number_of_sets:128
/sys/devices/system/cpu/cpu3/cache/index1/ways_of_associativity:4
/sys/devices/system/cpu/cpu4/cache/index0/type:Data
/sys/devices/system/cpu/cpu4/cache/index0/level:1
/sys/devices/system/cpu/cpu4/cache/index0/shared_cpu_map:00000000,00000000,00000000,00000030
/sys/devices/system/cpu/cpu4/cache/index0/size:64K
/sys/devices/system/cpu/cpu4/cache/index0/coherency_line_size:128
/sys/devices/system/cpu/cpu4/cache/index0/number_of_sets:128
/sys/devices/system/cpu/cpu4/cache/index0/ways_of_associativity:4
/sys/devices/system/cpu/cpu4/cache/index1/type:Instruction
/sys/devices/system/cpu/cpu4/cache/index1/level:1
/sys/devices/system/cpu/cpu4/cache/index1/shared_cpu_map:00000000,00000000,00000000,00000030
/sys/devices/system/cpu/cpu4/cache/index1/size:64K
/sys/devices/system/cpu/cpu4/cache/index1/coherency_line_size:128
/sys/devices/system/cpu/cpu4/cache/index1/number_of_sets:128
/sys/devices/system/cpu/cpu4/cache/index1/ways_of_associativity:4
/sys/devices/system/cpu/cpu5/cache/index0/type:Data
/sys/devices/system/cpu/cpu5/cache/index0/level:1
/sys/devices/system/cpu/cpu5/cache/index0/shared_cpu_map:00000000,00000000,00000000,00000030
/sys/devices/system/cpu/cpu5/cache/index0/size:64K
/sys/devices/system/cpu/cpu5/cache/index0/coherency_line_size:128
/sys/devices/system/cpu/cpu5/cache/index0/number_of_sets:128
/sys/devices/system/cpu/cpu5/cache/index0/ways_of_associativity:4
/sys/devices/system/cpu/cpu5/cache/index1/type:Instruction
/sys/devices/system/cpu/cpu5/cache/index1/level:1
/sys/devices/system/cpu/cpu5/cache/index1/shared_cpu_map:00000000,00000000,00000000,00000030
/sys/devices/system/cpu/cpu5/cache/index1/size:64K
/sys/devices/system/cpu/cpu5/cache/index1/coherency_line_size:128
/sys/devices/system/cpu/cpu5/cache/index1/number_of_sets:128
/sys/devices/system/cpu/cpu5/cache/index1/ways_of_associativity:4
/sys/devices/system/cpu/cpu6/cache/index0/type:Data
/sys/devices/system/cpu/cpu6/cache/index0/level:1
/sys/devices/system/cpu/cpu6/cache/index0/shared_cpu_map:00000000,00000000,00000000,000000c0
/sys/devices/system/cpu/cpu6/cache/index0/size:64K
/sys/devices/system/cpu/cpu6/cache/index0/coherency_line_size:128
/sys/devices/system/cpu/cpu6/cache/index0/number_of_sets:128
/sys/devices/system/cpu/cpu6/cache/index0/ways_of_associativity:4
/sys/devices/system/cpu/cpu6/cache/index1/type:Instruction
/sys/devices/system/cpu/cpu6/cache/index1/level:1
/sys/devices/system/cpu/cpu6/cache/index1/shared_cpu_map:00000000,00000000,00000000,000000c0
/sys/devices/system/cpu/cpu6/cache/index1/size:64K
/sys/devices/system/cpu/cpu6/cache/index1/coherency_line_size:128
/sys/devices/system/cpu/cpu6/cache/index1/number_of_sets:128
/sys/devices/system/cpu/cpu6/cache/index1/ways_of_associativity:4
/sys/devices/system/cpu/cpu7/cache/index0/type:Data
/sys/devices/system/cpu/cpu7/cache/index0/level:1
/sys/devices/system/cpu/cpu7/cache/index0/shared_cpu_map:00000000,00000000,00000000,000000c0
/sys/devices/system/cpu/cpu7/cache/index0/size:64K
/sys/devices/system/cpu/cpu7/cache/index0/coherency_line_size:128
/sys/devices/system/cpu/cpu7/cache/index0/number_of_sets:128
/sys/devices/system/cpu/cpu7/cache/index0/ways_of_associativity:4
/sys/devices/system/cpu/cpu7/cache/index1/type:Instruction
/sys/devices/system/cpu/cpu7/cache/index1/level:1
/sys/devices/system/cpu/cpu7/cache/index1/shared_cpu_map:00000000,00000000,00000000,000000c0
/sys/devices/system/cpu/cpu7/cache/index1/size:64K
/sys/devices/system/cpu/cpu7/cache/index1/coherency_line_size:128
/sys/devices/system/cpu/cpu7/cache/index1/number_of_sets:128
/sys/devices/system/cpu/cpu7/cache/index1/ways_of_associativity:4
diff mbox

Patch

diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c
index f3e3ae3..b33f041 100644
--- a/arch/powerpc/kernel/cacheinfo.c
+++ b/arch/powerpc/kernel/cacheinfo.c
@@ -611,7 +611,7 @@  static ssize_t shared_cpu_map_show(struct kobject *k, struct kobj_attribute *att
 	len = PAGE_SIZE - 2;
 
 	if (len > 1) {
-		n = cpumask_scnprintf(buf, len, cache->shared_cpu_map);
+		n = cpumask_scnprintf(buf, len, &cache->shared_cpu_map);
 		buf[n++] = '\n';
 		buf[n] = '\0';
 	}