Skip to content

Commit 9e8b320

Browse files
nowrepPhilipp Stanner
authored andcommitted
drm/sched: avoid killing parent entity on child SIGKILL
The DRM scheduler tracks who last uses an entity and when that process is killed blocks all further submissions to that entity. The problem is that we didn't track who initially created an entity, so when a process accidently leaked its file descriptor to a child and that child got killed, we killed the parent's entities. Avoid that and instead initialize the entities last user on entity creation. This also allows to drop the extra NULL check. Signed-off-by: David Rosca <[email protected]> Signed-off-by: Christian König <[email protected]> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4568 Reviewed-by: Alex Deucher <[email protected]> CC: [email protected] Acked-by: Philipp Stanner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Philipp Stanner <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent a042bea commit 9e8b320

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpu/drm/scheduler/sched_entity.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,
7070
entity->guilty = guilty;
7171
entity->num_sched_list = num_sched_list;
7272
entity->priority = priority;
73+
entity->last_user = current->group_leader;
7374
/*
7475
* It's perfectly valid to initialize an entity without having a valid
7576
* scheduler attached. It's just not valid to use the scheduler before it
@@ -302,7 +303,7 @@ long drm_sched_entity_flush(struct drm_sched_entity *entity, long timeout)
302303

303304
/* For a killed process disallow further enqueueing of jobs. */
304305
last_user = cmpxchg(&entity->last_user, current->group_leader, NULL);
305-
if ((!last_user || last_user == current->group_leader) &&
306+
if (last_user == current->group_leader &&
306307
(current->flags & PF_EXITING) && (current->exit_code == SIGKILL))
307308
drm_sched_entity_kill(entity);
308309

0 commit comments

Comments
 (0)