[RFC] sysfs cpu cleanup

David Gibson david at gibson.dropbear.id.au
Fri Nov 19 10:44:44 EST 2004


On Wed, Nov 17, 2004 at 08:59:12AM -0600, Nathan Lynch wrote:
> Hi David-
> 
> On Wed, 2004-11-17 at 18:16 +1100, David Gibson wrote:
> > Current the ppc64 sysfs code registers an entry for each possible cpu
> > in sysfs, rather than just online cpus.  That makes sense, since the
> > sysfs entries are needed to control onlining of the cpus.  However,
> > this is done even if CONFIG_HOTPLUG_CPU is not set, or if it is not a
> > hotplug capable (DLPAR) machine, which is a bit misleading.  Secondly
> > it also registers all the other sysfs entries (physical_id and the pmc
> > stuff) on all possible cpus, although they are quite meaningless on
> > non-online cpus.
> > 
> > This patch alters the code to only register sysfs directories at boot
> > for cpus which are either online or could be onlined (cpu is possible,
> > and CONFIG_HOTPLUG_CPU and an lpar machine).  Furthermore, the entries
> > apart from 'online' itself are only registered for online CPUs (and
> > deregistered again if a cpu goes offline).
> > 
> > Anyone see any problems with this approach?  Also, this has not yet
> > been tested in the presence of actual cpu hotplugging...
> 
> See http://www.ussg.iu.edu/hypermail/linux/kernel/0410.3/0020.html for
> what I think is the best solution to this - dynamic cpu device
> registration.  In short, the driver model "core" would register all
> present cpus at boot, which would be correct regardless of
> CONFIG_HOTPLUG_CPU.  Addition and removal of the sysfs entities should
> correspond to addition and removal of cpus (not online/offline), imo.

Sounds fairly reasonable.

> 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...

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist.  NOT _the_ _other_ _way_
				| _around_!
http://www.ozlabs.org/people/dgibson



More information about the Linuxppc64-dev mailing list