Subject: Re: [PATCH 08/12] powerpc: Annotate accesses to ipi message flags

From: "Nicholas Piggin" <[email-masked]>
Date: Tue, 09 May 2023 12:28:11 +1000

On Mon May 8, 2023 at 12:01 PM AEST, Rohan McLure wrote:
> IPI message flags are observed and consequently consumed in the
> smp_ipi_demux_relaxed function, which handles these message sources
> until it observes none more arriving. Mark the checked loop guard with
> READ_ONCE, to signal to KCSAN that the read is known to be volatile, and
> that non-determinism is expected.

smp_muxed_ipi_set_message() doesn't need a WRITE_ONCE()?

Thanks,
Nick

>
> Signed-off-by: Rohan McLure <[email-masked]>
> ---
>  arch/powerpc/kernel/smp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
> index 6b90f10a6c81..00b74d66b771 100644
> --- a/arch/powerpc/kernel/smp.c
> +++ b/arch/powerpc/kernel/smp.c
> @@ -348,7 +348,7 @@ irqreturn_t smp_ipi_demux_relaxed(void)
>  		if (all & IPI_MESSAGE(PPC_MSG_NMI_IPI))
>  			nmi_ipi_action(0, NULL);
>  #endif
> -	} while (info->messages);
> +	} while (READ_ONCE(info->messages));
>  
>  	return IRQ_HANDLED;
>  }
> -- 
> 2.37.2