mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
amdkfd: destroy kfd secondary contexts through fd close
Life cycle of a KFD secondary context(kfd_process) is tied to the opened file. Therefore this commit destroy a kfd secondary context when close the fd it belonging to. This commit extracts the code removing the kfd_process from the kfd_process_table to a separate function and call it in kfd_process_notifier_release_internal unconditionally. Signed-off-by: Zhu Lingshan <lingshan.zhu@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
4cd255b969
commit
65cce2a172
@@ -164,8 +164,13 @@ static int kfd_release(struct inode *inode, struct file *filep)
|
||||
{
|
||||
struct kfd_process *process = filep->private_data;
|
||||
|
||||
if (process)
|
||||
kfd_unref_process(process);
|
||||
if (!process)
|
||||
return 0;
|
||||
|
||||
if (process->context_id != KFD_CONTEXT_ID_PRIMARY)
|
||||
kfd_process_notifier_release_internal(process);
|
||||
|
||||
kfd_unref_process(process);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user