Skip to contentSkip to conversation

drm/irq: BUG_ON() -> WARN_ON()

PATCH In review Rob Clark 4 participants 4 messages Nov 8, 2014 – Nov 10, 2014

Subsystems (2)
lore
Share & tools
lore

Rob Clark

author
#0 lore raw

PATCH 1/1 drm/irq: BUG_ON() -> WARN_ON()

Let's make things a bit easier to debug when things go bad (potentially under console_lock).

---
 drivers/gpu/drm/drm_irq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_irq.c +2 -1
index 5ef03c2..c4edea9 100644
@@ -1029,7 +1029,8 @@ void drm_vblank_put(struct drm_device *dev, int crtc)
 {
 	struct drm_vblank_crtc *vblank = &dev->vblank[crtc];
 
-	BUG_ON(atomic_read(&vblank->refcount) == 0);
+	if (WARN_ON(atomic_read(&vblank->refcount) == 0))
+		return;
 
 	if (WARN_ON(crtc >= dev->num_crtcs))
 		return;
Signature · 6 lines
1.9.3

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Rob Clark

Let's make things a bit easier to debug when things go bad (potentially under console_lock).

---
  drivers/gpu/drm/drm_irq.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_irq.c +0 -0
index 5ef03c2..c4edea9 100644

drivers/gpu/drm/drm_irq.c void drm_vblank_put(struct drm_device *dev, int crtc) · line 1036

Quoted 9 lines
drivers/gpu/drm/drm_irq.c +2 -1
@@ -1029,7 +1029,8 @@ void drm_vblank_put(struct drm_device *dev, int crtc)
  {
  	struct drm_vblank_crtc *vblank = &dev->vblank[crtc];
 
-	BUG_ON(atomic_read(&vblank->refcount) == 0);
+	if (WARN_ON(atomic_read(&vblank->refcount) == 0))
+		return;
 
  	if (WARN_ON(crtc >= dev->num_crtcs))
  		return;
Signature · 6 lines
Earthling Michel Dänzer            |                  http://www.amd.com
Libre software enthusiast          |                Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
In reply to Rob Clark
Quoted 13 lines · Rob Clark

Let's make things a bit easier to debug when things go bad (potentially under console_lock).

---
 drivers/gpu/drm/drm_irq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_irq.c +0 -0
index 5ef03c2..c4edea9 100644

drivers/gpu/drm/drm_irq.c void drm_vblank_put(struct drm_device *dev, int crtc) · line 1033

Quoted 6 lines
drivers/gpu/drm/drm_irq.c +2 -1
@@ -1029,7 +1029,8 @@ void drm_vblank_put(struct drm_device *dev, int crtc)
 {
 	struct drm_vblank_crtc *vblank = &dev->vblank[crtc];
 
-	BUG_ON(atomic_read(&vblank->refcount) == 0);
+	if (WARN_ON(atomic_read(&vblank->refcount) == 0))
+		return;

While I approve of the change, I'd like to promote the use of WARN with a message instead of WARN_ON. See [1]. In fact it lead to us redefining WARN_ON in i915 [2].

Thanks,
Jani.

[1] http://mid.gmane.org/[email protected]
[2] http://mid.gmane.org/[email protected]

Quoted 10 lines
drivers/gpu/drm/drm_irq.c +0 -0
 	if (WARN_ON(crtc >= dev->num_crtcs))
 		return;
Signature · 6 lines
1.9.3

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

Hey,

Op 10-11-14 om 12:01 schreef Jani Nikula:

Quoted 17 lines · Rob Clark
Quoted 16 lines

Let's make things a bit easier to debug when things go bad (potentially under console_lock).

---
 drivers/gpu/drm/drm_irq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_irq.c +0 -0
index 5ef03c2..c4edea9 100644
@@ -1029,7 +1029,8 @@ void drm_vblank_put(struct drm_device *dev, int crtc)
 {
 	struct drm_vblank_crtc *vblank = &dev->vblank[crtc];
 
Quoted 6 lines

drivers/gpu/drm/drm_irq.c void drm_vblank_put(struct drm_device *dev, int crtc) · line 1033

Quoted 3 lines
drivers/gpu/drm/drm_irq.c +2 -1
-	BUG_ON(atomic_read(&vblank->refcount) == 0);
+	if (WARN_ON(atomic_read(&vblank->refcount) == 0))
+		return;

While I approve of the change, I'd like to promote the use of WARN with a message instead of WARN_ON. See [1]. In fact it lead to us redefining WARN_ON in i915 [2].

I love the redefinition of WARN, but I think this should not be overridden locally, instead it should be a kernel debug option.

~Maarten

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel