[PATCH v2] powerpc/imc: Dont create debugfs files for cpu-less nodes

Qian Cai cai at lca.pw
Tue Jul 16 04:41:15 AEST 2019


On Thu, 2019-07-11 at 14:53 +1000, Michael Ellerman wrote:
> Hi Maddy,
> 
> Madhavan Srinivasan <maddy at linux.vnet.ibm.com> writes:
> > diff --git a/arch/powerpc/platforms/powernv/opal-imc.c
> > b/arch/powerpc/platforms/powernv/opal-imc.c
> > index 186109bdd41b..e04b20625cb9 100644
> > --- a/arch/powerpc/platforms/powernv/opal-imc.c
> > +++ b/arch/powerpc/platforms/powernv/opal-imc.c
> > @@ -69,20 +69,20 @@ static void export_imc_mode_and_cmd(struct device_node
> > *node,
> >  	if (of_property_read_u32(node, "cb_offset", &cb_offset))
> >  		cb_offset = IMC_CNTL_BLK_OFFSET;
> >  
> > -	for_each_node(nid) {
> > -		loc = (u64)(pmu_ptr->mem_info[chip].vbase) + cb_offset;
> > +	while (ptr->vbase != NULL) {
> 
> This means you'll bail out as soon as you find a node with no vbase, but
> it's possible we could have a CPU-less node intermingled with other
> nodes.
> 
> So I think you want to keep the for loop, but continue if you see a NULL
> vbase?

Not sure if this will also takes care of some of those messages during the boot
on today's linux-next even without this patch.


[   18.077780][    T1] debugfs: Directory 'imc' with parent 'powerpc' already
present!

where it has the following layout,
# numactl -H
available: 6 nodes (0,8,252-255)
node 0 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
53 54 55 56 57 58 59 60 61 62 63
node 0 size: 130197 MB
node 0 free: 127453 MB
node 8 cpus: 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
node 8 size: 130778 MB
node 8 free: 128119 MB
node 252 cpus:
node 252 size: 0 MB
node 252 free: 0 MB
node 253 cpus:
node 253 size: 0 MB
node 253 free: 0 MB
node 254 cpus:
node 254 size: 0 MB
node 254 free: 0 MB
node 255 cpus:
node 255 size: 0 MB
node 255 free: 0 MB
node distances:
node   0   8  252  253  254  255 
  0:  10  40  80  80  80  80 
  8:  40  10  80  80  80  80 
 252:  80  80  10  80  80  80 
 253:  80  80  80  10  80  80 
 254:  80  80  80  80  10  80 
 255:  80  80  80  80  80  10

> 
> 
> > +		loc = (u64)(ptr->vbase) + cb_offset;
> >  		imc_mode_addr = (u64 *)(loc + IMC_CNTL_BLK_MODE_OFFSET);
> > -		sprintf(mode, "imc_mode_%d", nid);
> > +		sprintf(mode, "imc_mode_%d", (u32)(ptr->id));
> >  		if (!imc_debugfs_create_x64(mode, 0600, imc_debugfs_parent,
> >  					    imc_mode_addr))
> >  			goto err;
> >  
> >  		imc_cmd_addr = (u64 *)(loc + IMC_CNTL_BLK_CMD_OFFSET);
> > -		sprintf(cmd, "imc_cmd_%d", nid);
> > +		sprintf(cmd, "imc_cmd_%d", (u32)(ptr->id));
> >  		if (!imc_debugfs_create_x64(cmd, 0600, imc_debugfs_parent,
> >  					    imc_cmd_addr))
> >  			goto err;
> > -		chip++;
> > +		ptr++;
> >  	}
> >  	return;
> 
> cheers


More information about the Linuxppc-dev mailing list