Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

amdkfd: introduce new helper kfd_lookup_process_by_id

This commit introduces a new helper function
kfd_lookup_process_by_id which can find a
kfd process that identified by its context id from
the kfd process table

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>

authored by

Zhu Lingshan and committed by
Alex Deucher
07506945 2a667e26

+22
+1
drivers/gpu/drm/amd/amdkfd/kfd_priv.h
··· 1061 1061 struct kfd_process *kfd_lookup_process_by_pasid(u32 pasid, 1062 1062 struct kfd_process_device **pdd); 1063 1063 struct kfd_process *kfd_lookup_process_by_mm(const struct mm_struct *mm); 1064 + struct kfd_process *kfd_lookup_process_by_id(const struct mm_struct *mm, u16 id); 1064 1065 1065 1066 int kfd_process_gpuidx_from_gpuid(struct kfd_process *p, uint32_t gpu_id); 1066 1067 int kfd_process_gpuid_from_node(struct kfd_process *p, struct kfd_node *node,
+21
drivers/gpu/drm/amd/amdkfd/kfd_process.c
··· 1959 1959 return p; 1960 1960 } 1961 1961 1962 + /* This increments the process->ref counter. */ 1963 + struct kfd_process *kfd_lookup_process_by_id(const struct mm_struct *mm, u16 id) 1964 + { 1965 + struct kfd_process *p, *ret_p = NULL; 1966 + unsigned int temp; 1967 + 1968 + int idx = srcu_read_lock(&kfd_processes_srcu); 1969 + 1970 + hash_for_each_rcu(kfd_processes_table, temp, p, kfd_processes) { 1971 + if (p->mm == mm && p->context_id == id) { 1972 + kref_get(&p->ref); 1973 + ret_p = p; 1974 + break; 1975 + } 1976 + } 1977 + 1978 + srcu_read_unlock(&kfd_processes_srcu, idx); 1979 + 1980 + return ret_p; 1981 + } 1982 + 1962 1983 /* kfd_process_evict_queues - Evict all user queues of a process 1963 1984 * 1964 1985 * Eviction is reference-counted per process-device. This means multiple