Skip to content

drm/sched: Introduce more locking to entity

Philipp Stanner dri-devel lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 6 repliesIn review
  2. v22 patches 1 replySuperseded
  3. v15 patches 10 repliesSuperseded

Changes in v3 from the cover letter

- Fix ordering bug between spsc_queue_pop() and

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3drm/sched: Lock drm_sched_rq_pop_entity() externallydrivers/gpu/drm/scheduler/sched_entity.c drivers/gpu/drm/scheduler/sched_rq.c+4 -20 replies
2/3drm/sched: Lock spsc_queue_pop() in drm_sched_entity_pop_job()drivers/gpu/drm/scheduler/sched_entity.c+1 -20 replies
3/3drm/sched: Protect entity->last_scheduled with spinlockdrivers/gpu/drm/scheduler/sched_entity.c include/drm/gpu_scheduler.h+24 -364 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchChristian König
1/3
2/3
3/3A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/3] drm/sched: Introduce more locking to entity

Changes since v2:
- Fix ordering bug between spsc_queue_pop() and

    drm_sched_rq_pop_entity().

Changes since v1:
- Remove a bunch of patches; make this series only about locking entity->last_scheduled. The rest shall be done in separate patches and series. Consequently, also do not lock spsc_queue, yet.
- Move lock-cycle patch to first position. (Tvrtko)

Both Tvrtko [1] and I [2] have recently proposed some improvals for drm_sched.

While taking Tvrtko's feedback into account for my patch, I realized that both his and my patch can be fully replaced with a bigger and far more beautiful series.

If I am not mistaken, it turns out that the entire entity->entity_idle completion is also nothing but a workaround around the grave mistake of not using the greatest helper with parallel programming that exists in computer science: Locking.

This series adds locking to the last_scheduled field and all checks related to detect the idleness of the entity. As before, the job_scheduled event queue causes the periodic checks.

This way, we can get rid of memory barriers, RCU, a few lines of code, make things more readable, understandable...

Greetings,
Philipp

[1] https://lore.kernel.org/dri-devel/[email protected]/
[2] https://lore.kernel.org/dri-devel/[email protected]/

Philipp Stanner (3):
drm/sched: Lock drm_sched_rq_pop_entity() externally drm/sched: Lock spsc_queue_pop() in drm_sched_entity_pop_job() drm/sched: Protect entity->last_scheduled with spinlock

 drivers/gpu/drm/scheduler/sched_entity.c | 53 ++++++++++--------------
 drivers/gpu/drm/scheduler/sched_rq.c     |  4 +-
 include/drm/gpu_scheduler.h              | 10 ++---
 3 files changed, 28 insertions(+), 39 deletions(-)
Signature · 1 line
2.55.0