summaryrefslogtreecommitdiff
path: root/arch/powerpc/include/asm/powernv.h
diff options
context:
space:
mode:
authorAlistair Popple <alistair@popple.id.au>2018-04-11 16:38:54 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2018-04-24 09:46:56 +1000
commit28a5933e8d362766462ea9e5f135e19f41e658ba (patch)
tree60f2fc855fef3941a2ca52dd5968d971fd4ada80 /arch/powerpc/include/asm/powernv.h
parent7fd6641de28fe9b5bce0c38d2adee0a72a72619e (diff)
powerpc/powernv/npu: Add lock to prevent race in concurrent context init/destroy
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. Fixes: 1ab66d1fbada ("powerpc/powernv: Introduce address translation services for Nvlink2") Cc: stable@vger.kernel.org # v4.12+ Signed-off-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Mark Hairgrove <mhairgrove@nvidia.com> Tested-by: Mark Hairgrove <mhairgrove@nvidia.com> Reviewed-by: Balbir Singh <bsingharora@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/include/asm/powernv.h')
0 files changed, 0 insertions, 0 deletions