Skip to contentSkip to conversation

drm/panthor: Record devfreq busy as soon as a job is started

PATCH Applied Steven Price 3 participants 4 messages Jul 3, 2024 – Jul 4, 2024

Subsystems (3)
lore
Share & tools
lore

Steven Price

author maintainer
#0 lore raw

PATCH 1/1 drm/panthor: Record devfreq busy as soon as a job is started

If a queue is already assigned to the hardware, then a newly submitted job can start straight away without waiting for the tick. However in this case the devfreq infrastructure isn't notified that the GPU is busy. By the time the tick happens the job might well have finished and no time will be accounted for the GPU being busy.

Fix this by recording the GPU as busy directly in queue_run_job() in the case where there is a CSG assigned and therefore we just ring the doorbell.

Fixes de8548813824 ("drm/panthor: Add the scheduler logical block")
---
 drivers/gpu/drm/panthor/panthor_sched.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/panthor/panthor_sched.c +1 -0
index 951ff7e63ea8..e7afaa1ad8dc 100644
@@ -2942,6 +2942,7 @@ queue_run_job(struct drm_sched_job *sched_job)
 			pm_runtime_get(ptdev->base.dev);
 			sched->pm.has_ref = true;
 		}
+		panthor_devfreq_record_busy(sched->ptdev);
 	}
 
 	/* Update the last fence. */
Signature · 1 line
2.39.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · On Wed, 3 Jul 2024 16:56:46 +0100 Steven Price <[email protected]> wrote:

If a queue is already assigned to the hardware, then a newly submitted job can start straight away without waiting for the tick. However in this case the devfreq infrastructure isn't notified that the GPU is busy. By the time the tick happens the job might well have finished and no time will be accounted for the GPU being busy.

Quoted 6 lines

Fix this by recording the GPU as busy directly in queue_run_job() in the case where there is a CSG assigned and therefore we just ring the doorbell.

Fixes de8548813824 ("drm/panthor: Add the scheduler logical block")
Quoted 16 lines
---
 drivers/gpu/drm/panthor/panthor_sched.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/panthor/panthor_sched.c +1 -0
index 951ff7e63ea8..e7afaa1ad8dc 100644
@@ -2942,6 +2942,7 @@ queue_run_job(struct drm_sched_job *sched_job)
 			pm_runtime_get(ptdev->base.dev);
 			sched->pm.has_ref = true;
 		}
+		panthor_devfreq_record_busy(sched->ptdev);
 	}
 
 	/* Update the last fence. */
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Steven Price
Quoted 6 lines · Steven Price

If a queue is already assigned to the hardware, then a newly submitted job can start straight away without waiting for the tick. However in this case the devfreq infrastructure isn't notified that the GPU is busy. By the time the tick happens the job might well have finished and no time will be accounted for the GPU being busy.

Quoted 6 lines

Fix this by recording the GPU as busy directly in queue_run_job() in the case where there is a CSG assigned and therefore we just ring the doorbell.

Fixes de8548813824 ("drm/panthor: Add the scheduler logical block")
Quoted 19 lines
---
 drivers/gpu/drm/panthor/panthor_sched.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/panthor/panthor_sched.c +1 -0
index 951ff7e63ea8..e7afaa1ad8dc 100644
@@ -2942,6 +2942,7 @@ queue_run_job(struct drm_sched_job *sched_job)
 			pm_runtime_get(ptdev->base.dev);
 			sched->pm.has_ref = true;
 		}
+		panthor_devfreq_record_busy(sched->ptdev);
 	}
 
 	/* Update the last fence. */
Signature · 1 line
2.39.2
Signature · 8 lines
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯
author maintainer Applied
#3 lore raw
In reply to Steven Price
Quoted 21 lines · Steven Price

If a queue is already assigned to the hardware, then a newly submitted job can start straight away without waiting for the tick. However in this case the devfreq infrastructure isn't notified that the GPU is busy. By the time the tick happens the job might well have finished and no time will be accounted for the GPU being busy.

Fix this by recording the GPU as busy directly in queue_run_job() in the case where there is a CSG assigned and therefore we just ring the doorbell.

Fixes de8548813824 ("drm/panthor: Add the scheduler logical block")
---
 drivers/gpu/drm/panthor/panthor_sched.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/panthor/panthor_sched.c +0 -0
index 951ff7e63ea8..e7afaa1ad8dc 100644

drivers/gpu/drm/panthor/panthor_sched.c queue_run_job(struct drm_sched_job *sched_job) · line 2948

Quoted 7 lines
drivers/gpu/drm/panthor/panthor_sched.c +1 -0
@@ -2942,6 +2942,7 @@ queue_run_job(struct drm_sched_job *sched_job)
 			pm_runtime_get(ptdev->base.dev);
 			sched->pm.has_ref = true;
 		}
+		panthor_devfreq_record_busy(sched->ptdev);
 	}
 
 	/* Update the last fence. */

Pushed to drm-misc-next

Thanks,
Steve