Skip to contentSkip to conversation

omap: Do not BUG_ON(!spin_is_locked()) on UP

PATCH In review Bruno Prémont 3 participants 4 messages Dec 21, 2014 – Dec 22, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 2/3 omap: Do not BUG_ON(!spin_is_locked()) on UP

On !SMP systems spinlocks do not exist. Thus checking of they are active will always fail.

Use
assert_spin_locked(lock);
instead of
BUG_ON(!spin_is_locked(lock));
to not BUG() on all UP systems.

---
 drivers/gpu/drm/omapdrm/omap_irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/omapdrm/omap_irq.c +1 -1
index f035d2b..6ca9253 100644
@@ -34,7 +34,7 @@ static void omap_irq_update(struct drm_device *dev)
 	struct omap_drm_irq *irq;
 	uint32_t irqmask = priv->vblank_mask;
 
-	BUG_ON(!spin_is_locked(&list_lock));
+	assert_spin_locked(&list_lock));
 
 	list_for_each_entry(irq, &priv->irq_list, node)
 		irqmask |= irq->irqmask;
Signature · 6 lines
1.8.1.5

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 19 lines · Bruno Prémont

On !SMP systems spinlocks do not exist. Thus checking of they are active will always fail.

Use
assert_spin_locked(lock);
instead of
BUG_ON(!spin_is_locked(lock));
to not BUG() on all UP systems.

---
 drivers/gpu/drm/omapdrm/omap_irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/omapdrm/omap_irq.c +0 -0
index f035d2b..6ca9253 100644

drivers/gpu/drm/omapdrm/omap_irq.c static void omap_irq_update(struct drm_device *dev) · line 37

Quoted 5 lines
drivers/gpu/drm/omapdrm/omap_irq.c +1 -1
@@ -34,7 +34,7 @@ static void omap_irq_update(struct drm_device *dev)
        struct omap_drm_irq *irq;
        uint32_t irqmask = priv->vblank_mask;
 
-       BUG_ON(!spin_is_locked(&list_lock));
+       assert_spin_locked(&list_lock));

btw, one too many ')' there... I've fixed up the same issue w/ msm patch as I applied it

BR,
-R

Quoted 10 lines
drivers/gpu/drm/omapdrm/omap_irq.c +0 -1
        list_for_each_entry(irq, &priv->irq_list, node)
                irqmask |= irq->irqmask;
--

1.8.1.5

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

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

#2 lore raw
Quoted 23 lines · On Mon, 22 Dec 2014 08:46:48 -0500 Rob Clark wrote:
Quoted 22 lines · Bruno Prémont

On !SMP systems spinlocks do not exist. Thus checking of they are active will always fail.

Use
assert_spin_locked(lock);
instead of
BUG_ON(!spin_is_locked(lock));
to not BUG() on all UP systems.

---
 drivers/gpu/drm/omapdrm/omap_irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/omapdrm/omap_irq.c +0 -0
index f035d2b..6ca9253 100644
@@ -34,7 +34,7 @@ static void omap_irq_update(struct drm_device *dev)
        struct omap_drm_irq *irq;
        uint32_t irqmask = priv->vblank_mask;
 
Quoted 5 lines

drivers/gpu/drm/omapdrm/omap_irq.c static void omap_irq_update(struct drm_device *dev) · line 37

Quoted 2 lines
drivers/gpu/drm/omapdrm/omap_irq.c +1 -1
-       BUG_ON(!spin_is_locked(&list_lock));
+       assert_spin_locked(&list_lock));

btw, one too many ')' there... I've fixed up the same issue w/ msm patch as I applied it

Oops.

I got it right for the nouveau patch, so I was probably too quick doing the manual replace for the other occurrences in drivers/gpu/.

I didn't check how far back these BUG_ON() go though they might be worth applying to stable trees as well (could be the assert_spin_locked() macro appeared only after the introduction of some of these BUG_ON()s though).

I've hit them on nouveau on 3.18 and 3.19-rc1.

Bruno

Quoted 9 lines

BR,
-R

Quoted 5 lines
drivers/gpu/drm/omapdrm/omap_irq.c +0 -1
        list_for_each_entry(irq, &priv->irq_list, node)
                irqmask |= irq->irqmask;
--

1.8.1.5

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

#3 lore raw
Quoted 12 lines · Bruno Prémont
Quoted 10 lines · On Mon, 22 Dec 2014 08:46:48 -0500 Rob Clark wrote:
Quoted 9 lines · Bruno Prémont

On !SMP systems spinlocks do not exist. Thus checking of they are active will always fail.

Use
assert_spin_locked(lock);
instead of
BUG_ON(!spin_is_locked(lock));
to not BUG() on all UP systems.

Quoted 6 lines
Quoted 6 lines

Review

Quoted 6 lines
---
 drivers/gpu/drm/omapdrm/omap_irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/omapdrm/omap_irq.c

Quoted 15 lines
Quoted 7 lines
Quoted 7 lines

index f035d2b..6ca9253 100644

drivers/gpu/drm/omapdrm/omap_irq.c +0 -0
@@ -34,7 +34,7 @@ static void omap_irq_update(struct drm_device *dev)
        struct omap_drm_irq *irq;
        uint32_t irqmask = priv->vblank_mask;
 
Quoted 5 lines

drivers/gpu/drm/omapdrm/omap_irq.c static void omap_irq_update(struct drm_device *dev) · line 37

Quoted 2 lines
drivers/gpu/drm/omapdrm/omap_irq.c +1 -1
-       BUG_ON(!spin_is_locked(&list_lock));
+       assert_spin_locked(&list_lock));

btw, one too many ')' there... I've fixed up the same issue w/ msm patch as I applied it

Oops.

Quoted 7 lines

I got it right for the nouveau patch, so I was probably too quick doing the manual replace for the other occurrences in drivers/gpu/.

I didn't check how far back these BUG_ON() go though they might be worth applying to stable trees as well (could be the assert_spin_locked() macro appeared only after the introduction of some of these BUG_ON()s

though).

Quoted 2 lines

I've hit them on nouveau on 3.18 and 3.19-rc1.

I've taken the nouveau patch locally fwiw, and forwarded it on to Dave for
- fixes.

Ben.

Quoted 8 lines

Bruno

Quoted 5 lines

BR,
-R

Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
        list_for_each_entry(irq, &priv->irq_list, node)
                irqmask |= irq->irqmask;

--
1.8.1.5

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

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