[RFC] sysfs cpu cleanup

Nathan Lynch nathanl at austin.ibm.com
Thu Nov 18 01:59:12 EST 2004


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.

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.

Nathan




More information about the Linuxppc64-dev mailing list