Skip to contentSkip to conversation

amdkfd: properly free secondary context id

PATCH In review Zhu Lingshan 2 participants 2 messages Jul 1 – Jul 6

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 amdkfd: properly free secondary context id

Function kfd_process_free_id() should skip over the primary kfd process because its context id is fixed assigned, not allocated through the ida table. This function should only work on secondary contexts.

Fixes fac682a1d1af ("amdkfd: identify a secondary kfd process by its id")
---
 drivers/gpu/drm/amd/amdkfd/kfd_process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_process.c +1 -1
index 8e701dcda8ec..d0c083e018b2 100644
@@ -931,7 +931,7 @@ static void kfd_process_free_id(struct kfd_process *process)
 {
 	struct kfd_process *primary_process;
 
-	if (process->context_id != KFD_CONTEXT_ID_PRIMARY)
+	if (process->context_id == KFD_CONTEXT_ID_PRIMARY)
 		return;
 
 	primary_process = kfd_lookup_process_by_mm(process->lead_thread->mm);
Signature · 1 line
2.53.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Zhu Lingshan

Function kfd_process_free_id() should skip over the primary kfd process because its context id is fixed assigned, not allocated through the ida table. This function should only work on secondary contexts.

Fixes fac682a1d1af ("amdkfd: identify a secondary kfd process by its id")
Quoted 17 lines
---
  drivers/gpu/drm/amd/amdkfd/kfd_process.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_process.c +1 -1
index 8e701dcda8ec..d0c083e018b2 100644
@@ -931,7 +931,7 @@ static void kfd_process_free_id(struct kfd_process *process)
  {
  	struct kfd_process *primary_process;
 
-	if (process->context_id != KFD_CONTEXT_ID_PRIMARY)
+	if (process->context_id == KFD_CONTEXT_ID_PRIMARY)
  		return;
 
  	primary_process = kfd_lookup_process_by_mm(process->lead_thread->mm);