Re: [RFC v7 10/12] drm/sched: Break submission patterns with some randomness

2025-07-28 Thread Tvrtko Ursulin
On 28/07/2025 10:28, Pierre-Eric Pelloux-Prayer wrote: Le 24/07/2025 à 16:19, Tvrtko Ursulin a écrit : GPUs generally don't implement preemption and DRM scheduler definitely does not support it at the front end scheduling level. This means execution quanta can be quite long and is contr

Re: [RFC v7 00/12] Fair DRM scheduler

2025-07-28 Thread Tvrtko Ursulin
On 24/07/2025 15:19, Tvrtko Ursulin wrote: As a summary, the new scheduling algorithm is insipired by the original Linux CFS and so far no scheduling regressions have been found relative to FIFO. There are improvements in fairness and scheduling of interactive clients when running in parallel

Re: [RFC 20/23] cgroup/drm: Introduce weight based scheduling control

2025-07-25 Thread Tvrtko Ursulin
On 02/06/2025 17:22, Michal Koutný wrote: Hello. Hi and apologies for the delay. On Fri, May 02, 2025 at 01:32:53PM +0100, Tvrtko Ursulin wrote: From: Tvrtko Ursulin Similar to CPU and IO scheduling, implement a concept of weight in the DRM cgroup controller. Individual drivers are

[RFC v7 08/12] drm/sched: Remove idle entity from tree

2025-07-24 Thread Tvrtko Ursulin
the tree only containing runnable entities. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu/drm/scheduler/sched_rq.c | 28 +--- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a

[RFC v7 12/12] drm/sched: Embed run queue singleton into the scheduler

2025-07-24 Thread Tvrtko Ursulin
Now that the run queue to scheduler relationship is always 1:1 we can embed it (the run queue) directly in the scheduler struct and save on some allocation error handling code and such. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp

[RFC v7 11/12] drm/sched: Remove FIFO and RR and simplify to a single run queue

2025-07-24 Thread Tvrtko Ursulin
so rename it to just the tree. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c| 23 ++-- drivers/gpu/drm/scheduler/sched_entity.c | 29 + drivers/gpu/drm/scheduler

[RFC v7 10/12] drm/sched: Break submission patterns with some randomness

2025-07-24 Thread Tvrtko Ursulin
way to look at this is that it is adding a little bit of limited random round-robin behaviour to the fair scheduling algorithm. Net effect is a significant improvemnt to the scheduling unit tests which check the scheduling quality for the interactive client running in parallel with GPU hogs. S

[RFC v7 09/12] drm/sched: Add fair scheduling policy

2025-07-24 Thread Tvrtko Ursulin
. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner Cc: Pierre-Eric Pelloux-Prayer --- drivers/gpu/drm/scheduler/sched_entity.c | 28 ++-- drivers/gpu/drm/scheduler/sched_internal.h | 7 +- drivers/gpu/drm/scheduler/sched_main.c

[RFC v7 07/12] drm/sched: Account entity GPU time

2025-07-24 Thread Tvrtko Ursulin
e has been calculated. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu/drm/scheduler/sched_entity.c | 39 + drivers/gpu/drm/scheduler/sched_internal.h | 66 ++ drivers/gpu/drm/sche

[RFC v7 06/12] drm/sched: Free all finished jobs at once

2025-07-24 Thread Tvrtko Ursulin
the submission side of things. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu/drm/scheduler/sched_main.c | 13 ++--- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/scheduler

[RFC v7 05/12] drm/sched: Move run queue related code into a separate file

2025-07-24 Thread Tvrtko Ursulin
Lets move all the code dealing with struct drm_sched_rq into a separate compilation unit. Advantage being sched_main.c is left with a clearer set of responsibilities. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu

[RFC v7 01/12] drm/sched: Add some scheduling quality unit tests

2025-07-24 Thread Tvrtko Ursulin
ng for 9ms (effective 10% GPU load). Here we can see the PCT and CPS reflecting real progress. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner Cc: Pierre-Eric Pelloux-Prayer Acked-by: Christian König --- drivers/gpu/drm/scheduler/test

[RFC v7 04/12] drm/sched: Consolidate entity run queue management

2025-07-24 Thread Tvrtko Ursulin
Move the code dealing with entities entering and exiting run queues to helpers to logically separate it from jobs entering and exiting entities. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu/drm/scheduler

[RFC v7 03/12] drm/sched: Implement RR via FIFO

2025-07-24 Thread Tvrtko Ursulin
to a single code path and remove a bunch of code. Downside is round-robin mode now needs to lock on the job pop path but that should not be visible. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu/drm/scheduler/sched_ent

[RFC v7 02/12] drm/sched: Add some more scheduling quality unit tests

2025-07-24 Thread Tvrtko Ursulin
(x100)=60 Every 100ms for the duration of the test test logs how many jobs each client had completed, prefixed by minimum, average and maximum numbers. When finished overall average delta between max and min is output as a rough indicator to scheduling fairness. Signed-off-by: Tvrtko Ursulin Cc

[RFC v7 00/12] Fair DRM scheduler

2025-07-24 Thread Tvrtko Ursulin
w Brost Cc: Philipp Stanner Cc: Pierre-Eric Pelloux-Prayer Cc: Michel Dänzer Tvrtko Ursulin (12): drm/sched: Add some scheduling quality unit tests drm/sched: Add some more scheduling quality unit tests drm/sched: Implement RR via FIFO drm/sched: Consolidate entity run queue management

Re: [PATCH] drm/sched: Avoid double re-lock on the job free path

2025-07-18 Thread Tvrtko Ursulin
On 18/07/2025 10:41, Philipp Stanner wrote: On Fri, 2025-07-18 at 10:35 +0100, Tvrtko Ursulin wrote: On 18/07/2025 10:31, Philipp Stanner wrote: On Fri, 2025-07-18 at 08:13 +0100, Tvrtko Ursulin wrote: On 16/07/2025 21:44, Maíra Canal wrote: Hi Tvrtko, On 16/07/25 11:46, Tvrtko Ursulin

Re: [PATCH] drm/sched: Avoid double re-lock on the job free path

2025-07-18 Thread Tvrtko Ursulin
On 18/07/2025 10:31, Philipp Stanner wrote: On Fri, 2025-07-18 at 08:13 +0100, Tvrtko Ursulin wrote: On 16/07/2025 21:44, Maíra Canal wrote: Hi Tvrtko, On 16/07/25 11:46, Tvrtko Ursulin wrote: On 16/07/2025 15:30, Maíra Canal wrote: Hi Tvrtko, On 16/07/25 10:49, Tvrtko Ursulin wrote

Re: [PATCH] drm/sched: Avoid double re-lock on the job free path

2025-07-18 Thread Tvrtko Ursulin
On 16/07/2025 21:44, Maíra Canal wrote: Hi Tvrtko, On 16/07/25 11:46, Tvrtko Ursulin wrote: On 16/07/2025 15:30, Maíra Canal wrote: Hi Tvrtko, On 16/07/25 10:49, Tvrtko Ursulin wrote: On 16/07/2025 14:31, Maíra Canal wrote: Hi Tvrtko, On 16/07/25 05:51, Tvrtko Ursulin wrote: Currently

[PATCH] drm/sched: Consolidate drm_sched_job_timedout

2025-07-16 Thread Tvrtko Ursulin
the code would rely on the TDR handler restarting itself then it would fail to do that if the job arrived on the pending list after the check. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Maíra Canal Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu/drm

Re: [PATCH] drm/sched: Avoid double re-lock on the job free path

2025-07-16 Thread Tvrtko Ursulin
On 16/07/2025 15:30, Maíra Canal wrote: Hi Tvrtko, On 16/07/25 10:49, Tvrtko Ursulin wrote: On 16/07/2025 14:31, Maíra Canal wrote: Hi Tvrtko, On 16/07/25 05:51, Tvrtko Ursulin wrote: Currently the job free work item will lock sched->job_list_lock first time to see if there are any j

Re: [RFC] drm/amdgpu/sdma5.2: Avoid latencies caused by the powergating workaround

2025-07-16 Thread Tvrtko Ursulin
On 16/07/2025 14:00, Christian König wrote: On 16.07.25 14:51, Tvrtko Ursulin wrote: be disabled once GFX/SDMA is no longer active.  In this particular case there was a race condition somewhere in the internal handshaking with SDMA which led to SDMA missing doorbells sometimes and not

Re: [PATCH] drm/sched: Avoid double re-lock on the job free path

2025-07-16 Thread Tvrtko Ursulin
On 16/07/2025 14:31, Maíra Canal wrote: Hi Tvrtko, On 16/07/25 05:51, Tvrtko Ursulin wrote: Currently the job free work item will lock sched->job_list_lock first time to see if there are any jobs, free a single job, and then lock again to decide whether to re-queue itself if there are m

Re: [RFC] drm/amdgpu/sdma5.2: Avoid latencies caused by the powergating workaround

2025-07-16 Thread Tvrtko Ursulin
On 11/07/2025 17:51, Alex Deucher wrote: On Fri, Jul 11, 2025 at 12:07 PM Tvrtko Ursulin wrote: On 11/07/2025 16:51, Alex Deucher wrote: On Fri, Jul 11, 2025 at 9:58 AM Tvrtko Ursulin wrote: On 11/07/2025 14:39, Alex Deucher wrote: On Fri, Jul 11, 2025 at 9:22 AM Tvrtko Ursulin

[PATCH] drm/sched: Avoid double re-lock on the job free path

2025-07-16 Thread Tvrtko Ursulin
we can simply add the signaled check and have it return the presence of more jobs to be freed to the caller. That way the work item does not have to lock the list again and repeat the signaled check. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Maíra Canal Cc: Matt

Re: [PATCH v2] drm/sched: Avoid double re-lock on the job free path

2025-07-14 Thread Tvrtko Ursulin
On 12/07/2025 14:12, Maíra Canal wrote: Hi Danilo, On 7/11/25 16:22, Danilo Krummrich wrote: On 7/11/25 9:08 PM, Maíra Canal wrote: Hi Tvrtko, On 11/07/25 12:09, Tvrtko Ursulin wrote: Currently the job free work item will lock sched->job_list_lock first time to see if there are any j

Re: [RFC] drm/amdgpu/sdma5.2: Avoid latencies caused by the powergating workaround

2025-07-11 Thread Tvrtko Ursulin
On 11/07/2025 16:51, Alex Deucher wrote: On Fri, Jul 11, 2025 at 9:58 AM Tvrtko Ursulin wrote: On 11/07/2025 14:39, Alex Deucher wrote: On Fri, Jul 11, 2025 at 9:22 AM Tvrtko Ursulin wrote: On 11/07/2025 13:45, Christian König wrote: On 11.07.25 14:23, Tvrtko Ursulin wrote: Commit

Re: [PATCH] drm/sched: Avoid double re-lock on the job free path

2025-07-11 Thread Tvrtko Ursulin
On 11/07/2025 14:04, Philipp Stanner wrote: Late to the party; had overlooked that the discussion with Matt is resolved. Some comments below On Tue, 2025-07-08 at 13:20 +0100, Tvrtko Ursulin wrote: Currently the job free work item will lock sched->job_list_lock first time to see if there

[PATCH v2] drm/sched: Avoid double re-lock on the job free path

2025-07-11 Thread Tvrtko Ursulin
we can simply add the signaled check and have it return the presence of more jobs to be freed to the caller. That way the work item does not have to lock the list again and repeat the signaled check. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost

Re: [RFC] drm/amdgpu/sdma5.2: Avoid latencies caused by the powergating workaround

2025-07-11 Thread Tvrtko Ursulin
On 11/07/2025 14:39, Alex Deucher wrote: On Fri, Jul 11, 2025 at 9:22 AM Tvrtko Ursulin wrote: On 11/07/2025 13:45, Christian König wrote: On 11.07.25 14:23, Tvrtko Ursulin wrote: Commit 94b1e028e15c ("drm/amdgpu/sdma5.2: add begin/end_use ring callbacks") added a workar

Re: [RFC] drm/amdgpu/sdma5.2: Avoid latencies caused by the powergating workaround

2025-07-11 Thread Tvrtko Ursulin
On 11/07/2025 13:45, Christian König wrote: On 11.07.25 14:23, Tvrtko Ursulin wrote: Commit 94b1e028e15c ("drm/amdgpu/sdma5.2: add begin/end_use ring callbacks") added a workaround which disables GFXOFF for the duration of the job submit stage (with a 100ms trailing hysteresis). E

Re: [PATCH] drm/sched: Avoid double re-lock on the job free path

2025-07-11 Thread Tvrtko Ursulin
On 09/07/2025 18:22, Matthew Brost wrote: On Wed, Jul 09, 2025 at 11:49:44AM +0100, Tvrtko Ursulin wrote: On 09/07/2025 05:45, Matthew Brost wrote: On Tue, Jul 08, 2025 at 01:20:32PM +0100, Tvrtko Ursulin wrote: Currently the job free work item will lock sched->job_list_lock first time

[PATCH] drm/amdgpu: Cache some values in ring emission helpers

2025-07-11 Thread Tvrtko Ursulin
14021147-255 jpeg_v1_0_decode_ring_emit_fence17881507-281 Total: Before=8949691, After=8929695, chg -0.22% Signed-off-by: Tvrtko Ursulin --- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 16 ++-- 1 file changed, 10 insertions(+), 6

[RFC] drm/amdgpu/sdma5.2: Avoid latencies caused by the powergating workaround

2025-07-11 Thread Tvrtko Ursulin
E_EWMA(latency, 6, 4)) - Approximately 30 SDMA submissions per second, ewma average logged once per second therefore significantly hides the worst case latency. Eg. the real improvement in max submission latency is severely understated by these numbers. Signed-off-by: Tvrtko Ursulin References

Re: [PATCH] drm/sched: Avoid double re-lock on the job free path

2025-07-09 Thread Tvrtko Ursulin
On 09/07/2025 05:45, Matthew Brost wrote: On Tue, Jul 08, 2025 at 01:20:32PM +0100, Tvrtko Ursulin wrote: Currently the job free work item will lock sched->job_list_lock first time to see if there are any jobs, free a single job, and then lock again to decide whether to re-queue itself

Re: [PATCH v6 14/15] drm/sched: Queue all free credits in one worker invocation

2025-07-08 Thread Tvrtko Ursulin
On 08/07/2025 14:02, Christian König wrote: On 08.07.25 14:54, Tvrtko Ursulin wrote: On 08/07/2025 13:37, Christian König wrote: On 08.07.25 11:51, Tvrtko Ursulin wrote: There is no reason to queue just a single job if scheduler can take more and re-queue the worker to queue more. That&#

Re: [PATCH v4] drm/sched: Use struct for drm_sched_init() params

2025-07-08 Thread Tvrtko Ursulin
d Panthor Reviewed-by: Christian Gmeiner # for Etnaviv Reviewed-by: Frank Binns # for Imagination Reviewed-by: Tvrtko Ursulin # for Sched Reviewed-by: Maíra Canal # for v3d --- Changes in v4: - Add forgotten driver accel/amdxdna. (Me) - Rephrase the "init to NULL" comments. (Tvrtk

Re: [PATCH v6 14/15] drm/sched: Queue all free credits in one worker invocation

2025-07-08 Thread Tvrtko Ursulin
On 08/07/2025 13:37, Christian König wrote: On 08.07.25 11:51, Tvrtko Ursulin wrote: There is no reason to queue just a single job if scheduler can take more and re-queue the worker to queue more. That's not correct. This was intentionally avoided. If more than just the scheduler is

Re: [PATCH v6 14/15] drm/sched: Queue all free credits in one worker invocation

2025-07-08 Thread Tvrtko Ursulin
On 08/07/2025 13:19, Philipp Stanner wrote: On Tue, 2025-07-08 at 10:51 +0100, Tvrtko Ursulin wrote: There is no reason to queue just a single job if scheduler can take more and re-queue the worker to queue more. We can simply feed the hardware with as much as it can take in one go and

Re: [PATCH v6 05/15] drm/sched: Consolidate drm_sched_rq_select_entity_rr

2025-07-08 Thread Tvrtko Ursulin
On 08/07/2025 12:31, Philipp Stanner wrote: On Tue, 2025-07-08 at 10:51 +0100, Tvrtko Ursulin wrote: Extract out two copies of the identical code to function epilogue to make it smaller and more readable. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew

Re: [PATCH v6 03/15] drm/sched: Avoid double re-lock on the job free path

2025-07-08 Thread Tvrtko Ursulin
On 08/07/2025 12:22, Philipp Stanner wrote: On Tue, 2025-07-08 at 10:51 +0100, Tvrtko Ursulin wrote: Currently the job free work item will lock sched->job_list_lock first time to see if there are any jobs, free a single job, and then lock again to decide whether to re-queue itself if th

[PATCH] drm/sched: Consolidate drm_sched_rq_select_entity_rr

2025-07-08 Thread Tvrtko Ursulin
Extract out two copies of the identical code to function epilogue to make it smaller and more readable. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu/drm/scheduler/sched_main.c | 48 +++--- 1

[PATCH] drm/sched: Avoid double re-lock on the job free path

2025-07-08 Thread Tvrtko Ursulin
we can simply add the signaled check and have it return the presence of more jobs to free to the caller. That way the work item does not have to lock the list again and repeat the signaled check. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Phil

Re: [PATCH 0/4] Use memdup_user & co where applicable

2025-07-08 Thread Tvrtko Ursulin
On 12/06/2025 11:44, Tvrtko Ursulin wrote: Replace some allocate + copy_from_user patterns with dedicated helpers. This shrinks the source code and is also good for security due SLAB bucket separation between the kernel and uapi. Any takers for easy reviews? Regards, Tvrtko Tvrtko

[PATCH v6 15/15] drm/sched: Embed run queue singleton into the scheduler

2025-07-08 Thread Tvrtko Ursulin
Now that the run queue to scheduler relationship is always 1:1 we can embed it (the run queue) directly in the scheduler struct and save on some allocation error handling code and such. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp

[PATCH v6 12/15] drm/sched: Add fair scheduling policy

2025-07-08 Thread Tvrtko Ursulin
. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner Cc: Pierre-Eric Pelloux-Prayer --- drivers/gpu/drm/scheduler/sched_entity.c | 28 + drivers/gpu/drm/scheduler/sched_internal.h | 70 +- drivers/gpu/drm

[PATCH v6 06/15] drm/sched: Implement RR via FIFO

2025-07-08 Thread Tvrtko Ursulin
should not be visible. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu/drm/scheduler/sched_entity.c | 46 -- drivers/gpu/drm/scheduler/sched_main.c | 76 ++-- include/drm

[PATCH v6 10/15] drm/sched: Account entity GPU time

2025-07-08 Thread Tvrtko Ursulin
e has been calculated. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu/drm/scheduler/sched_entity.c | 39 + drivers/gpu/drm/scheduler/sched_internal.h | 66 ++ drivers/gpu/drm/sche

[PATCH v6 09/15] drm/sched: Free all finished jobs at once

2025-07-08 Thread Tvrtko Ursulin
the submission side of things. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu/drm/scheduler/sched_main.c | 13 ++--- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/scheduler

[PATCH v6 08/15] drm/sched: Move run queue related code into a separate file

2025-07-08 Thread Tvrtko Ursulin
Lets move all the code dealing with struct drm_sched_rq into a separate compilation unit. Advantage being sched_main.c is left with a clearer set of responsibilities. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu

[PATCH v6 14/15] drm/sched: Queue all free credits in one worker invocation

2025-07-08 Thread Tvrtko Ursulin
There is no reason to queue just a single job if scheduler can take more and re-queue the worker to queue more. We can simply feed the hardware with as much as it can take in one go and hopefully win some latency. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc

[PATCH v6 11/15] drm/sched: Remove idle entity from tree

2025-07-08 Thread Tvrtko Ursulin
There is no need to keep entities with no jobs in the tree so lets remove it once the last job is consumed. This keeps the tree smaller which is nicer and more efficient as entities are removed and re-added on every popped job. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo

[PATCH v6 13/15] drm/sched: Remove FIFO and RR and simplify to a single run queue

2025-07-08 Thread Tvrtko Ursulin
so rename it to just the tree. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c| 23 ++-- drivers/gpu/drm/scheduler/sched_entity.c | 29 + drivers/gpu/drm/scheduler

[PATCH v6 01/15] drm/sched: Add some scheduling quality unit tests

2025-07-08 Thread Tvrtko Ursulin
ng for 9ms (effective 10% GPU load). Here we can see the PCT and CPS reflecting real progress. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner Cc: Pierre-Eric Pelloux-Prayer Acked-by: Christian König --- drivers/gpu/drm/scheduler/test

[PATCH v6 04/15] drm/sched: Consolidate drm_sched_job_timedout

2025-07-08 Thread Tvrtko Ursulin
the code would rely on the TDR handler restarting itself then it would fail to do that if the job arrived on the pending list after the check. Also fix one stale comment while touching the function. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc

[PATCH v6 00/15] Fair DRM scheduler

2025-07-08 Thread Tvrtko Ursulin
-lock on the job free path". (Maira, Philipp) Cc: Christian König Cc: Danilo Krummrich CC: Leo Liu Cc: Matthew Brost Cc: Philipp Stanner Cc: Pierre-Eric Pelloux-Prayer Cc: Michel Dänzer Tvrtko Ursulin (15): drm/sched: Add some scheduling quality unit tests drm/sched: Add some more

[PATCH v6 05/15] drm/sched: Consolidate drm_sched_rq_select_entity_rr

2025-07-08 Thread Tvrtko Ursulin
Extract out two copies of the identical code to function epilogue to make it smaller and more readable. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu/drm/scheduler/sched_main.c | 48 +++--- 1

[PATCH v6 07/15] drm/sched: Consolidate entity run queue management

2025-07-08 Thread Tvrtko Ursulin
Move the code dealing with entities entering and exiting run queues to helpers to logically separate it from jobs entering and exiting entities. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu/drm/scheduler

[PATCH v6 03/15] drm/sched: Avoid double re-lock on the job free path

2025-07-08 Thread Tvrtko Ursulin
we can simply add the signaled check and have it return the presence of more jobs to free to the caller. That way the work item does not have to lock the list again and repeat the signaled check. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Phil

[PATCH v6 02/15] drm/sched: Add some more scheduling quality unit tests

2025-07-08 Thread Tvrtko Ursulin
(x100)=60 Every 100ms for the duration of the test test logs how many jobs each client had completed, prefixed by minimum, average and maximum numbers. When finished overall average delta between max and min is output as a rough indicator to scheduling fairness. Signed-off-by: Tvrtko Ursulin Cc

Re: [PATCH v5 11/16] drm/sched: Account entity GPU time

2025-07-07 Thread Tvrtko Ursulin
On 04/07/2025 15:18, Maíra Canal wrote: Hi Tvrtko, In general, LGTM, but I miss documentation for all the new structures and functions that you implemented. Okay, I added some kerneldoc locally. Regards, Tvrtko On 23/06/25 09:27, Tvrtko Ursulin wrote: To implement fair scheduling we

Re: [PATCH v5 08/16] drm/sched: Consolidate entity run queue management

2025-07-04 Thread Tvrtko Ursulin
On 04/07/2025 14:51, Maíra Canal wrote: Hi Tvrtko, On 23/06/25 09:27, Tvrtko Ursulin wrote: Move the code dealing with entities entering and exiting run queues to helpers to logically separate it from jobs entering and exiting entities. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc

Re: [PATCH v5 04/16] drm/sched: Avoid double re-lock on the job free path

2025-07-04 Thread Tvrtko Ursulin
On 04/07/2025 14:59, Philipp Stanner wrote: On Fri, 2025-07-04 at 14:30 +0100, Tvrtko Ursulin wrote: On 04/07/2025 13:56, Philipp Stanner wrote: On Fri, 2025-07-04 at 09:29 -0300, Maíra Canal wrote: Hi Tvrtko, On 23/06/25 09:27, Tvrtko Ursulin wrote: Currently the job free work item will

Re: [PATCH v5 06/16] drm/sched: Consolidate drm_sched_rq_select_entity_rr

2025-07-04 Thread Tvrtko Ursulin
On 04/07/2025 14:32, Maíra Canal wrote: Hi Tvrtko, On 23/06/25 09:27, Tvrtko Ursulin wrote: Extract out two copies of the identical code to function epilogue to make it smaller and more readable. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc

Re: [PATCH v5 07/16] drm/sched: Implement RR via FIFO

2025-07-04 Thread Tvrtko Ursulin
On 04/07/2025 14:18, Maíra Canal wrote: Hi Tvrtko, On 23/06/25 09:27, Tvrtko Ursulin wrote: Round-robin being the non-default policy and unclear how much it is used, we can notice that it can be implemented using the FIFO data structures if we only invent a fake submit timestamp which is

Re: [PATCH v5 04/16] drm/sched: Avoid double re-lock on the job free path

2025-07-04 Thread Tvrtko Ursulin
On 04/07/2025 13:56, Philipp Stanner wrote: On Fri, 2025-07-04 at 09:29 -0300, Maíra Canal wrote: Hi Tvrtko, On 23/06/25 09:27, Tvrtko Ursulin wrote: Currently the job free work item will lock sched->job_list_lock first time to see if there are any jobs, free a single job, and then l

Re: [PATCH v5 03/16] drm/sched: De-clutter drm_sched_init

2025-07-04 Thread Tvrtko Ursulin
On 04/07/2025 13:59, Philipp Stanner wrote: On Mon, 2025-06-23 at 13:27 +0100, Tvrtko Ursulin wrote: Move work queue allocation into a helper for a more streamlined function body. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner

Re: [PATCH v5 3/5] drm: add debugfs support on per client-id basis

2025-06-26 Thread Tvrtko Ursulin
On 24/06/2025 12:34, Sunil Khatri wrote: add support to add a directory for each client-id with root at the dri level. Since the clients are unique and not just related to one single drm device, so it makes more sense to add all the client based nodes with root as dri. Also create a symlink ba

Re: [PATCH] drm/amdgpu: put ctx's ref count in amdgpu_ctx_mgr_entity_fini()

2025-06-25 Thread Tvrtko Ursulin
) Signed-off-by: Lin.Cao Reviewed-by: Tvrtko Ursulin Acked-by: Christian König Looks good to me. Regards, Tvrtko *From:* Koenig, Christian *Sent:* Tuesday, June 24, 2025 21:11 *To:* Tvrtko Ursulin ; cao, lin ; amd-g

Re: [PATCH] drm/amdgpu: put ctx's ref count in amdgpu_ctx_mgr_entity_fini()

2025-06-24 Thread Tvrtko Ursulin
ed and cause memleak. Ouch I removed the wrong one. :( Probably misread kref_put as kref_read.. Reviewed-by: Tvrtko Ursulin But is the SHA correct? I see it is dd64956685fa. Which would mean adding: Fixes: dd64956685fa ("drm/amdgpu: Remove duplicated "context still alive" chec

Re: [PATCH v4 2/4] drm: add debugfs support on per client-id basis

2025-06-23 Thread Tvrtko Ursulin
On 23/06/2025 15:55, Christian König wrote: On 23.06.25 15:07, Tvrtko Ursulin wrote: On 23/06/2025 11:24, Khatri, Sunil wrote: On 6/23/2025 2:58 PM, Tvrtko Ursulin wrote: On 18/06/2025 14:47, Sunil Khatri wrote: add support to add a directory for each client-id with root at the dri

Re: [PATCH v4 2/4] drm: add debugfs support on per client-id basis

2025-06-23 Thread Tvrtko Ursulin
On 23/06/2025 11:24, Khatri, Sunil wrote: On 6/23/2025 2:58 PM, Tvrtko Ursulin wrote: On 18/06/2025 14:47, Sunil Khatri wrote: add support to add a directory for each client-id with root at the dri level. Since the clients are unique and not just related to one single drm device, so it

[PATCH v5 11/16] drm/sched: Account entity GPU time

2025-06-23 Thread Tvrtko Ursulin
e has been calculated. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu/drm/scheduler/sched_entity.c | 29 drivers/gpu/drm/scheduler/sched_internal.h | 40 ++ drivers/gpu/drm/sche

[PATCH v5 14/16] drm/sched: Remove FIFO and RR and simplify to a single run queue

2025-06-23 Thread Tvrtko Ursulin
so rename it to just the tree. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c| 23 ++-- drivers/gpu/drm/scheduler/sched_entity.c | 29 + drivers/gpu/drm/scheduler

[PATCH v5 16/16] drm/sched: Embed run queue singleton into the scheduler

2025-06-23 Thread Tvrtko Ursulin
Now that the run queue to scheduler relationship is always 1:1 we can embed it (the run queue) directly in the scheduler struct and save on some allocation error handling code and such. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp

[PATCH v5 13/16] drm/sched: Add fair scheduling policy

2025-06-23 Thread Tvrtko Ursulin
. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner Cc: Pierre-Eric Pelloux-Prayer --- drivers/gpu/drm/scheduler/sched_entity.c | 28 + drivers/gpu/drm/scheduler/sched_internal.h | 70 +- drivers/gpu/drm

[PATCH v5 07/16] drm/sched: Implement RR via FIFO

2025-06-23 Thread Tvrtko Ursulin
should not be visible. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu/drm/scheduler/sched_entity.c | 45 -- drivers/gpu/drm/scheduler/sched_main.c | 76 ++-- include/drm

[PATCH v5 00/16] Fair DRM scheduler

2025-06-23 Thread Tvrtko Ursulin
mprove commit message justification for one patch. (Philipp) * Add comment in drm_sched_alloc_wq. (Christian) Cc: Christian König Cc: Danilo Krummrich CC: Leo Liu Cc: Matthew Brost Cc: Philipp Stanner Cc: Pierre-Eric Pelloux-Prayer Cc: Michel Dänzer Tvrtko Ursulin (16): drm/sched: Add some

[PATCH v5 12/16] drm/sched: Remove idle entity from tree

2025-06-23 Thread Tvrtko Ursulin
the tree only containing runnable entities. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu/drm/scheduler/sched_rq.c | 24 +--- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a

[PATCH v5 15/16] drm/sched: Queue all free credits in one worker invocation

2025-06-23 Thread Tvrtko Ursulin
There is no reason to queue just a single job if scheduler can take more and re-queue the worker to queue more. We can simply feed the hardware with as much as it can take in one go and hopefully win some latency. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc

[PATCH v5 06/16] drm/sched: Consolidate drm_sched_rq_select_entity_rr

2025-06-23 Thread Tvrtko Ursulin
Extract out two copies of the identical code to function epilogue to make it smaller and more readable. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu/drm/scheduler/sched_main.c | 48 +++--- 1

[PATCH v5 08/16] drm/sched: Consolidate entity run queue management

2025-06-23 Thread Tvrtko Ursulin
Move the code dealing with entities entering and exiting run queues to helpers to logically separate it from jobs entering and exiting entities. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu/drm/scheduler

[PATCH v5 10/16] drm/sched: Free all finished jobs at once

2025-06-23 Thread Tvrtko Ursulin
the submission side of things. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu/drm/scheduler/sched_main.c | 15 ++- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/scheduler

[PATCH v5 09/16] drm/sched: Move run queue related code into a separate file

2025-06-23 Thread Tvrtko Ursulin
Lets move all the code dealing with struct drm_sched_rq into a separate compilation unit. Advantage being sched_main.c is left with a clearer set of responsibilities. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu

[PATCH v5 02/16] drm/sched: Add some more scheduling quality unit tests

2025-06-23 Thread Tvrtko Ursulin
(x100)=60 Every 100ms for the duration of the test test logs how many jobs each client had completed, prefixed by minimum, average and maximum numbers. When finished overall average delta between max and min is output as a rough indicator to scheduling fairness. Signed-off-by: Tvrtko Ursulin Cc

[PATCH v5 04/16] drm/sched: Avoid double re-lock on the job free path

2025-06-23 Thread Tvrtko Ursulin
we can simply add the signaled check and have it return the presence of more jobs to free to the caller. That way the work item does not have to lock the list again and repeat the signaled check. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Phil

[PATCH v5 03/16] drm/sched: De-clutter drm_sched_init

2025-06-23 Thread Tvrtko Ursulin
Move work queue allocation into a helper for a more streamlined function body. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner --- drivers/gpu/drm/scheduler/sched_main.c | 33 -- 1 file changed, 20

[PATCH v5 05/16] drm/sched: Consolidate drm_sched_job_timedout

2025-06-23 Thread Tvrtko Ursulin
the code would rely on the TDR handler restarting itself then it would fail to do that if the job arrived on the pending list after the check. Also fix one stale comment while touching the function. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc

[PATCH v5 01/16] drm/sched: Add some scheduling quality unit tests

2025-06-23 Thread Tvrtko Ursulin
ng for 9ms (effective 10% GPU load). Here we can see the PCT and CPS reflecting real progress. Signed-off-by: Tvrtko Ursulin Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner Cc: Pierre-Eric Pelloux-Prayer Acked-by: Christian König --- drivers/gpu/drm/scheduler/test

Re: [PATCH v4 2/4] drm: add debugfs support on per client-id basis

2025-06-23 Thread Tvrtko Ursulin
On 18/06/2025 14:47, Sunil Khatri wrote: add support to add a directory for each client-id with root at the dri level. Since the clients are unique and not just related to one single drm device, so it makes more sense to add all the client based nodes with root as dri. Also create a symlink b

Re: [PATCH v1 0/2] debugfs support for pt base for each vm

2025-06-20 Thread Tvrtko Ursulin
On 13/06/2025 08:15, Sunil Khatri wrote: root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/clients command tgid dev master a uid magic name client-id systemd-logind 1056 0 yy 0

[PATCH] dma-fence: Fix sparse warnings due __rcu annotations

2025-06-16 Thread Tvrtko Ursulin
and undo the smarts from the tracpoints side of things. There is no functional change since the rest is left in place. Later we can consider changing the dma_fence_ops return types too, and handle all the individual drivers which define them. Signed-off-by: Tvrtko Ursulin Fixes: 506aa8b02a8d (&quo

Re: [PATCH v6 4/4] drm/xe: Make dma-fences compliant with the safe access rules

2025-06-13 Thread Tvrtko Ursulin
On 12/06/2025 18:49, Lucas De Marchi wrote: On Tue, Jun 10, 2025 at 05:42:26PM +0100, Tvrtko Ursulin wrote: Xe can free some of the data pointed to by the dma-fences it exports. Most notably the timeline name can get freed if userspace closes the associated submit queue. At the same time

[PATCH 1/4] drm/amdgpu: Use vmemdup_array_user in amdgpu_bo_create_list_entry_array

2025-06-12 Thread Tvrtko Ursulin
Replace kvmalloc_array() + copy_from_user() with vmemdup_array_user() on the fast path. This shrinks the source code and improves separation between the kernel and userspace slabs. Signed-off-by: Tvrtko Ursulin --- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 41 + 1 file

Re: [PATCH v5 6/6] drm/syncobj: Add a fast path to drm_syncobj_array_find

2025-06-12 Thread Tvrtko Ursulin
On 12/06/2025 08:21, Christian König wrote: On 6/11/25 17:29, Tvrtko Ursulin wrote: On 11/06/2025 15:21, Christian König wrote: On 6/11/25 16:00, Tvrtko Ursulin wrote: Running the Cyberpunk 2077 benchmark we can observe that the lookup helper is relatively hot, but the 97% of the calls are

[PATCH 3/4] drm/amdgpu: Use (v)memdup_array_user in amdgpu_cs_pass1

2025-06-12 Thread Tvrtko Ursulin
Replace k(v)malloc_array() + copy_from_user() with (v)memdup_array_user(). This shrinks the source code and improves separation between the kernel and userspace slabs. Signed-off-by: Tvrtko Ursulin --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 33 -- 1 file changed, 10

[PATCH 2/4] drm/amdgpu: Use memdup_array_user in amdgpu_cs_wait_fences_ioctl

2025-06-12 Thread Tvrtko Ursulin
Replace kmalloc_array() + copy_from_user() with memdup_array_user(). This shrinks the source code and improves separation between the kernel and userspace slabs. Signed-off-by: Tvrtko Ursulin --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 19 +-- 1 file changed, 5 insertions

[PATCH 4/4] drm/amdgpu: Use memdup_user in ta_if_load_debugfs_write

2025-06-12 Thread Tvrtko Ursulin
Replace kzalloc() + copy_from_user() with memdup_user(). This shrinks the source code and improves separation between the kernel and userspace slabs. Signed-off-by: Tvrtko Ursulin --- drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c | 14 +- 1 file changed, 5 insertions(+), 9 deletions

[PATCH 0/4] Use memdup_user & co where applicable

2025-06-12 Thread Tvrtko Ursulin
Replace some allocate + copy_from_user patterns with dedicated helpers. This shrinks the source code and is also good for security due SLAB bucket separation between the kernel and uapi. Tvrtko Ursulin (4): drm/amdgpu: Use vmemdup_array_user in amdgpu_bo_create_list_entry_array drm

Re: [PATCH v5 6/6] drm/syncobj: Add a fast path to drm_syncobj_array_find

2025-06-11 Thread Tvrtko Ursulin
On 11/06/2025 15:21, Christian König wrote: On 6/11/25 16:00, Tvrtko Ursulin wrote: Running the Cyberpunk 2077 benchmark we can observe that the lookup helper is relatively hot, but the 97% of the calls are for a single object. (~3% for two points, and never more than three points. While a

  1   2   3   4   5   6   7   >