[PATCH] powerpc/powernv: Fix concurrency issue with npu->mmio_atsd_usage
Alistair Popple
alistair at popple.id.au
Fri Aug 3 14:29:48 AEST 2018
> There may be a long-term way to fix this at a larger scale, but for now
> resolve the immediate problem by gating our call to
> test_and_set_bit_lock() with one to test_bit(), which is obviously
> implemented without using a store.
I am less sure of this now but am continuing to investigate. However this patch
looks good.
Acked-by: Alistair Popple <alistair at popple.id.au>
> Signed-off-by: Reza Arbab <arbab at linux.ibm.com>
> ---
> arch/powerpc/platforms/powernv/npu-dma.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/platforms/powernv/npu-dma.c b/arch/powerpc/platforms/powernv/npu-dma.c
> index 8cdf91f..c773465 100644
> --- a/arch/powerpc/platforms/powernv/npu-dma.c
> +++ b/arch/powerpc/platforms/powernv/npu-dma.c
> @@ -437,8 +437,9 @@ static int get_mmio_atsd_reg(struct npu *npu)
> int i;
>
> for (i = 0; i < npu->mmio_atsd_count; i++) {
> - if (!test_and_set_bit_lock(i, &npu->mmio_atsd_usage))
> - return i;
> + if (!test_bit(i, &npu->mmio_atsd_usage))
> + if (!test_and_set_bit_lock(i, &npu->mmio_atsd_usage))
> + return i;
> }
>
> return -ENOSPC;
>
More information about the Linuxppc-dev
mailing list