Re: [PATCH] powerpc/npu-dma.c: Fix deadlock in mmio_invalidate

2018-02-20 Thread Mark Hairgrove
On Mon, 19 Feb 2018, Balbir Singh wrote: > Good point, although I think the acquire_* function itself may be called > from a higher layer with the mmap_sem always held. I wonder if we need > barriers around get and put mmio_atsd_reg. I agree with the need for memory barriers. FWIW, page tables

Re: [PATCH] powerpc/npu-dma.c: Fix deadlock in mmio_invalidate

2018-02-18 Thread Alistair Popple
> > Shouldn't that be enforced with READ_ONCE() then? Yep, I can add that. > Good point, although I think the acquire_* function itself may be called > from a higher layer with the mmap_sem always held. I wonder if we need > barriers around get and put mmio_atsd_reg. test_and_set_bit() should im

Re: [PATCH] powerpc/npu-dma.c: Fix deadlock in mmio_invalidate

2018-02-18 Thread Balbir Singh
On Thu, 15 Feb 2018 19:11:19 -0800 Mark Hairgrove wrote: > On Wed, 14 Feb 2018, Alistair Popple wrote: > > > > > +struct mmio_atsd_reg { > > > > + struct npu *npu; > > > > + int reg; > > > > +}; > > > > + > > > > > > Is it just easier to move reg to inside of struct npu? > > >

Re: [PATCH] powerpc/npu-dma.c: Fix deadlock in mmio_invalidate

2018-02-15 Thread Mark Hairgrove
On Wed, 14 Feb 2018, Alistair Popple wrote: > > > +struct mmio_atsd_reg { > > > + struct npu *npu; > > > + int reg; > > > +}; > > > + > > > > Is it just easier to move reg to inside of struct npu? > > I don't think so, struct npu is global to all npu contexts where as this is > specific to the

Re: [PATCH] powerpc/npu-dma.c: Fix deadlock in mmio_invalidate

2018-02-13 Thread Alistair Popple
> > +struct mmio_atsd_reg { > > + struct npu *npu; > > + int reg; > > +}; > > + > > Is it just easier to move reg to inside of struct npu? I don't think so, struct npu is global to all npu contexts where as this is specific to the given invalidation. We don't have enough registers to assign e

Re: [PATCH] powerpc/npu-dma.c: Fix deadlock in mmio_invalidate

2018-02-12 Thread Balbir Singh
On Tue, 13 Feb 2018 14:17:34 +1100 Alistair Popple wrote: > When sending TLB invalidates to the NPU we need to send extra flushes due > to a hardware issue. The original implementation would lock the all the > ATSD MMIO registers sequentially before unlocking and relocking each of > them sequenti

[PATCH] powerpc/npu-dma.c: Fix deadlock in mmio_invalidate

2018-02-12 Thread Alistair Popple
When sending TLB invalidates to the NPU we need to send extra flushes due to a hardware issue. The original implementation would lock the all the ATSD MMIO registers sequentially before unlocking and relocking each of them sequentially to do the extra flush. This introduced a deadlock as it is pos