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.

drm/sched: Add warning for removing hack in drm_sched_fini()

The assembled developers agreed at the X.Org Developers Conference 2025
that the hack added for amdgpu in drm_sched_fini() shall be removed. It
shouldn't be needed by amdgpu anymore.

As it's unclear whether all drivers really follow the life time rule of
entities having to be torn down before their scheduler, it is reasonable
to warn for a while before removing the hack.

Add a warning in drm_sched_fini() that fires if an entity is still
active.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Philipp Stanner <phasta@kernel.org>
Link: https://patch.msgid.link/20251023123429.139848-2-phasta@kernel.org

+8 -1
+8 -1
drivers/gpu/drm/scheduler/sched_main.c
··· 1425 1425 struct drm_sched_rq *rq = sched->sched_rq[i]; 1426 1426 1427 1427 spin_lock(&rq->lock); 1428 - list_for_each_entry(s_entity, &rq->entities, list) 1428 + list_for_each_entry(s_entity, &rq->entities, list) { 1429 1429 /* 1430 1430 * Prevents reinsertion and marks job_queue as idle, 1431 1431 * it will be removed from the rq in drm_sched_entity_fini() ··· 1446 1446 * For now, this remains a potential race in all 1447 1447 * drivers that keep entities alive for longer than 1448 1448 * the scheduler. 1449 + * 1450 + * The READ_ONCE() is there to make the lockless read 1451 + * (warning about the lockless write below) slightly 1452 + * less broken... 1449 1453 */ 1454 + if (!READ_ONCE(s_entity->stopped)) 1455 + dev_warn(sched->dev, "Tearing down scheduler with active entities!\n"); 1450 1456 s_entity->stopped = true; 1457 + } 1451 1458 spin_unlock(&rq->lock); 1452 1459 kfree(sched->sched_rq[i]); 1453 1460 }