Skip to contentSkip to conversation

drm/i915: WARN if interrupts aren't on in en/disable_pipestat

PATCH In review Daniel Vetter 4 participants 11 messages Aug 27, 2014 – Sep 8, 2014

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

PATCH 1/1 drm/i915: WARN if interrupts aren't on in en/disable_pipestat

Now that vlv has runtime pm we kinda should check for that like on the pch split platforms. Looks like this was simply lost in the vlv rpm enabling.

Cc Paulo Zanoni <[email protected]>
Cc Imre Deak <[email protected]>
Cc Jesse Barnes <[email protected]>
---
 drivers/gpu/drm/i915/i915_irq.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/i915_irq.c +2 -0
index 9eb303c1b621..76bc4d0de5a4 100644
@@ -589,6 +589,7 @@ __i915_enable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
 	u32 pipestat = I915_READ(reg) & PIPESTAT_INT_ENABLE_MASK;
 
 	assert_spin_locked(&dev_priv->irq_lock);
+	WARN_ON(!intel_irqs_enabled(dev_priv));
 
 	if (WARN_ONCE(enable_mask & ~PIPESTAT_INT_ENABLE_MASK ||
 		      status_mask & ~PIPESTAT_INT_STATUS_MASK,
@@ -615,6 +616,7 @@ __i915_disable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
 	u32 pipestat = I915_READ(reg) & PIPESTAT_INT_ENABLE_MASK;
 
 	assert_spin_locked(&dev_priv->irq_lock);
+	WARN_ON(!intel_irqs_enabled(dev_priv));
 
 	if (WARN_ONCE(enable_mask & ~PIPESTAT_INT_ENABLE_MASK ||
 		      status_mask & ~PIPESTAT_INT_STATUS_MASK,
Signature · 1 line
2.0.1
#1 lore raw
Quoted 3 lines · Daniel Vetter

Now that vlv has runtime pm we kinda should check for that like on the pch split platforms. Looks like this was simply lost in the vlv rpm enabling.

Is there a reason why setting up the pipestat prior to enabling interrupts is verboten, or is it just not done today? -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#2 lore raw
Quoted 7 lines · Chris Wilson
Quoted 3 lines · Daniel Vetter

Now that vlv has runtime pm we kinda should check for that like on the pch split platforms. Looks like this was simply lost in the vlv rpm enabling.

Is there a reason why setting up the pipestat prior to enabling interrupts is verboten, or is it just not done today?

The similar warning on pch platforms was added to catch runtime pm bugs where someone enabled some interrupt source, but didn't hold a runtime pm reference. That's just not going to work. So motivation for this patch is vlv/chv runtime pm really.

But I also think that this check provides value for driver load/resume/suspend since if we change interrupt settings after the interrupts have been disabled or before enabling something is at least fishy. At least insofar as that our irq install hooks nowadays overwrite all of them with default values.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#3 lore raw
Quoted 14 lines · Daniel Vetter
Quoted 7 lines · Chris Wilson
Quoted 3 lines · Daniel Vetter

Now that vlv has runtime pm we kinda should check for that like on the pch split platforms. Looks like this was simply lost in the vlv rpm enabling.

Is there a reason why setting up the pipestat prior to enabling interrupts is verboten, or is it just not done today?

The similar warning on pch platforms was added to catch runtime pm bugs where someone enabled some interrupt source, but didn't hold a runtime pm reference. That's just not going to work. So motivation for this patch is vlv/chv runtime pm really.

Quoted 5 lines

But I also think that this check provides value for driver load/resume/suspend since if we change interrupt settings after the interrupts have been disabled or before enabling something is at least fishy. At least insofar as that our irq install hooks nowadays overwrite all of them with default values.

That's a better blurp. But doesn't it sound a little overly generic just to keep whether or not pipestat_enable is called after uninstall or before install? Since we track the expected register value, could we just semi-randomly check that the register matches that value? -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#4 lore raw
Quoted 21 lines · Chris Wilson
Quoted 14 lines · Daniel Vetter
Quoted 7 lines · Chris Wilson
Quoted 3 lines · Daniel Vetter

Now that vlv has runtime pm we kinda should check for that like on the pch split platforms. Looks like this was simply lost in the vlv rpm enabling.

Is there a reason why setting up the pipestat prior to enabling interrupts is verboten, or is it just not done today?

The similar warning on pch platforms was added to catch runtime pm bugs where someone enabled some interrupt source, but didn't hold a runtime pm reference. That's just not going to work. So motivation for this patch is vlv/chv runtime pm really.

Quoted 5 lines

But I also think that this check provides value for driver load/resume/suspend since if we change interrupt settings after the interrupts have been disabled or before enabling something is at least fishy. At least insofar as that our irq install hooks nowadays overwrite all of them with default values.

Quoted 4 lines

That's a better blurp. But doesn't it sound a little overly generic just to keep whether or not pipestat_enable is called after uninstall or before install? Since we track the expected register value, could we just semi-randomly check that the register matches that value?

I guess we could do both, but I don't really see a good place. Maybe in the enable/disable functions, but I'm not even sure we track the expected state for everyone really.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Reviewed-by on v1 1/1
#5 lore raw
In reply to Daniel Vetter
Quoted 25 lines · On Wed, 27 Aug 2014 10:43:37 +0200 Daniel Vetter <[email protected]> wrote:

Now that vlv has runtime pm we kinda should check for that like on the pch split platforms. Looks like this was simply lost in the vlv rpm enabling.

Cc Paulo Zanoni <[email protected]>
Cc Imre Deak <[email protected]>
Cc Jesse Barnes <[email protected]>
---
 drivers/gpu/drm/i915/i915_irq.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/i915_irq.c +1 -0
index 9eb303c1b621..76bc4d0de5a4 100644
@@ -589,6 +589,7 @@ __i915_enable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
 	u32 pipestat = I915_READ(reg) & PIPESTAT_INT_ENABLE_MASK;
 
 	assert_spin_locked(&dev_priv->irq_lock);
+	WARN_ON(!intel_irqs_enabled(dev_priv));
 
 	if (WARN_ONCE(enable_mask & ~PIPESTAT_INT_ENABLE_MASK ||
 		      status_mask & ~PIPESTAT_INT_STATUS_MASK,

drivers/gpu/drm/i915/i915_irq.c __i915_disable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe, · line 622

Quoted 7 lines
drivers/gpu/drm/i915/i915_irq.c +1 -0
@@ -615,6 +616,7 @@ __i915_disable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
 	u32 pipestat = I915_READ(reg) & PIPESTAT_INT_ENABLE_MASK;
 
 	assert_spin_locked(&dev_priv->irq_lock);
+	WARN_ON(!intel_irqs_enabled(dev_priv));
 
 	if (WARN_ONCE(enable_mask & ~PIPESTAT_INT_ENABLE_MASK ||
 		      status_mask & ~PIPESTAT_INT_STATUS_MASK,

Yeah looks good, wonder if it'll trigger any new warnings.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#6 lore raw
Quoted 15 lines · Jesse Barnes
Quoted 15 lines
drivers/gpu/drm/i915/i915_irq.c +1 -0
index 9eb303c1b621..76bc4d0de5a4 100644
@@ -589,6 +589,7 @@ __i915_enable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
      u32 pipestat = I915_READ(reg) & PIPESTAT_INT_ENABLE_MASK;
 
      assert_spin_locked(&dev_priv->irq_lock);
+     WARN_ON(!intel_irqs_enabled(dev_priv));
 
      if (WARN_ONCE(enable_mask & ~PIPESTAT_INT_ENABLE_MASK ||
                    status_mask & ~PIPESTAT_INT_STATUS_MASK,
@@ -615,6 +616,7 @@ __i915_disable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
      u32 pipestat = I915_READ(reg) & PIPESTAT_INT_ENABLE_MASK;
 
Quoted 7 lines

drivers/gpu/drm/i915/i915_irq.c __i915_enable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe, · line 595

Quoted 5 lines
drivers/gpu/drm/i915/i915_irq.c +1 -0
      assert_spin_locked(&dev_priv->irq_lock);
+     WARN_ON(!intel_irqs_enabled(dev_priv));
 
      if (WARN_ONCE(enable_mask & ~PIPESTAT_INT_ENABLE_MASK ||
                    status_mask & ~PIPESTAT_INT_STATUS_MASK,

Yeah looks good, wonder if it'll trigger any new warnings.

It will blow up in a bunch of postinstall hooks, just like the one for ilk. At least without my patch to shuffle the pm._irqs_disabled assignment around.

Quoted 1 line

... so does that count as an implicit r-b on my other patch? -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#7 lore raw
Quoted 24 lines · On Thu, 4 Sep 2014 17:59:18 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 15 lines · Jesse Barnes
Quoted 15 lines
drivers/gpu/drm/i915/i915_irq.c +1 -0
index 9eb303c1b621..76bc4d0de5a4 100644
@@ -589,6 +589,7 @@ __i915_enable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
      u32 pipestat = I915_READ(reg) & PIPESTAT_INT_ENABLE_MASK;
 
      assert_spin_locked(&dev_priv->irq_lock);
+     WARN_ON(!intel_irqs_enabled(dev_priv));
 
      if (WARN_ONCE(enable_mask & ~PIPESTAT_INT_ENABLE_MASK ||
                    status_mask & ~PIPESTAT_INT_STATUS_MASK,
@@ -615,6 +616,7 @@ __i915_disable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
      u32 pipestat = I915_READ(reg) & PIPESTAT_INT_ENABLE_MASK;
 
Quoted 7 lines

drivers/gpu/drm/i915/i915_irq.c __i915_enable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe, · line 595

Quoted 5 lines
drivers/gpu/drm/i915/i915_irq.c +1 -0
      assert_spin_locked(&dev_priv->irq_lock);
+     WARN_ON(!intel_irqs_enabled(dev_priv));
 
      if (WARN_ONCE(enable_mask & ~PIPESTAT_INT_ENABLE_MASK ||
                    status_mask & ~PIPESTAT_INT_STATUS_MASK,

Yeah looks good, wonder if it'll trigger any new warnings.

Quoted 7 lines

It will blow up in a bunch of postinstall hooks, just like the one for ilk. At least without my patch to shuffle the pm._irqs_disabled assignment around.

Quoted 1 line

... so does that count as an implicit r-b on my other patch?

Sure, though didn't Jani find some issues with it?

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#8 lore raw
Quoted 31 lines · Jesse Barnes
Quoted 28 lines · On Thu, 4 Sep 2014 17:59:18 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 15 lines · Jesse Barnes
Quoted 15 lines
drivers/gpu/drm/i915/i915_irq.c +1 -0
index 9eb303c1b621..76bc4d0de5a4 100644
@@ -589,6 +589,7 @@ __i915_enable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
      u32 pipestat = I915_READ(reg) & PIPESTAT_INT_ENABLE_MASK;
 
      assert_spin_locked(&dev_priv->irq_lock);
+     WARN_ON(!intel_irqs_enabled(dev_priv));
 
      if (WARN_ONCE(enable_mask & ~PIPESTAT_INT_ENABLE_MASK ||
                    status_mask & ~PIPESTAT_INT_STATUS_MASK,
@@ -615,6 +616,7 @@ __i915_disable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
      u32 pipestat = I915_READ(reg) & PIPESTAT_INT_ENABLE_MASK;
 
Quoted 7 lines

drivers/gpu/drm/i915/i915_irq.c __i915_enable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe, · line 595

Quoted 5 lines
drivers/gpu/drm/i915/i915_irq.c +1 -0
      assert_spin_locked(&dev_priv->irq_lock);
+     WARN_ON(!intel_irqs_enabled(dev_priv));
 
      if (WARN_ONCE(enable_mask & ~PIPESTAT_INT_ENABLE_MASK ||
                    status_mask & ~PIPESTAT_INT_STATUS_MASK,

Yeah looks good, wonder if it'll trigger any new warnings.

It will blow up in a bunch of postinstall hooks, just like the one for ilk. At least without my patch to shuffle the pm._irqs_disabled assignment around.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

... so does that count as an implicit r-b on my other patch?

Sure, though didn't Jani find some issues with it?

QA claims that both my and your patch break the display on hsw, bdw and snb or something like that. Which either means I'm blind (since either patch should only affect ilk in a functional way) or they're doing something really strange. I have no idea what's actually going on there, but we have a regular stream of reports of this one here ... -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#9 lore raw
Quoted 36 lines · On Thu, 4 Sep 2014 18:59:55 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 35 lines · Jesse Barnes
Quoted 31 lines · On Thu, 4 Sep 2014 17:59:18 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 15 lines · Jesse Barnes
Quoted 15 lines
drivers/gpu/drm/i915/i915_irq.c +1 -0
index 9eb303c1b621..76bc4d0de5a4 100644
@@ -589,6 +589,7 @@ __i915_enable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
      u32 pipestat = I915_READ(reg) & PIPESTAT_INT_ENABLE_MASK;
 
      assert_spin_locked(&dev_priv->irq_lock);
+     WARN_ON(!intel_irqs_enabled(dev_priv));
 
      if (WARN_ONCE(enable_mask & ~PIPESTAT_INT_ENABLE_MASK ||
                    status_mask & ~PIPESTAT_INT_STATUS_MASK,
@@ -615,6 +616,7 @@ __i915_disable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
      u32 pipestat = I915_READ(reg) & PIPESTAT_INT_ENABLE_MASK;
 
Quoted 7 lines

drivers/gpu/drm/i915/i915_irq.c __i915_enable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe, · line 595

Quoted 5 lines
drivers/gpu/drm/i915/i915_irq.c +1 -0
      assert_spin_locked(&dev_priv->irq_lock);
+     WARN_ON(!intel_irqs_enabled(dev_priv));
 
      if (WARN_ONCE(enable_mask & ~PIPESTAT_INT_ENABLE_MASK ||
                    status_mask & ~PIPESTAT_INT_STATUS_MASK,

Yeah looks good, wonder if it'll trigger any new warnings.

It will blow up in a bunch of postinstall hooks, just like the one for ilk. At least without my patch to shuffle the pm._irqs_disabled assignment around.

Quoted 1 line

... so does that count as an implicit r-b on my other patch?

Quoted 7 lines
Quoted 1 line

Sure, though didn't Jani find some issues with it?

QA claims that both my and your patch break the display on hsw, bdw and snb or something like that. Which either means I'm blind (since either patch should only affect ilk in a functional way) or they're doing something really strange. I have no idea what's actually going on there, but we have a regular stream of reports of this one here ...

Yeah I agree the results are weird; don't see how we'd affect BDW display, esp with my patch, so I'd say go ahead with either. Though if you do mine I guess you'd drop the above.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#10 lore raw
In reply to Jesse Barnes
Quoted 33 lines · Jesse Barnes
Quoted 30 lines · On Wed, 27 Aug 2014 10:43:37 +0200 Daniel Vetter <[email protected]> wrote:

Now that vlv has runtime pm we kinda should check for that like on the pch split platforms. Looks like this was simply lost in the vlv rpm enabling.

Cc Paulo Zanoni <[email protected]>
Cc Imre Deak <[email protected]>
Cc Jesse Barnes <[email protected]>
---
 drivers/gpu/drm/i915/i915_irq.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/i915_irq.c +2 -0
index 9eb303c1b621..76bc4d0de5a4 100644
@@ -589,6 +589,7 @@ __i915_enable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
 	u32 pipestat = I915_READ(reg) & PIPESTAT_INT_ENABLE_MASK;
 
 	assert_spin_locked(&dev_priv->irq_lock);
+	WARN_ON(!intel_irqs_enabled(dev_priv));
 
 	if (WARN_ONCE(enable_mask & ~PIPESTAT_INT_ENABLE_MASK ||
 		      status_mask & ~PIPESTAT_INT_STATUS_MASK,
@@ -615,6 +616,7 @@ __i915_disable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
 	u32 pipestat = I915_READ(reg) & PIPESTAT_INT_ENABLE_MASK;
 
 	assert_spin_locked(&dev_priv->irq_lock);
+	WARN_ON(!intel_irqs_enabled(dev_priv));
 
Quoted 6 lines

drivers/gpu/drm/i915/i915_irq.c __i915_disable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe, · line 622

Quoted 2 lines
drivers/gpu/drm/i915/i915_irq.c +0 -0
 	if (WARN_ONCE(enable_mask & ~PIPESTAT_INT_ENABLE_MASK ||
 		      status_mask & ~PIPESTAT_INT_STATUS_MASK,

Yeah looks good, wonder if it'll trigger any new warnings.

Since Jani just merged the driver load ordering patch I've pulled this one into dinq to maximise testing coverage. Let's see what happens ... -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch