OSDN Git Service

drm/amdkfd: Use ref count to prevent kfd_process destruction
authorFelix Kuehling <Felix.Kuehling@amd.com>
Mon, 27 Nov 2017 23:29:52 +0000 (18:29 -0500)
committerOded Gabbay <oded.gabbay@gmail.com>
Mon, 27 Nov 2017 23:29:52 +0000 (18:29 -0500)
commitabb208a8d490bac9d765c45f20cf306757733778
tree25b52459315bb9a40411bfa15af7446424435245
parent5ce10687ae5ba2aa06aeaaf3fad9ce64dff45a85
drm/amdkfd: Use ref count to prevent kfd_process destruction

Use a reference counter instead of a lock to prevent process
destruction while functions running out of process context are using
the kfd_process structure. In many cases these functions don't need
the structure to be locked. In the few cases that really do need the
process lock, take it explicitly.

This helps simplify lock dependencies between the process lock and
other locks, particularly amdgpu and mm_struct locks. This will be
important when amdgpu calls back to amdkfd for memory evictions.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
drivers/gpu/drm/amd/amdkfd/kfd_events.c
drivers/gpu/drm/amd/amdkfd/kfd_priv.h
drivers/gpu/drm/amd/amdkfd/kfd_process.c