Re: [PATCH -fixes v2] riscv: Fix fully ordered LR/SC xchg[8|16]() implementations

From: Andrea Parri
Date: Thu May 30 2024 - 11:19:08 EST


On Thu, May 30, 2024 at 04:55:46PM +0200, Alexandre Ghiti wrote:
> The fully ordered versions of xchg[8|16]() using LR/SC lack the
> necessary memory barriers to guarantee the order.
>
> Fix this by matching what is already implemented in the fully ordered
> versions of cmpxchg() using LR/SC.
>
> Suggested-by: Andrea Parri <parri.andrea@xxxxxxxxx>
> Reported-by: Andrea Parri <parri.andrea@xxxxxxxxx>
> Closes: https://lore.kernel.org/linux-riscv/ZlYbupL5XgzgA0MX@andrea/T/#u
> Fixes: a8ed2b7a2c13 ("riscv/cmpxchg: Implement xchg for variables of size 1 and 2")
> Signed-off-by: Alexandre Ghiti <alexghiti@xxxxxxxxxxxx>

Reviewed-by: Andrea Parri <parri.andrea@xxxxxxxxx>

Thanks!

Andrea