Skip to contentSkip to conversation

drm/i915: Grab RPM wakeref around enabling vblank interrupts

PATCH In review Chris Wilson 3 participants 8 messages Oct 7, 2016 – Oct 10, 2016

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

PATCH 1/1 drm/i915: Grab RPM wakeref around enabling vblank interrupts

Whilst the vblank is configured to send an interrupt everytime, we need to keep the device awake to process those interrupts.

References: https://bugs.freedesktop.org/show_bug.cgi?id=97985

---
 drivers/gpu/drm/i915/i915_irq.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/gpu/drm/i915/i915_irq.c +16 -0
index bd6c8b0eeaef..bda7a27615a6 100644
@@ -2723,6 +2723,8 @@ static int i915_enable_vblank(struct drm_device *dev, unsigned int pipe)
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	unsigned long irqflags;
 
+	intel_runtime_pm_get(dev_priv);
+
 	spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
 	if (INTEL_INFO(dev)->gen >= 4)
 		i915_enable_pipestat(dev_priv, pipe,
@@ -2742,6 +2744,8 @@ static int ironlake_enable_vblank(struct drm_device *dev, unsigned int pipe)
 	uint32_t bit = (INTEL_INFO(dev)->gen >= 7) ? DE_PIPE_VBLANK_IVB(pipe) :
 						     DE_PIPE_VBLANK(pipe);
 
+	intel_runtime_pm_get(dev_priv);
+
 	spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
 	ilk_enable_display_irq(dev_priv, bit);
 	spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
@@ -2754,6 +2758,8 @@ static int valleyview_enable_vblank(struct drm_device *dev, unsigned int pipe)
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	unsigned long irqflags;
 
+	intel_runtime_pm_get(dev_priv);
+
 	spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
 	i915_enable_pipestat(dev_priv, pipe,
 			     PIPE_START_VBLANK_INTERRUPT_STATUS);
@@ -2767,6 +2773,8 @@ static int gen8_enable_vblank(struct drm_device *dev, unsigned int pipe)
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	unsigned long irqflags;
 
+	intel_runtime_pm_get(dev_priv);
+
 	spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
 	bdw_enable_pipe_irq(dev_priv, pipe, GEN8_PIPE_VBLANK);
 	spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
@@ -2787,6 +2795,8 @@ static void i915_disable_vblank(struct drm_device *dev, unsigned int pipe)
 			      PIPE_VBLANK_INTERRUPT_STATUS |
 			      PIPE_START_VBLANK_INTERRUPT_STATUS);
 	spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
+
+	intel_runtime_pm_put(dev_priv);
 }
 
 static void ironlake_disable_vblank(struct drm_device *dev, unsigned int pipe)
@@ -2799,6 +2809,8 @@ static void ironlake_disable_vblank(struct drm_device *dev, unsigned int pipe)
 	spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
 	ilk_disable_display_irq(dev_priv, bit);
 	spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
+
+	intel_runtime_pm_put(dev_priv);
 }
 
 static void valleyview_disable_vblank(struct drm_device *dev, unsigned int pipe)
@@ -2810,6 +2822,8 @@ static void valleyview_disable_vblank(struct drm_device *dev, unsigned int pipe)
 	i915_disable_pipestat(dev_priv, pipe,
 			      PIPE_START_VBLANK_INTERRUPT_STATUS);
 	spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
+
+	intel_runtime_pm_put(dev_priv);
 }
 
 static void gen8_disable_vblank(struct drm_device *dev, unsigned int pipe)
@@ -2820,6 +2834,8 @@ static void gen8_disable_vblank(struct drm_device *dev, unsigned int pipe)
 	spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
 	bdw_disable_pipe_irq(dev_priv, pipe, GEN8_PIPE_VBLANK);
 	spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
+
+	intel_runtime_pm_put(dev_priv);
 }
 
 static bool
Signature · 6 lines
2.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 2 lines · Chris Wilson

Whilst the vblank is configured to send an interrupt everytime, we need to keep the device awake to process those interrupts.

If we can enable vblanks the pipe will be active, and thus we can't runtime suspend anyway. Also might_sleep() would be a problem.

Quoted 91 lines

References: https://bugs.freedesktop.org/show_bug.cgi?id=97985

---
 drivers/gpu/drm/i915/i915_irq.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/gpu/drm/i915/i915_irq.c +16 -0
index bd6c8b0eeaef..bda7a27615a6 100644
@@ -2723,6 +2723,8 @@ static int i915_enable_vblank(struct drm_device *dev, unsigned int pipe)
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	unsigned long irqflags;
 
+	intel_runtime_pm_get(dev_priv);
+
 	spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
 	if (INTEL_INFO(dev)->gen >= 4)
 		i915_enable_pipestat(dev_priv, pipe,
@@ -2742,6 +2744,8 @@ static int ironlake_enable_vblank(struct drm_device *dev, unsigned int pipe)
 	uint32_t bit = (INTEL_INFO(dev)->gen >= 7) ? DE_PIPE_VBLANK_IVB(pipe) :
 						     DE_PIPE_VBLANK(pipe);
 
+	intel_runtime_pm_get(dev_priv);
+
 	spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
 	ilk_enable_display_irq(dev_priv, bit);
 	spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
@@ -2754,6 +2758,8 @@ static int valleyview_enable_vblank(struct drm_device *dev, unsigned int pipe)
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	unsigned long irqflags;
 
+	intel_runtime_pm_get(dev_priv);
+
 	spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
 	i915_enable_pipestat(dev_priv, pipe,
 			     PIPE_START_VBLANK_INTERRUPT_STATUS);
@@ -2767,6 +2773,8 @@ static int gen8_enable_vblank(struct drm_device *dev, unsigned int pipe)
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	unsigned long irqflags;
 
+	intel_runtime_pm_get(dev_priv);
+
 	spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
 	bdw_enable_pipe_irq(dev_priv, pipe, GEN8_PIPE_VBLANK);
 	spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
@@ -2787,6 +2795,8 @@ static void i915_disable_vblank(struct drm_device *dev, unsigned int pipe)
 			      PIPE_VBLANK_INTERRUPT_STATUS |
 			      PIPE_START_VBLANK_INTERRUPT_STATUS);
 	spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
+
+	intel_runtime_pm_put(dev_priv);
 }
 
 static void ironlake_disable_vblank(struct drm_device *dev, unsigned int pipe)
@@ -2799,6 +2809,8 @@ static void ironlake_disable_vblank(struct drm_device *dev, unsigned int pipe)
 	spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
 	ilk_disable_display_irq(dev_priv, bit);
 	spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
+
+	intel_runtime_pm_put(dev_priv);
 }
 
 static void valleyview_disable_vblank(struct drm_device *dev, unsigned int pipe)
@@ -2810,6 +2822,8 @@ static void valleyview_disable_vblank(struct drm_device *dev, unsigned int pipe)
 	i915_disable_pipestat(dev_priv, pipe,
 			      PIPE_START_VBLANK_INTERRUPT_STATUS);
 	spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
+
+	intel_runtime_pm_put(dev_priv);
 }
 
 static void gen8_disable_vblank(struct drm_device *dev, unsigned int pipe)
@@ -2820,6 +2834,8 @@ static void gen8_disable_vblank(struct drm_device *dev, unsigned int pipe)
 	spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
 	bdw_disable_pipe_irq(dev_priv, pipe, GEN8_PIPE_VBLANK);
 	spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
+
+	intel_runtime_pm_put(dev_priv);
 }
 
 static bool
Signature · 6 lines
2.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
Quoted 6 lines · Ville Syrjälä
Quoted 2 lines · Chris Wilson

Whilst the vblank is configured to send an interrupt everytime, we need to keep the device awake to process those interrupts.

If we can enable vblanks the pipe will be active, and thus we can't runtime suspend anyway. Also might_sleep() would be a problem.

Where is the pipe made active? Is it just having any mode is sufficient to disable rpm? Will that always be the case?

Just tracing from the drm_wait_vblank ioctl to the mmio access it didn't occur to me that there was a crtc wakeref.

Choice is either using something like intel_runtime_pm_get_noresume() or /* CRTC must be kept alive whilst we enable vblanks */ assert_rpm...()

And possibly even using the seq check.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
Quoted 10 lines · Chris Wilson
Quoted 6 lines · Ville Syrjälä
Quoted 2 lines · Chris Wilson

Whilst the vblank is configured to send an interrupt everytime, we need to keep the device awake to process those interrupts.

If we can enable vblanks the pipe will be active, and thus we can't runtime suspend anyway. Also might_sleep() would be a problem.

Where is the pipe made active? Is it just having any mode is sufficient to disable rpm? Will that always be the case?

Active pipe holds a power domain reference, which implies an rpm reference as well.

Quoted 13 lines

Just tracing from the drm_wait_vblank ioctl to the mmio access it didn't occur to me that there was a crtc wakeref.

Choice is either using something like intel_runtime_pm_get_noresume() or /* CRTC must be kept alive whilst we enable vblanks */ assert_rpm...()

And possibly even using the seq check.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
Quoted 6 lines · Ville Syrjälä
Quoted 5 lines · Chris Wilson
Quoted 4 lines · Ville Syrjälä
Quoted 2 lines · Chris Wilson

Whilst the vblank is configured to send an interrupt everytime, we need to keep the device awake to process those interrupts.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

If we can enable vblanks the pipe will be active, and thus we can't runtime suspend anyway. Also might_sleep() would be a problem.

Where is the pipe made active? Is it just having any mode is sufficient to disable rpm? Will that always be the case?

Active pipe holds a power domain reference, which implies an rpm reference as well.

What's the best way to write

	/* vblank IRQ requires the powerwell to stay awake */
	WARN_ON(!to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe])->active);

?

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw
Quoted 13 lines · Chris Wilson
Quoted 12 lines · Ville Syrjälä
Quoted 10 lines · Chris Wilson
Quoted 6 lines · Ville Syrjälä
Quoted 2 lines · Chris Wilson

Whilst the vblank is configured to send an interrupt everytime, we need to keep the device awake to process those interrupts.

If we can enable vblanks the pipe will be active, and thus we can't runtime suspend anyway. Also might_sleep() would be a problem.

Where is the pipe made active? Is it just having any mode is sufficient to disable rpm? Will that always be the case?

Quoted 7 lines
Quoted 2 lines

Active pipe holds a power domain reference, which implies an rpm reference as well.

What's the best way to write

	/* vblank IRQ requires the powerwell to stay awake */
	WARN_ON(!to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe])->active);

Also, any reason why we shouldn't merge valleyview_enable_vblank() with i915_enable_vblank()?
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw
Quoted 14 lines · Chris Wilson
Quoted 13 lines · Chris Wilson
Quoted 12 lines · Ville Syrjälä
Quoted 10 lines · Chris Wilson
Quoted 6 lines · Ville Syrjälä
Quoted 2 lines · Chris Wilson

Whilst the vblank is configured to send an interrupt everytime, we need to keep the device awake to process those interrupts.

If we can enable vblanks the pipe will be active, and thus we can't runtime suspend anyway. Also might_sleep() would be a problem.

Where is the pipe made active? Is it just having any mode is sufficient to disable rpm? Will that always be the case?

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

Active pipe holds a power domain reference, which implies an rpm reference as well.

What's the best way to write

	/* vblank IRQ requires the powerwell to stay awake */
	WARN_ON(!to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe])->active);

Probably just that. We have some kind of function to hide the details of the array a bit though, I just never rememer what it's called. And I think I have patches somewhere to convert all of that over to storing intel_crtc * instead of drm_crtc * since that's what everyone wants.

Quoted 3 lines

Also, any reason why we shouldn't merge valleyview_enable_vblank() with i915_enable_vblank()?

No reason AFAICS. Same for disable. Though maybe we should add the gen check to disable to make it symmetric, just to avoid some head scratching.

Hmm. Or actually, maybe just split to i915_*_vblank() and i965_*_vblank() instead. Not much point in having the if in there when you can just assign the right function pointer to begin with.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

✗ Fi.CI.BAT: warning for drm/i915: Grab RPM wakeref around enabling vblank interrupts

In reply to Chris Wilson
== Series Details ==

== Series Details ==

Series: drm/i915: Grab RPM wakeref around enabling vblank interrupts
URL : https://patchwork.freedesktop.org/series/13446/
State : warning

== Summary ==

Series 13446v1 drm/i915: Grab RPM wakeref around enabling vblank interrupts
https://patchwork.freedesktop.org/api/1.0/series/13446/revisions/1/mbox/

Test core_auth:

        Subgroup basic-auth:
                pass       -> DMESG-WARN (fi-byt-j1900)
                pass       -> DMESG-WARN (fi-bsw-n3050)
                pass       -> DMESG-WARN (fi-skl-6700hq)
                pass       -> DMESG-WARN (fi-byt-n2820)
                pass       -> DMESG-WARN (fi-ivb-3520m)
                pass       -> DMESG-WARN (fi-hsw-4770r)
                pass       -> DMESG-WARN (fi-skl-6700k)
                pass       -> DMESG-WARN (fi-hsw-4770)
                pass       -> DMESG-WARN (fi-snb-2600)
                pass       -> DMESG-WARN (fi-ilk-650)
                pass       -> DMESG-WARN (fi-skl-6260u)
                pass       -> DMESG-WARN (fi-snb-2520m)
                pass       -> DMESG-WARN (fi-kbl-7200u)
                pass       -> DMESG-WARN (fi-bxt-t5700)
                pass       -> DMESG-WARN (fi-skl-6770hq)
                pass       -> DMESG-WARN (fi-bdw-5557u)
Test drv_getparams_basic:
        Subgroup basic-subslice-total:
                pass       -> DMESG-WARN (fi-snb-2520m)
                pass       -> DMESG-WARN (fi-byt-j1900)
                pass       -> DMESG-WARN (fi-bxt-t5700)
                pass       -> DMESG-WARN (fi-byt-n2820)
                pass       -> DMESG-WARN (fi-bsw-n3050)
Test drv_hangman:
        Subgroup error-state-basic:
                pass       -> DMESG-WARN (fi-byt-j1900)
                pass       -> DMESG-WARN (fi-bsw-n3050)
                pass       -> DMESG-WARN (fi-skl-6700hq)
                pass       -> DMESG-WARN (fi-byt-n2820)
                pass       -> DMESG-WARN (fi-ivb-3520m)
                pass       -> DMESG-WARN (fi-hsw-4770r)
                pass       -> DMESG-WARN (fi-skl-6700k)
                pass       -> DMESG-WARN (fi-hsw-4770)
                pass       -> DMESG-WARN (fi-snb-2600)
                pass       -> DMESG-WARN (fi-ilk-650)
                pass       -> DMESG-WARN (fi-skl-6260u)
                pass       -> DMESG-WARN (fi-snb-2520m)
                pass       -> DMESG-WARN (fi-kbl-7200u)
                pass       -> DMESG-WARN (fi-bxt-t5700)
                pass       -> DMESG-WARN (fi-skl-6770hq)
                pass       -> DMESG-WARN (fi-bdw-5557u)
Test drv_module_reload_basic:
                pass       -> DMESG-WARN (fi-byt-j1900)
                pass       -> DMESG-WARN (fi-bsw-n3050)
                pass       -> DMESG-WARN (fi-skl-6700hq)
                pass       -> DMESG-WARN (fi-byt-n2820)
                pass       -> DMESG-WARN (fi-ivb-3520m)
                pass       -> DMESG-WARN (fi-hsw-4770r)
                pass       -> DMESG-WARN (fi-kbl-7200u)
                pass       -> DMESG-WARN (fi-hsw-4770)
                pass       -> DMESG-WARN (fi-snb-2600)
                pass       -> DMESG-WARN (fi-ilk-650)
                pass       -> DMESG-WARN (fi-skl-6260u)
                pass       -> DMESG-WARN (fi-snb-2520m)
                pass       -> DMESG-WARN (fi-bxt-t5700)
                pass       -> DMESG-WARN (fi-skl-6770hq)
                pass       -> DMESG-WARN (fi-bdw-5557u)
Test gem_basic:
        Subgroup create-fd-close:
                pass       -> DMESG-WARN (fi-snb-2520m)
                pass       -> DMESG-WARN (fi-byt-j1900)
                pass       -> DMESG-WARN (fi-bxt-t5700)
Test gem_busy:
        Subgroup basic-busy-default:
                pass       -> DMESG-WARN (fi-bsw-n3050)
                pass       -> DMESG-WARN (fi-byt-n2820)
        Subgroup basic-hang-default:
                pass       -> DMESG-WARN (fi-byt-j1900)
                pass       -> DMESG-WARN (fi-bsw-n3050)
                pass       -> DMESG-WARN (fi-skl-6700hq)
                pass       -> DMESG-WARN (fi-byt-n2820)
                pass       -> DMESG-WARN (fi-ivb-3520m)
                pass       -> DMESG-WARN (fi-hsw-4770r)
                pass       -> DMESG-WARN (fi-skl-6700k)
                pass       -> DMESG-WARN (fi-hsw-4770)
                pass       -> DMESG-WARN (fi-snb-2600)
                pass       -> DMESG-WARN (fi-ilk-650)
                pass       -> DMESG-WARN (fi-skl-6260u)
                pass       -> DMESG-WARN (fi-snb-2520m)
                pass       -> DMESG-WARN (fi-kbl-7200u)
                pass       -> DMESG-WARN (fi-bxt-t5700)
                pass       -> DMESG-WARN (fi-skl-6770hq)
                pass       -> DMESG-WARN (fi-bdw-5557u)
Test gem_close_race:
        Subgroup basic-threads:
                pass       -> DMESG-WARN (fi-byt-j1900)
                pass       -> DMESG-WARN (fi-bsw-n3050)
                pass       -> DMESG-WARN (fi-skl-6700hq)
                pass       -> DMESG-WARN (fi-byt-n2820)
                pass       -> DMESG-WARN (fi-ivb-3520m)
                pass       -> DMESG-WARN (fi-hsw-4770r)
                pass       -> DMESG-WARN (fi-skl-6700k)
                pass       -> DMESG-WARN (fi-hsw-4770)
                pass       -> DMESG-WARN (fi-snb-2600)
                pass       -> DMESG-WARN (fi-ilk-650)

WARNING: Long output truncated

Results at /archive/results/CI_IGT_test/Patchwork_2649/

0f2a32f6bdc7590370d79a8ec5be27a8762f1d91 drm-intel-nightly: 2016y-10m-10d-05h-29m-53s UTC integration manifest 3d4372d drm/i915: Grab RPM wakeref around enabling vblank interrupts

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx