dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] A bit of struct drm_sched_job cleanup
@ 2025-01-20 16:52 Tvrtko Ursulin
  2025-01-20 16:52 ` [PATCH 1/4] drm/sched: Add job popping API Tvrtko Ursulin
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Tvrtko Ursulin @ 2025-01-20 16:52 UTC (permalink / raw)
  To: amd-gfx, dri-devel
  Cc: kernel-dev, Tvrtko Ursulin, Christian König,
	Danilo Krummrich, Matthew Brost, Philipp Stanner

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 <christian.koenig@amd.com>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Philipp Stanner <phasta@kernel.org>

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(-)

-- 
2.47.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-01-21  9:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-20 16:52 [PATCH 0/4] A bit of struct drm_sched_job cleanup Tvrtko Ursulin
2025-01-20 16:52 ` [PATCH 1/4] drm/sched: Add job popping API Tvrtko Ursulin
2025-01-20 17:13   ` Danilo Krummrich
2025-01-20 18:49     ` Christian König
2025-01-21  9:38       ` Tvrtko Ursulin
2025-01-20 16:52 ` [PATCH 2/4] drm/amdgpu: Use the new low level job popping helper Tvrtko Ursulin
2025-01-20 16:52 ` [PATCH 3/4] drm/sched: Remove to_drm_sched_job internal helper Tvrtko Ursulin
2025-01-20 17:17   ` Danilo Krummrich
2025-01-21  9:45     ` Tvrtko Ursulin
2025-01-20 16:52 ` [PATCH 4/4] drm/sched: Make the type of drm_sched_job->last_dependency consistent Tvrtko Ursulin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox