[PATCH 1/2] drm/scheduler: Change scheduled fence track

Wang, Kevin(Yang) Kevin1.Wang at amd.com
Fri Apr 23 11:09:03 UTC 2021


[AMD Official Use Only - Internal Distribution Only]



________________________________
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> on behalf of Roy Sun <Roy.Sun at amd.com>
Sent: Friday, April 23, 2021 6:55 PM
To: amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>
Cc: Sun, Roy <Roy.Sun at amd.com>; Nieto, David M <David.Nieto at amd.com>
Subject: [PATCH 1/2] drm/scheduler: Change scheduled fence track

Update the timestamp of scheduled fence on HW
completion of the previous fences

This allow more accurate tracking of the fence
execution in HW

Signed-off-by: David M Nieto <david.nieto at amd.com>
Signed-off-by: Roy Sun <Roy.Sun at amd.com>
---
 drivers/gpu/drm/scheduler/sched_main.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
index 92d8de24d0a1..dc05a20a8ef2 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -515,7 +515,7 @@ void drm_sched_resubmit_jobs(struct drm_gpu_scheduler *sched)
 EXPORT_SYMBOL(drm_sched_resubmit_jobs);

 /**
- * drm_sched_resubmit_jobs_ext - helper to relunch certain number of jobs from mirror ring list
+ * drm_sched_resubmit_jobs_ext - helper to relaunch certain number of jobs from pending list
  *
  * @sched: scheduler instance
  * @max: job numbers to relaunch
@@ -671,7 +671,7 @@ drm_sched_select_entity(struct drm_gpu_scheduler *sched)
 static struct drm_sched_job *
 drm_sched_get_cleanup_job(struct drm_gpu_scheduler *sched)
 {
-       struct drm_sched_job *job;
+       struct drm_sched_job *job, *next;

         /*
          * Don't destroy jobs while the timeout worker is running  OR thread
@@ -690,6 +690,13 @@ drm_sched_get_cleanup_job(struct drm_gpu_scheduler *sched)
         if (job && dma_fence_is_signaled(&job->s_fence->finished)) {
                 /* remove job from pending_list */
                 list_del_init(&job->list);
+               /* account for the next fence in the queue */
+               next = list_first_entry_or_null(&sched->pending_list,
+                               struct drm_sched_job, list);
+               if (next) {
+                       next->s_fence->scheduled.timestamp =
+                               job->s_fence->finished.timestamp;
+               }

  1.  the timestamp maybe is invalid, we'd better check DMA_FENCE_FLAG_TIMESTAMP_BIT before use it .
  2.  when hw_submission > 2, do we need to check rest jobs? not only next.

Thanks,
Kevin.

         } else {
                 job = NULL;
                 /* queue timeout for next job */
--
2.31.1

_______________________________________________
amd-gfx mailing list
amd-gfx at lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CKevin1.Wang%40amd.com%7C3ac81f3f5c0346115dce08d906464b5e%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637547721248267412%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=XZTXlwgkQuEn%2BflY%2FOuUNUymOMjyOZ5lv7%2BiJR7Wjjk%3D&reserved=0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20210423/dde3bf78/attachment.htm>


More information about the amd-gfx mailing list