[PATCH] powerpc/smp: Do not BUG_ON if invalid CPU during kick

Michael Ellerman mpe at ellerman.id.au
Mon Jun 26 22:49:31 AEST 2017


Santosh Sivaraj <santosh at fossix.org> writes:

> During secondary start, we do not need to BUG_ON if an invalid CPU number
> is passed. We alreay print an error if secondary cannot be started, so
                    ^
                    d
> just return an error instead.
>
> Signed-off-by: Santosh Sivaraj <santosh at fossix.org>
> ---
>  arch/powerpc/kernel/smp.c            | 3 ++-
>  arch/powerpc/platforms/cell/smp.c    | 3 ++-
>  arch/powerpc/platforms/powernv/smp.c | 3 ++-
>  arch/powerpc/platforms/pseries/smp.c | 3 ++-

This looks good to me ...

> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
> index df2a416..05bf583 100644
> --- a/arch/powerpc/kernel/smp.c
> +++ b/arch/powerpc/kernel/smp.c
> @@ -112,7 +112,8 @@ int smp_generic_cpu_bootable(unsigned int nr)
>  #ifdef CONFIG_PPC64
>  int smp_generic_kick_cpu(int nr)
>  {
> -	BUG_ON(nr < 0 || nr >= NR_CPUS);
> +	if (nr < 0 || nr >= NR_CPUS)
> +		return -EINVAL;

Except that these checks should all use nr_cpu_ids AFAICS.

I think they were just written before nr_cpu_ids existed.

Can you send me an incremental patch to switch them to nr_cpu_ids?

cheers


More information about the Linuxppc-dev mailing list