[RFC] sysfs cpu cleanup

Nathan Lynch nathanl at austin.ibm.com
Tue Nov 23 05:58:54 EST 2004


On Thu, 2004-11-18 at 20:30, David Gibson wrote:
> Index: working-2.6/arch/ppc64/kernel/smp.c
> ===================================================================
> --- working-2.6.orig/arch/ppc64/kernel/smp.c	2004-10-19 13:37:56.000000000 +1000
> +++ working-2.6/arch/ppc64/kernel/smp.c	2004-11-17 17:56:42.000000000 +1100
> @@ -82,6 +82,8 @@
>  void smp_call_function_interrupt(void);
>  extern long register_vpa(unsigned long flags, unsigned long proc,
>  			 unsigned long vpa);
> +extern void register_cpu_online(int cpu);
> +extern void unregister_cpu_online(int cpu);
>  
>  int smt_enabled_at_boot = 1;
>  
> @@ -291,6 +293,8 @@
>  	int cpu_status;
>  	unsigned int pcpu = get_hard_smp_processor_id(cpu);
>  
> +	unregister_cpu_online(cpu);
> +
>  	for (tries = 0; tries < 25; tries++) {
>  		cpu_status = query_cpu_stopped(pcpu);
>  		if (cpu_status == 0 || cpu_status == -1)
> @@ -919,6 +923,11 @@
>  	while (!cpu_online(cpu))
>  		cpu_relax();
>  
> +#ifdef CONFIG_HOTPLUG_CPU
> +	if (system_state >= SYSTEM_RUNNING) /* This is a hotplug */
> +		register_cpu_online(cpu);
> +#endif /* CONFIG_HOTPLUG_CPU */
> +
>  	return 0;
>  }

I apologize for not noticing this before :/

Instead of explicitly calling into the sysfs.c code from smp.c, I think
it would be better to use a cpu hotplug notifier block.  Even without
CONFIG_HOTPLUG_CPU turned on, you get the "online" notification at boot
for each cpu as it is brought up.  See the ppc64 numa code for an
example usage.


Nathan




More information about the Linuxppc64-dev mailing list