Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe/guc_submit: Simplify and fix diff calculation
@ 2025-05-13 14:25 Lucas De Marchi
  2025-05-13 14:59 ` Raag Jadav
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: Lucas De Marchi @ 2025-05-13 14:25 UTC (permalink / raw)
  To: intel-xe; +Cc: Lucas De Marchi, Matthew Brost, Umesh Nerlige Ramappa

With a u32 type, there's no need to check which one is greater: the
current is always the latest and if it's less than the previous, it's
because it wrapped: just do the unsigned calculation that will lead to
the same result, or better the correct one. It fixes an off-by-one in
the wrapped calculation, however that doesn't really matter for the
timeout calculation.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/xe/xe_guc_submit.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
index fb125f940de8f..80f748baad3f3 100644
--- a/drivers/gpu/drm/xe/xe_guc_submit.c
+++ b/drivers/gpu/drm/xe/xe_guc_submit.c
@@ -976,10 +976,7 @@ static bool check_timeout(struct xe_exec_queue *q, struct xe_sched_job *job)
 	 */
 	xe_gt_assert(gt, timeout_ms < 100 * MSEC_PER_SEC);
 
-	if (ctx_timestamp < ctx_job_timestamp)
-		diff = ctx_timestamp + U32_MAX - ctx_job_timestamp;
-	else
-		diff = ctx_timestamp - ctx_job_timestamp;
+	diff = ctx_timestamp - ctx_job_timestamp;
 
 	/*
 	 * Ensure timeout is within 5% to account for an GuC scheduling latency




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

end of thread, other threads:[~2025-05-27  0:29 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-13 14:25 [PATCH] drm/xe/guc_submit: Simplify and fix diff calculation Lucas De Marchi
2025-05-13 14:59 ` Raag Jadav
2025-05-14 14:32 ` ✓ CI.Patch_applied: success for " Patchwork
2025-05-14 14:32 ` ✓ CI.checkpatch: " Patchwork
2025-05-14 14:33 ` ✓ CI.KUnit: " Patchwork
2025-05-14 14:52 ` ✓ CI.Hooks: " Patchwork
2025-05-14 14:55 ` ✓ CI.Build: " Patchwork
2025-05-14 14:56 ` ✓ CI.checksparse: " Patchwork
2025-05-14 15:26 ` ✓ Xe.CI.BAT: " Patchwork
2025-05-14 20:35 ` ✓ Xe.CI.Full: " Patchwork
2025-05-14 22:29 ` [PATCH] " Umesh Nerlige Ramappa
2025-05-14 23:54 ` Matthew Brost
2025-05-27  0:29 ` ✗ CI.Patch_applied: failure for " Patchwork

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