Skip to contentSkip to conversation

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

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

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 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.

v2:
- Drop unnecessary in-code comment (suggested by Thomas Zimmermann)
- Remove else branch, only log timeout case

---
 drivers/gpu/drm/drm_vblank.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_vblank.c +7 -2
index 46f59883183d..a94570668cba 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,12 @@ 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) {
+		drm_dbg_kms(dev, "WAIT_VBLANK: timeout 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 02.10.25 um 04:57 schrieb Chintan Patel:

Quoted 11 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.

Quoted 5 lines

There should be no empty lines among those tags

Quoted 22 lines

v2:
- Drop unnecessary in-code comment (suggested by Thomas Zimmermann)
- Remove else branch, only log timeout case

---
  drivers/gpu/drm/drm_vblank.c | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_vblank.c +1 -1
index 46f59883183d..a94570668cba 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 1308

Quoted 5 lines
drivers/gpu/drm/drm_vblank.c +1 -1
@@ -1305,7 +1305,12 @@ 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);

Please don't call drm_vblank_count() here. It's not necessary for regular operation. Simply keep the debug message as-is.

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

Quoted 2 lines
drivers/gpu/drm/drm_vblank.c +2 -0
+
+	if (ret == 0) {

"if (!ret)" is the preferred style.

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

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

Aligning the pipe argument with dev from the previous line is the preferred style.

Best regards
Thomas

Quoted 4 lines
drivers/gpu/drm/drm_vblank.c +1 -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)
#3 lore raw
In reply to Chintan Patel
Quoted 5 lines · Chintan Patel

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.

"invalid userspace calls" should never reach this far. That would be a kernel bug.

Quoted 33 lines

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.

v2:
- Drop unnecessary in-code comment (suggested by Thomas Zimmermann)
- Remove else branch, only log timeout case

---
 drivers/gpu/drm/drm_vblank.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_vblank.c +1 -1
index 46f59883183d..a94570668cba 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 1312

Quoted 9 lines
drivers/gpu/drm/drm_vblank.c +5 -1
@@ -1305,7 +1305,12 @@ 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) {
+		drm_dbg_kms(dev, "WAIT_VBLANK: timeout crtc=%d, last=%llu, curr=%llu\n",
+			pipe, last, curr);

It should at the very least be a drm_err(). Though the backtrace can be useful in figuring out where the problem is coming from, so not too happy about this change.

Quoted 6 lines
drivers/gpu/drm/drm_vblank.c +1 -0
+	}
 
 	drm_vblank_put(dev, pipe);
 }
Signature · 1 line
2.43.0
Signature · 2 lines
Ville Syrjälä
Intel
#4 lore raw
Quoted 9 lines · Ville Syrjälä
Quoted 5 lines · Chintan Patel

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.

"invalid userspace calls" should never reach this far. That would be a kernel bug.

I was also wondering how you could get this due to some scheduler screwup, but I suppose that could theoretically happen with threaded irqs, or whatever work/etc is used to update the vblank count on drivers that don't have hardware interrupts for it. 100+ msec hw interrupt latency sounds excessive to me though.

But since you reference some syzbot reports below, are you actually trying to hide real kernel bugs that syzbot found?

Quoted 58 lines
Quoted 34 lines

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.

v2:
- Drop unnecessary in-code comment (suggested by Thomas Zimmermann)
- Remove else branch, only log timeout case

---
 drivers/gpu/drm/drm_vblank.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_vblank.c +1 -1
index 46f59883183d..a94570668cba 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 1312

Quoted 9 lines
drivers/gpu/drm/drm_vblank.c +5 -1
@@ -1305,7 +1305,12 @@ 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) {
+		drm_dbg_kms(dev, "WAIT_VBLANK: timeout crtc=%d, last=%llu, curr=%llu\n",
+			pipe, last, curr);

It should at the very least be a drm_err(). Though the backtrace can be useful in figuring out where the problem is coming from, so not too happy about this change.

Quoted 6 lines
drivers/gpu/drm/drm_vblank.c +1 -0
+	}
 
 	drm_vblank_put(dev, pipe);
 }
Signature · 1 line
2.43.0
Signature · 2 lines
Ville Syrjälä
Intel
Signature · 2 lines
Ville Syrjälä
Intel
#5 lore raw
In reply to Ville Syrjälä
Quoted 46 lines · Ville Syrjälä
Quoted 5 lines · Chintan Patel

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.

"invalid userspace calls" should never reach this far. That would be a kernel bug.

Quoted 36 lines

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.

v2:
- Drop unnecessary in-code comment (suggested by Thomas Zimmermann)
- Remove else branch, only log timeout case

---
  drivers/gpu/drm/drm_vblank.c | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_vblank.c +1 -1
index 46f59883183d..a94570668cba 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,12 @@ void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe)
  				 last != drm_vblank_count(dev, pipe),
  				 msecs_to_jiffies(100));
 
Quoted 10 lines

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

Quoted 6 lines
drivers/gpu/drm/drm_vblank.c +5 -1
-	drm_WARN(dev, ret == 0, "vblank wait timed out on crtc %i\n", pipe);
+	curr = drm_vblank_count(dev, pipe);
+
+	if (ret == 0) {
+		drm_dbg_kms(dev, "WAIT_VBLANK: timeout crtc=%d, last=%llu, curr=%llu\n",
+			pipe, last, curr);

It should at the very least be a drm_err(). Though the backtrace can be useful in figuring out where the problem is coming from, so not too happy about this change.

Thanks Ville for the feedback.I am still learning as I am new here!

You’re right, “invalid userspace calls” was a poor choice of wording — I’ll drop that from the commit message. The main goal is to avoid unnecessary panics in fuzzing/CI with panic_on_warn, while still reporting the error clearly.

I’ll update the patch to use drm_err() instead of drm_dbg_kms(), and drop the extra drm_vblank_count() call per Thomas’ earlier comment.

Best regards,
Chintan

#2 lore raw
In reply to Thomas Zimmermann
Quoted 55 lines · Thomas Zimmermann

Hi

Am 02.10.25 um 04:57 schrieb Chintan Patel:

Quoted 11 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.

Quoted 5 lines

There should be no empty lines among those tags

Quoted 22 lines

v2:
  - Drop unnecessary in-code comment (suggested by Thomas Zimmermann)
  - Remove else branch, only log timeout case
---
  drivers/gpu/drm/drm_vblank.c | 9 +++++++--

  1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_vblank.c +1 -1
index 46f59883183d..a94570668cba 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 · line 1308

Quoted 5 lines
drivers/gpu/drm/drm_vblank.c +1 -1
@@ -1305,7 +1305,12 @@ 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);

Please don't call drm_vblank_count() here. It's not necessary for regular operation. Simply keep the debug message as-is.

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

Quoted 2 lines
drivers/gpu/drm/drm_vblank.c +2 -0
+
+    if (ret == 0) {
Quoted 8 lines

"if (!ret)" is the preferred style.

drivers/gpu/drm/drm_vblank.c void drm_wait_one_vblank(struct drm_device · line 1313

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

Aligning the pipe argument with dev from the previous line is the preferred style.

Hi Thomas,

Thank you for your review and helpful suggestions.
I’ll drop the unnecessary comment and remove the else branch as you recommended.

I’ll send a v3 with these changes.

Best regards,
Chintan