[RFC] sysfs cpu cleanup

Nathan Lynch nathanl at austin.ibm.com
Fri Nov 19 11:22:02 EST 2004


On Thu, 2004-11-18 at 17:44, David Gibson wrote:
> On Wed, Nov 17, 2004 at 08:59:12AM -0600, Nathan Lynch wrote:
> > Of course, I haven't had much time to work on this lately.  Your patch
> > looks fine to me except for the treatment of the physical_id attribute.
> > We need this to be present even on offline cpus, because it is sometimes
> > used to determine which cpu to start.
> 
> Well, I did wonder about the physical_id attribute.  However for the
> time being, at least, the physical_id showed as 0 for all offline
> CPUs, so at present it's not meaningful for offline CPUs - maybe it
> should be, in which case there's another bug...

Hmm, are you sure that's the case?  Cpus which are possible but not
present have the bogus physical_id, yes, and this has always bugged me,
but a cpu which is offlined retains its physical_id value.  Example from
a system with 2 present cpus and 8 possible cpus:

linux:~ # cat listcpus.sh
#!/bin/bash

for cpu in $(find /sys/devices/system/cpu/ -type d -name 'cpu*') ; do
echo -ne "$cpu"
echo -ne "\tonline $(cat $cpu/online)"
echo -ne "\tphysical_id $(cat $cpu/physical_id)"
echo
done

linux:~ # ./listcpus.sh 
/sys/devices/system/cpu/cpu7    online 0        physical_id 0
/sys/devices/system/cpu/cpu6    online 0        physical_id 0
/sys/devices/system/cpu/cpu5    online 0        physical_id 0
/sys/devices/system/cpu/cpu4    online 0        physical_id 0
/sys/devices/system/cpu/cpu3    online 0        physical_id 0
/sys/devices/system/cpu/cpu2    online 0        physical_id 0
/sys/devices/system/cpu/cpu1    online 1        physical_id 1
/sys/devices/system/cpu/cpu0    online 1        physical_id 0
linux:~ # echo 0 > /sys/devices/system/cpu/cpu1/online 
linux:~ # ./listcpus.sh 
/sys/devices/system/cpu/cpu7    online 0        physical_id 0
/sys/devices/system/cpu/cpu6    online 0        physical_id 0
/sys/devices/system/cpu/cpu5    online 0        physical_id 0
/sys/devices/system/cpu/cpu4    online 0        physical_id 0
/sys/devices/system/cpu/cpu3    online 0        physical_id 0
/sys/devices/system/cpu/cpu2    online 0        physical_id 0
/sys/devices/system/cpu/cpu1    online 0        physical_id 1
/sys/devices/system/cpu/cpu0    online 1        physical_id 0

It looks like Olof's early processor spinup patch from a few days ago
would change the physical_id attribute to show -1 for nonpresent cpus,
fwiw.

Nathan




More information about the Linuxppc64-dev mailing list