Subject: Re: [PATCH 17/18] powerpc/smp: Increase vdso_data->processorCount, not just decrease it

From: Michael Ellerman <[email-masked]>
Date: Thu, 10 Mar 2011 14:41:07 +1100

On Tue, 2011-03-08 at 17:37 +1100, Benjamin Herrenschmidt wrote:
> Signed-off-by: Benjamin Herrenschmidt <[email-masked]>
> ---
>  arch/powerpc/kernel/smp.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
> index e337073..6023395 100644
> --- a/arch/powerpc/kernel/smp.c
> +++ b/arch/powerpc/kernel/smp.c
> @@ -551,6 +551,10 @@ void __devinit start_secondary(void *unused)
>  
>  	secondary_cpu_time_init();
>  
> +#ifdef CONFIG_PPC64
> +	if (system_state == SYSTEM_RUNNING)
> +		vdso_data->processorCount++;
> +#endif

So the SYSTEM_RUNNING check is to avoid clashing with the logic in
smp_setup_cpu_maps() I presume:

arch/powerpc/kernel/setup-common.c:     vdso_data->processorCount = num_present_cpus();

But why not remove that, and let the increment in start_secondary() do
all the work?

With the current code if a cpu is present but fails to come up the count
will be wrong I think.

cheers