Skip to contentSkip to conversation

drm/fbdev-shmem: don't warn on a transient dirty callback failure

PATCH In review Jiahao Xu 2 participants 2 messages Nov 11

Subsystems (2)
lore
Share & tools
lore

Jiahao Xu

author
#0 lore raw

PATCH v2 1/1 drm/fbdev-shmem: don't warn on a transient dirty callback failure

The fbdev dirty callback (drm_atomic_helper_dirtyfb()) can fail with -ENOMEM when the atomic commit allocation fails under memory pressure. That is a transient runtime condition, not a driver bug: the damage is only cosmetic and the frame is redrawn on the next flush.

drm_WARN_ONCE() turns this recoverable failure into a WARN splat (and a panic with panic_on_warn), which syzbot keeps reporting:

virtio-pci 0000:00:01.0: [drm] Dirty helper failed: ret=-12

  WARNING: drivers/gpu/drm/drm_fbdev_shmem.c:118 at ...

Keep the warning for other failures, but do not warn about -ENOMEM. The error is still propagated to the caller.

Fixes 150f431a0831 ("drm/fbdev: Add fbdev-shmem")
Reported-by [email protected]

---
v2:
- Add the Fixes: tag reported by sashiko-bot. No code change.

---
 drivers/gpu/drm/drm_fbdev_shmem.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_fbdev_shmem.c +8 -1
index 8eb05fe9b..c3fa5a663 100644
@@ -115,7 +115,14 @@ static int drm_fbdev_shmem_helper_fb_dirty(struct drm_fb_helper *helper,
 
 	if (helper->fb->funcs->dirty) {
 		ret = helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1);
-		if (drm_WARN_ONCE(dev, ret, "Dirty helper failed: ret=%d\n", ret))
+		/*
+		 * An allocation failure is a transient condition under memory
+		 * pressure, not a driver bug, so don't warn about it.  The
+		 * error itself is still propagated to the caller.
+		 */
+		drm_WARN_ONCE(dev, ret && ret != -ENOMEM,
+			      "Dirty helper failed: ret=%d\n", ret);
+		if (ret)
 			return ret;
 	}
 
Signature · 1 line
2.43.0
#1 lore raw

Am 11.11.26 um 05:41 schrieb Jiahao Xu:

Quoted 4 lines

The fbdev dirty callback (drm_atomic_helper_dirtyfb()) can fail with -ENOMEM when the atomic commit allocation fails under memory pressure. That is a transient runtime condition, not a driver bug: the damage is only cosmetic and the frame is redrawn on the next flush.

Cosmetic? Failing to allocate memory seems like a significant problem to me.

Quoted 41 lines

drm_WARN_ONCE() turns this recoverable failure into a WARN splat (and a panic with panic_on_warn), which syzbot keeps reporting:

   virtio-pci 0000:00:01.0: [drm] Dirty helper failed: ret=-12
   WARNING: drivers/gpu/drm/drm_fbdev_shmem.c:118 at ...

Keep the warning for other failures, but do not warn about -ENOMEM. The error is still propagated to the caller.

Fixes 150f431a0831 ("drm/fbdev: Add fbdev-shmem")
Reported-by [email protected]

---
v2:
- Add the Fixes: tag reported by sashiko-bot. No code change.

---
  drivers/gpu/drm/drm_fbdev_shmem.c | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_fbdev_shmem.c +8 -1
index 8eb05fe9b..c3fa5a663 100644
@@ -115,7 +115,14 @@ static int drm_fbdev_shmem_helper_fb_dirty(struct drm_fb_helper *helper,
 
  	if (helper->fb->funcs->dirty) {
  		ret = helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1);
-		if (drm_WARN_ONCE(dev, ret, "Dirty helper failed: ret=%d\n", ret))
+		/*
+		 * An allocation failure is a transient condition under memory
+		 * pressure, not a driver bug, so don't warn about it.  The
+		 * error itself is still propagated to the caller.
+		 */
+		drm_WARN_ONCE(dev, ret && ret != -ENOMEM,
+			      "Dirty helper failed: ret=%d\n", ret);
+		if (ret)
  			return ret;
  	}
 
Signature · 6 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)