Why do you call "single scheduler" a special case? That seems to be quite a common case.
On Tue, 2026-11-17 at 10:06 +0000, Tvrtko Ursulin wrote: > In order to untangle all this lets make this area behave consistently and > store the single scheduler case directly in the entity. We can do that > easily by creating an union between the current pointer to a list of > schedulers, and a new pointer to the single scheduler. > > This allows removal of the special cases which artificially cleared > entity->sched_list for a single scheduler case and fixes the amdgpu > dynamic priority changes for the single IP instances. > > Signed-off-by: Tvrtko Ursulin <[email protected]> > Fixes: b3ac17667f11 ("drm/scheduler: rework entity creation") Can you describe what the actual bug is? > References: 8c23056bdc7a ("drm/scheduler: do not keep a copy of sched list") > References: 977f7e1068be ("drm/amdgpu: allocate entities on demand") > References: 2316a86bde49 ("drm/amdgpu: change hw sched list on ctx priority > override") > References: ac4eb83ab255 ("drm/sched: select new rq even if there is only one > v3") > References: 981b04d96856 ("drm/sched: improve docs around drm_sched_entity") > References: 77a6809f1dc3 ("drm/sched: Remove FIFO and RR and simplify to a > single run queue") This commit has been reverted. Recently, I often end up a confused by your series'. Is this here another RFC? Is it a preparational patch for your CFS work? > * > - * Note that the &sched_list must have at least one element to schedule the > entity. > + * Note that the &sched_list must have exactly one element to schedule the > + * entity. Callers which pass more than one scheduler on the @sched_list must > + * ensure the list remains valid for the lifetime of the entity. What does that even mean, "valid"? Like, not deallocated? How does drm_sched_entity_modify_sched() play into that? > - sched = drm_sched_pick_best(entity->sched_list, entity->num_sched_list); > + if (entity->num_sched_list == 1) > + sched = entity->sched; > + else > + sched = drm_sched_pick_best(entity->sched_list, > + entity->num_sched_list); So what you want to achieve is that sched_list can never be NULL? How's that a bug? > - struct drm_gpu_scheduler **sched_list; > + union { > + /** > + * @sched_list: > + * > + * A list of schedulers (struct drm_gpu_scheduler). Jobs from > + * this entity can be scheduled on any scheduler on this list. > + * > + * This can be modified by calling > + * drm_sched_entity_modify_sched(). Locking is entirely up to > + * the driver, see the above function for more details. > + */ > + struct drm_gpu_scheduler **sched_list; > + > + /** > + * @sched: > + * > + * A single struct drm_gpu_scheduler jobs from this entity will > + * be scheduled on. > + * > + * This can be modified by calling > + * drm_sched_entity_modify_sched(). Locking is entirely up to > + * the driver, see the above function for more details. > + */ > + struct drm_gpu_scheduler *sched; > + }; So you now would have some mode where there is sometimes a list and sometimes a pointer, and what it is can change dynamically through drm_sched_entity_modify_sched()?? How would that untangle anything? P.
