mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/msm: Preemption timeout should be greater than hangcheck
@ 2026-07-26 17:42 Rob Clark
  0 siblings, 0 replies; only message in thread
From: Rob Clark @ 2026-07-26 17:42 UTC (permalink / raw)
  To: dri-devel
  Cc: linux-arm-msm, freedreno, Rob Clark, Sean Paul, Konrad Dybcio,
	Akhil P Oommen, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
	Marijn Suijten, David Airlie, Simona Vetter, open list

Long running jobs may not necessarily be able to preempt at a fine
enough granularity.  The hard-coded preempt timeout would otherwise
kick in and kill the job even if we haven't reached the hangcheck
timeout otherwise.

Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
---
 drivers/gpu/drm/msm/adreno/a6xx_preempt.c | 2 +-
 drivers/gpu/drm/msm/adreno/a6xx_preempt.h | 8 ++++++++
 drivers/gpu/drm/msm/adreno/a8xx_preempt.c | 2 +-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_preempt.c b/drivers/gpu/drm/msm/adreno/a6xx_preempt.c
index 1e599d4ddea1..00c239451c7b 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_preempt.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_preempt.c
@@ -258,7 +258,7 @@ void a6xx_preempt_trigger(struct msm_gpu *gpu)
 	a6xx_gpu->next_ring = ring;
 
 	/* Start a timer to catch a stuck preemption */
-	mod_timer(&a6xx_gpu->preempt_timer, jiffies + msecs_to_jiffies(10000));
+	set_preempt_timer(a6xx_gpu);
 
 	/* Enable or disable postamble as needed */
 	sysprof = msm_gpu_sysprof_no_perfcntr_zap(gpu);
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_preempt.h b/drivers/gpu/drm/msm/adreno/a6xx_preempt.h
index df36c945b836..178017aad26e 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_preempt.h
+++ b/drivers/gpu/drm/msm/adreno/a6xx_preempt.h
@@ -35,6 +35,14 @@ static inline void set_preempt_state(struct a6xx_gpu *gpu,
 	smp_mb__after_atomic();
 }
 
+static inline void set_preempt_timer(struct a6xx_gpu *gpu)
+{
+	struct msm_drm_private *priv = gpu->base.base.dev->dev_private;
+	unsigned t = max(10000, priv->hangcheck_period);
+
+	mod_timer(&gpu->preempt_timer, jiffies + msecs_to_jiffies(t));
+}
+
 /* Write the most recent wptr for the given ring into the hardware */
 static inline void update_wptr(struct a6xx_gpu *a6xx_gpu, struct msm_ringbuffer *ring)
 {
diff --git a/drivers/gpu/drm/msm/adreno/a8xx_preempt.c b/drivers/gpu/drm/msm/adreno/a8xx_preempt.c
index 6cb53a071801..c94f99625ea8 100644
--- a/drivers/gpu/drm/msm/adreno/a8xx_preempt.c
+++ b/drivers/gpu/drm/msm/adreno/a8xx_preempt.c
@@ -239,7 +239,7 @@ void a8xx_preempt_trigger(struct msm_gpu *gpu)
 	a6xx_gpu->next_ring = ring;
 
 	/* Start a timer to catch a stuck preemption */
-	mod_timer(&a6xx_gpu->preempt_timer, jiffies + msecs_to_jiffies(10000));
+	set_preempt_timer(a6xx_gpu);
 
 	/* Enable or disable postamble as needed */
 	sysprof = msm_gpu_sysprof_no_perfcntr_zap(gpu);
-- 
2.55.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-26 17:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-26 17:42 [PATCH] drm/msm: Preemption timeout should be greater than hangcheck Rob Clark

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

all inboxes | Powered by JetHome®