Skip to contentSkip to conversation

drm/vblank: downgrade vblank wait timeout from WARN to debug

PATCH Superseded Chintan Patel 2 participants 3 messages Oct 1, 2025 – Oct 2, 2025

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/vblank: downgrade vblank wait timeout from WARN to debug

When wait_event_timeout() in drm_wait_one_vblank() times out, the current WARN can cause unnecessary kernel panics in environments with panic_on_warn set (e.g. CI, fuzzing). These timeouts can happen under scheduler pressure or from invalid userspace calls, so they are not always a kernel bug.

Replace the WARN with drm_dbg_kms() messages that provide useful context (last and current vblank counters) without crashing the system. Developers can still enable drm.debug to diagnose genuine problems.

---
 drivers/gpu/drm/drm_vblank.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_vblank.c +15 -2
index 46f59883183d..c8dd9d4be26c 100644
@@ -1289,7 +1289,7 @@ void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe)
 {
 	struct drm_vblank_crtc *vblank = drm_vblank_crtc(dev, pipe);
 	int ret;
-	u64 last;
+	u64 last, curr;
 
 	if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
 		return;
@@ -1305,7 +1305,20 @@ void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe)
 				 last != drm_vblank_count(dev, pipe),
 				 msecs_to_jiffies(100));
 
-	drm_WARN(dev, ret == 0, "vblank wait timed out on crtc %i\n", pipe);
+	curr = drm_vblank_count(dev, pipe);
+
+	if (ret == 0) {
+		/*
+		 * Avoid spamming WARNs for timeouts which can be caused by
+		 * heavy scheduling pressure or invalid userspace calls (fuzzing).
+		 * Use debug message instead.
+		 */
+		drm_dbg_kms(dev, "WAIT_VBLANK: timeout crtc=%d, last=%llu, curr=%llu\n",
+			pipe, last, curr);
+	} else {
+		drm_dbg_kms(dev, "WAIT_VBLANK: completed crtc=%d, last=%llu, curr=%llu\n",
+			pipe, last, curr);
+		}
 
 	drm_vblank_put(dev, pipe);
 }
Signature · 1 line
2.43.0
#1 lore raw

Hi

Am 01.10.25 um 05:32 schrieb Chintan Patel:

Quoted 34 lines

When wait_event_timeout() in drm_wait_one_vblank() times out, the current WARN can cause unnecessary kernel panics in environments with panic_on_warn set (e.g. CI, fuzzing). These timeouts can happen under scheduler pressure or from invalid userspace calls, so they are not always a kernel bug.

Replace the WARN with drm_dbg_kms() messages that provide useful context (last and current vblank counters) without crashing the system. Developers can still enable drm.debug to diagnose genuine problems.

---
  drivers/gpu/drm/drm_vblank.c | 17 +++++++++++++++--
  1 file changed, 15 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_vblank.c +1 -1
index 46f59883183d..c8dd9d4be26c 100644
@@ -1289,7 +1289,7 @@ void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe)
  {
  	struct drm_vblank_crtc *vblank = drm_vblank_crtc(dev, pipe);
  	int ret;
-	u64 last;
+	u64 last, curr;
 
  	if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
  		return;

drivers/gpu/drm/drm_vblank.c void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe) · line 1310

Quoted 7 lines
drivers/gpu/drm/drm_vblank.c +3 -1
@@ -1305,7 +1305,20 @@ void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe)
  				 last != drm_vblank_count(dev, pipe),
  				 msecs_to_jiffies(100));
 
-	drm_WARN(dev, ret == 0, "vblank wait timed out on crtc %i\n", pipe);
+	curr = drm_vblank_count(dev, pipe);
+
+	if (ret == 0) {

if (!ret)

drivers/gpu/drm/drm_vblank.c void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe) · line 1315

Quoted 5 lines
drivers/gpu/drm/drm_vblank.c +5 -0
+		/*
+		 * Avoid spamming WARNs for timeouts which can be caused by
+		 * heavy scheduling pressure or invalid userspace calls (fuzzing).
+		 * Use debug message instead.
+		 */

The comment is not necessary. The commit description gives a good rational.

drivers/gpu/drm/drm_vblank.c void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe) · line 1321

Quoted 6 lines
drivers/gpu/drm/drm_vblank.c +6 -0
+		drm_dbg_kms(dev, "WAIT_VBLANK: timeout crtc=%d, last=%llu, curr=%llu\n",
+			pipe, last, curr);
+	} else {
+		drm_dbg_kms(dev, "WAIT_VBLANK: completed crtc=%d, last=%llu, curr=%llu\n",
+			pipe, last, curr);
+		}

Rather drop the else branch.

Best regards
Thomas

Quoted 3 lines
drivers/gpu/drm/drm_vblank.c +0 -0
  	drm_vblank_put(dev, pipe);
  }
Signature · 7 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
#2 lore raw

The comment is not necessary. The commit description gives a good rational.

Quoted 30 lines
Quoted 2 lines

+ drm_dbg_kms(dev, "WAIT_VBLANK: timeout crtc=%d, last=%llu,

curr=%llu\n",

drivers/gpu/drm/drm_vblank.c void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe)

Quoted 3 lines
drivers/gpu/drm/drm_vblank.c +3 -0
+                     pipe, last, curr);
+     } else {
+             drm_dbg_kms(dev, "WAIT_VBLANK: completed crtc=%d,

last=%llu, curr=%llu\n",

Review

Quoted 2 lines
(quoted diff) +2 -0
+                     pipe, last, curr);
+             }

Rather drop the else branch.

Best regards
Thomas

Quoted 3 lines
      drm_vblank_put(dev, pipe);

}

Hi Thomas,

Thanks a lot for your review and suggestions. I am just starting out here. I’ve sent a v2 addressing your comments.

Best regards,
Chintan