[Skiboot] [PATCH 1/2] core: Fix iteration condition to skip garded cpu

Nicholas Piggin npiggin at gmail.com
Thu Apr 19 01:51:11 AEST 2018


On Wed, 18 Apr 2018 21:06:45 +0530
Vaidyanathan Srinivasan <svaidy at linux.vnet.ibm.com> wrote:

> Fix the logic error in the loop that iterated incorrectly
> over garded cpu.
> 
> Signed-off-by: Vaidyanathan Srinivasan <svaidy at linux.vnet.ibm.com>
> ---
>  core/cpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/core/cpu.c b/core/cpu.c
> index 6826fee0..369eb5b9 100644
> --- a/core/cpu.c
> +++ b/core/cpu.c
> @@ -734,7 +734,7 @@ struct cpu_thread *next_ungarded_primary(struct cpu_thread *cpu)
>  {
>  	do {
>  		cpu = next_cpu(cpu);
> -	} while(cpu && cpu->state == cpu_state_unavailable && cpu->primary != cpu);
> +	} while(cpu && (cpu->state == cpu_state_unavailable || cpu->primary != cpu));
>  
>  	return cpu;
>  }

Wow, good catch, thanks.

Reviewed-by: Nicholas Piggin <npiggin at gmail.com>


More information about the Skiboot mailing list