drm/amdkfd: Fixed kfd_process cleanup on module exit.
authorDavid Belanger <david.belanger@amd.com>
Tue, 28 Feb 2023 19:11:24 +0000 (14:11 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 15 Mar 2023 22:45:26 +0000 (18:45 -0400)
commit22e3d9343b8292dfd8c72a5a539dc1ad4829b87a
tree131349c3920538d8c617cfc83d90e9807899fca6
parent3726b6e7c0f1842a2ffdfd5921c95f69c0524808
drm/amdkfd: Fixed kfd_process cleanup on module exit.

Handle case when module is unloaded (kfd_exit) before a process space
(mm_struct) is released.

v2: Fixed potential race conditions by removing all kfd_process from
the process table first, then working on releasing the resources.

v3: Fixed loop element access / synchronization.  Fixed extra empty lines.

Signed-off-by: David Belanger <david.belanger@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_module.c
drivers/gpu/drm/amd/amdkfd/kfd_priv.h
drivers/gpu/drm/amd/amdkfd/kfd_process.c