> 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 <alist...@popple.id.au> > Signed-off-by: Reza Arbab <ar...@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; >