[1/2] powernv/npu: Add lock to prevent race in concurrent context init/destroy

Michael Ellerman patch-notifications at ellerman.id.au
Tue Apr 24 13:48:26 AEST 2018


On Wed, 2018-04-11 at 06:38:54 UTC, Alistair Popple wrote:
> The pnv_npu2_init_context() and pnv_npu2_destroy_context() functions are
> used to allocate/free contexts to allow address translation and shootdown
> by the NPU on a particular GPU. Context initialisation is implicitly safe
> as it is protected by the requirement mmap_sem be held in write mode,
> however pnv_npu2_destroy_context() does not require mmap_sem to be held and
> it is not safe to call with a concurrent initialisation for a different
> GPU.
> 
> It was assumed the driver would ensure destruction was not called
> concurrently with initialisation. However the driver may be simplified by
> allowing concurrent initialisation and destruction for different GPUs. As
> npu context creation/destruction is not a performance critical path and the
> critical section is not large a single spinlock is used for simplicity.
> 
> Signed-off-by: Alistair Popple <alistair at popple.id.au>
> Reviewed-by: Mark Hairgrove <mhairgrove at nvidia.com>
> Tested-by: Mark Hairgrove <mhairgrove at nvidia.com>
> Reviewed-by: Balbir Singh <bsingharora at gmail.com>

Series applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/28a5933e8d362766462ea9e5f135e1

cheers


More information about the Linuxppc-dev mailing list