Skip to contentSkip to conversation

drm/i915: cancel the hangcheck before runtime suspend

PATCH In review Paulo Zanoni 3 participants 7 messages Dec 13, 2013 – Dec 14, 2013

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

PATCH 1/3 drm/i915: cancel the hangcheck before runtime suspend

From: Paulo Zanoni <[email protected]>

The hangcheck function requires the hardware to be working, and if we're suspending we're going to put the HW in D3 state.

---
 drivers/gpu/drm/i915/i915_drv.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_drv.c +1 -0
index e7a6c84..70590b0 100644
@@ -920,6 +920,7 @@ static int i915_runtime_suspend(struct device *device)
 
 	DRM_DEBUG_KMS("Suspending device\n");
 
+	del_timer_sync(&dev_priv->gpu_error.hangcheck_timer);
 	dev_priv->pm.suspended = true;
 	intel_opregion_notify_adapter(dev, PCI_D3cold);
 
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 2/3 drm/i915: release the GTT mmaps when going into D3

From: Paulo Zanoni <[email protected]>

So we'll get a fault when someone tries to access the mmap, then we'll wake up from D3.

v2: - Rebase
v3: - Use gtt active/inactive

Testcase: igt/pm_pc8/gem-mmap-gtt

---
 drivers/gpu/drm/i915/i915_drv.c |  2 ++
 drivers/gpu/drm/i915/i915_drv.h |  1 +
 drivers/gpu/drm/i915/i915_gem.c | 10 ++++++++++
 3 files changed, 13 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +2 -0
index 70590b0..23f8217 100644
@@ -920,6 +920,8 @@ static int i915_runtime_suspend(struct device *device)
 
 	DRM_DEBUG_KMS("Suspending device\n");
 
+	i915_gem_release_all_mmaps(dev_priv);
+
 	del_timer_sync(&dev_priv->gpu_error.hangcheck_timer);
 	dev_priv->pm.suspended = true;
 	intel_opregion_notify_adapter(dev, PCI_D3cold);
drivers/gpu/drm/i915/i915_drv.h +1 -0
index fca2eb6..5e036be 100644
@@ -2013,6 +2013,7 @@ void i915_gem_object_unpin(struct drm_i915_gem_object *obj);
 int __must_check i915_vma_unbind(struct i915_vma *vma);
 int __must_check i915_gem_object_ggtt_unbind(struct drm_i915_gem_object *obj);
 int i915_gem_object_put_pages(struct drm_i915_gem_object *obj);
+void i915_gem_release_all_mmaps(struct drm_i915_private *dev_priv);
 void i915_gem_release_mmap(struct drm_i915_gem_object *obj);
 void i915_gem_lastclose(struct drm_device *dev);
 
drivers/gpu/drm/i915/i915_gem.c +10 -0
index 66f8133..0d7c061 100644
@@ -1465,6 +1465,16 @@ out:
 	return ret;
 }
 
+void i915_gem_release_all_mmaps(struct drm_i915_private *dev_priv)
+{
+	struct i915_vma *vma;
+
+	list_for_each_entry(vma, &dev_priv->gtt.base.active_list, mm_list)
+		i915_gem_release_mmap(vma->obj);
+	list_for_each_entry(vma, &dev_priv->gtt.base.inactive_list, mm_list)
+		i915_gem_release_mmap(vma->obj);
+}
+
 /**
  * i915_gem_release_mmap - remove physical page mappings
  * @obj: obj in question
Signature · 1 line
1.8.3.1
#4 lore raw

PATCH 3/3 drm/i915: add runtime PM support on Haswell

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Now that all the infrastructure is in place and all the tests from pm_pc8 pass, we can finally enable the feature.

---
 drivers/gpu/drm/i915/i915_drv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +1 -1
index 5e036be..5606f8d 100644
@@ -1848,7 +1848,7 @@ struct drm_i915_file_private {
 #define HAS_FPGA_DBG_UNCLAIMED(dev)	(INTEL_INFO(dev)->has_fpga_dbg)
 #define HAS_PSR(dev)		(IS_HASWELL(dev) || IS_BROADWELL(dev))
 #define HAS_PC8(dev)		(IS_HASWELL(dev)) /* XXX HSW:ULX */
-#define HAS_RUNTIME_PM(dev)	false
+#define HAS_RUNTIME_PM(dev)	(IS_HASWELL(dev))
 
 #define INTEL_PCH_DEVICE_ID_MASK		0xff00
 #define INTEL_PCH_IBX_DEVICE_ID_TYPE		0x3b00
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/3
#6 lore raw
In reply to Paulo Zanoni
Quoted 29 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

The hangcheck function requires the hardware to be working, and if we're suspending we're going to put the HW in D3 state.

---
 drivers/gpu/drm/i915/i915_drv.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_drv.c +1 -1
index e7a6c84..70590b0 100644
@@ -920,6 +920,7 @@ static int i915_runtime_suspend(struct device *device)
 
        DRM_DEBUG_KMS("Suspending device\n");
 
+       del_timer_sync(&dev_priv->gpu_error.hangcheck_timer);
        dev_priv->pm.suspended = true;
        intel_opregion_notify_adapter(dev, PCI_D3cold);
 
--

1.8.3.1

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

Signature · 2 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
Reviewed-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] drm/i915: release the GTT mmaps when going into D3

In reply to Paulo Zanoni

When I saw this I was afraid this force could break userspace somehow, but Paulo explained me the release with pagefault mechanism. Thanks Paulo.

Quoted 69 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

So we'll get a fault when someone tries to access the mmap, then we'll wake up from D3.

v2: - Rebase
v3: - Use gtt active/inactive

Testcase: igt/pm_pc8/gem-mmap-gtt

---
 drivers/gpu/drm/i915/i915_drv.c |  2 ++
 drivers/gpu/drm/i915/i915_drv.h |  1 +
 drivers/gpu/drm/i915/i915_gem.c | 10 ++++++++++
 3 files changed, 13 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +2 -0
index 70590b0..23f8217 100644
@@ -920,6 +920,8 @@ static int i915_runtime_suspend(struct device *device)
 
        DRM_DEBUG_KMS("Suspending device\n");
 
+       i915_gem_release_all_mmaps(dev_priv);
+
        del_timer_sync(&dev_priv->gpu_error.hangcheck_timer);
        dev_priv->pm.suspended = true;
        intel_opregion_notify_adapter(dev, PCI_D3cold);
drivers/gpu/drm/i915/i915_drv.h +1 -0
index fca2eb6..5e036be 100644
@@ -2013,6 +2013,7 @@ void i915_gem_object_unpin(struct drm_i915_gem_object *obj);
 int __must_check i915_vma_unbind(struct i915_vma *vma);
 int __must_check i915_gem_object_ggtt_unbind(struct drm_i915_gem_object *obj);
 int i915_gem_object_put_pages(struct drm_i915_gem_object *obj);
+void i915_gem_release_all_mmaps(struct drm_i915_private *dev_priv);
 void i915_gem_release_mmap(struct drm_i915_gem_object *obj);
 void i915_gem_lastclose(struct drm_device *dev);
 
drivers/gpu/drm/i915/i915_gem.c +10 -1
index 66f8133..0d7c061 100644
@@ -1465,6 +1465,16 @@ out:
        return ret;
 }
 
+void i915_gem_release_all_mmaps(struct drm_i915_private *dev_priv)
+{
+       struct i915_vma *vma;
+
+       list_for_each_entry(vma, &dev_priv->gtt.base.active_list, mm_list)
+               i915_gem_release_mmap(vma->obj);
+       list_for_each_entry(vma, &dev_priv->gtt.base.inactive_list, mm_list)
+               i915_gem_release_mmap(vma->obj);
+}
+
 /**
  * i915_gem_release_mmap - remove physical page mappings
  * @obj: obj in question
--

1.8.3.1

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

Signature · 2 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
Reviewed-by on v1 3/3
#5 lore raw

Re: [PATCH 3/3] drm/i915: add runtime PM support on Haswell

In reply to Paulo Zanoni

\o/

Quoted 30 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Now that all the infrastructure is in place and all the tests from pm_pc8 pass, we can finally enable the feature.

---
 drivers/gpu/drm/i915/i915_drv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +1 -2
index 5e036be..5606f8d 100644
@@ -1848,7 +1848,7 @@ struct drm_i915_file_private {
 #define HAS_FPGA_DBG_UNCLAIMED(dev)    (INTEL_INFO(dev)->has_fpga_dbg)
 #define HAS_PSR(dev)           (IS_HASWELL(dev) || IS_BROADWELL(dev))
 #define HAS_PC8(dev)           (IS_HASWELL(dev)) /* XXX HSW:ULX */
-#define HAS_RUNTIME_PM(dev)    false
+#define HAS_RUNTIME_PM(dev)    (IS_HASWELL(dev))
 
 #define INTEL_PCH_DEVICE_ID_MASK               0xff00
 #define INTEL_PCH_IBX_DEVICE_ID_TYPE           0x3b00
--

1.8.3.1

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

Signature · 2 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
#3 lore raw

Re: [PATCH 2/3] drm/i915: release the GTT mmaps when going into D3

In reply to Rodrigo Vivi
Quoted 4 lines · Rodrigo Vivi

When I saw this I was afraid this force could break userspace somehow, but Paulo explained me the release with pagefault mechanism. Thanks Paulo.

Merged all three patches with the small changes added to this one as per our irc discussion.
-Daniel

Quoted 81 lines · Paulo Zanoni
Quoted 69 lines

From: Paulo Zanoni <[email protected]>

So we'll get a fault when someone tries to access the mmap, then we'll wake up from D3.

v2: - Rebase
v3: - Use gtt active/inactive

Testcase: igt/pm_pc8/gem-mmap-gtt

---
 drivers/gpu/drm/i915/i915_drv.c |  2 ++
 drivers/gpu/drm/i915/i915_drv.h |  1 +
 drivers/gpu/drm/i915/i915_gem.c | 10 ++++++++++
 3 files changed, 13 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +2 -0
index 70590b0..23f8217 100644
@@ -920,6 +920,8 @@ static int i915_runtime_suspend(struct device *device)
 
        DRM_DEBUG_KMS("Suspending device\n");
 
+       i915_gem_release_all_mmaps(dev_priv);
+
        del_timer_sync(&dev_priv->gpu_error.hangcheck_timer);
        dev_priv->pm.suspended = true;
        intel_opregion_notify_adapter(dev, PCI_D3cold);
drivers/gpu/drm/i915/i915_drv.h +1 -0
index fca2eb6..5e036be 100644
@@ -2013,6 +2013,7 @@ void i915_gem_object_unpin(struct drm_i915_gem_object *obj);
 int __must_check i915_vma_unbind(struct i915_vma *vma);
 int __must_check i915_gem_object_ggtt_unbind(struct drm_i915_gem_object *obj);
 int i915_gem_object_put_pages(struct drm_i915_gem_object *obj);
+void i915_gem_release_all_mmaps(struct drm_i915_private *dev_priv);
 void i915_gem_release_mmap(struct drm_i915_gem_object *obj);
 void i915_gem_lastclose(struct drm_device *dev);
 
drivers/gpu/drm/i915/i915_gem.c +10 -1
index 66f8133..0d7c061 100644
@@ -1465,6 +1465,16 @@ out:
        return ret;
 }
 
+void i915_gem_release_all_mmaps(struct drm_i915_private *dev_priv)
+{
+       struct i915_vma *vma;
+
+       list_for_each_entry(vma, &dev_priv->gtt.base.active_list, mm_list)
+               i915_gem_release_mmap(vma->obj);
+       list_for_each_entry(vma, &dev_priv->gtt.base.inactive_list, mm_list)
+               i915_gem_release_mmap(vma->obj);
+}
+
 /**
  * i915_gem_release_mmap - remove physical page mappings
  * @obj: obj in question
--

1.8.3.1

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

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch