Files
Tvrtko Ursulin 2ab510e631 drm/sched: Fix virtual runtime race
Prevent pushing a new job to an entity seeing it being the first in the
queue, and hence entering the drm_sched_rq_add_entity() path, if the pop
side in drm_sched_entity_pop_job() has just de-queued the job but not yet
updated the saved virtual time.

Restoring the unsaved virtual time, which is at this point not a delta but
still an absolute value, pushes the said entity to the rear of the run queue
for a potentially very long time.

We close this race by pulling the locked sections out to encompass both
the queue push/pop and corresponding rbtree management.

This is aligned with the future direction to replace the current lockless
job queue with one of the fully locked standard list primitives.

Signed-off-by: Tvrtko Ursulin <[email protected]>
Fixes: 2fa4d8e2c1 ("drm/sched: Add fair scheduling policy")
Suggested-by: [email protected] # via Claude Opus
Tested-by: [email protected]
Cc: Christian König <[email protected]>
Cc: Danilo Krummrich <[email protected]>
Cc: Philipp Stanner <[email protected]>
Cc: Pierre-Eric Pelloux-Prayer <[email protected]>
Cc: Matthew Brost <[email protected]>
Cc: Vitaly Prosyak <[email protected]>
Cc: [email protected] # v7.2+
[phasta: commit title]
Signed-off-by: Philipp Stanner <[email protected]>
Link: https://patch.msgid.link/[email protected]
2026-09-16 09:17:51 +02:00
..
2026-09-16 09:17:51 +02:00