mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rob Clark <robin.clark@oss.qualcomm.com>
To: dri-devel@lists.freedesktop.org
Cc: linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org,
	Rob Clark <robin.clark@oss.qualcomm.com>,
	Sean Paul <sean@poorly.run>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Akhil P Oommen <akhilpo@oss.qualcomm.com>,
	Dmitry Baryshkov <lumag@kernel.org>,
	Abhinav Kumar <abhinav.kumar@linux.dev>,
	Jessica Zhang <jesszhan0024@gmail.com>,
	Marijn Suijten <marijn.suijten@somainline.org>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] drm/msm: Preemption timeout should be greater than hangcheck
Date: Sun, 26 Jul 2026 10:42:14 -0700	[thread overview]
Message-ID: <20260726174215.30010-1-robin.clark@oss.qualcomm.com> (raw)

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


                 reply	other threads:[~2026-07-26 17:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260726174215.30010-1-robin.clark@oss.qualcomm.com \
    --to=robin.clark@oss.qualcomm.com \
    --cc=abhinav.kumar@linux.dev \
    --cc=airlied@gmail.com \
    --cc=akhilpo@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=jesszhan0024@gmail.com \
    --cc=konradybcio@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lumag@kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=sean@poorly.run \
    --cc=simona@ffwll.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®