Skip to content

A bit of struct drm_sched_job cleanup

Tvrtko Ursulin amd-gfx dri-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4drm/sched: Add job popping APIdrivers/gpu/drm/scheduler/sched_entity.c include/drm/gpu_scheduler.h+22 -13 replies
2/4drm/amdgpu: Use the new low level job popping helperdrivers/gpu/drm/amd/amdgpu/amdgpu_job.c+1 -40 replies
3/4drm/sched: Remove to_drm_sched_job internal helperdrivers/gpu/drm/scheduler/sched_entity.c drivers/gpu/drm/scheduler/sched_main.c+14 -142 replies
4/4drm/sched: Make the type of drm_sched_job->last_dependency consistentinclude/drm/gpu_scheduler.h+20 -180 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] A bit of struct drm_sched_job cleanup

At one point I thought I wanted to add a member to struct drm_sched_job. As I noticed there is a hole in the struct, I went to re-order some members to get rid of it (the hole), at which point I was greeted by a subtle bug cause by the frequent pattern of:

job = to_drm_sched_job(spsc_queue_peek|pop(...))

Because to_drm_sched_job is a container of, it implies a lot of the scheduler (and amdgpu) assumes job->queue_node is the first struct element. Dare to change that, code will compile but weird things will happen at runtime.

So I thought lets clean that up and remove that hardcoded sneaky assumption and that is what this series does.

1) Adds a helper so amdgpu can touch the scheduler internals a little bit less.
2) Removes the assumption job->queue_node must be the first element.
3) And finally removes the hole from struct drm_sched_job, fixing one instance of type confusion in passing too.

Cc Christian König <[email protected]>
Cc Danilo Krummrich <[email protected]>
Cc Matthew Brost <[email protected]>
Cc Philipp Stanner <[email protected]>

Tvrtko Ursulin (4):
drm/sched: Add job popping API
drm/amdgpu: Use the new low level job popping helper drm/sched: Remove to_drm_sched_job internal helper drm/sched: Make the type of drm_sched_job->last_dependency consistent

 drivers/gpu/drm/amd/amdgpu/amdgpu_job.c  |  5 +-
 drivers/gpu/drm/scheduler/sched_entity.c | 20 ++++----
 drivers/gpu/drm/scheduler/sched_main.c   | 10 ++--
 include/drm/gpu_scheduler.h              | 59 ++++++++++++++++--------
 4 files changed, 57 insertions(+), 37 deletions(-)
Signature · 1 line
2.47.1