Skip to contentSkip to conversation

drm/i915: Don't fail rpm suspend with -EGAIN

PATCH In review Daniel Vetter 3 participants 4 messages Nov 17, 2015 – Nov 18, 2015

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

PATCH 1/1 drm/i915: Don't fail rpm suspend with -EGAIN

If we can't acquire dev->struct_mutex we need to fail runtime suspend, at least with the current design. Currently we do that using -EAGAIN, but that upsets the pm core, resulting in the occasional fail testcase in our CI with the following dmesg dirt:

pci_pm_runtime_suspend(): intel_runtime_suspend+0x0/0x240 [i915] returns -11

Chris has some ideas to improve this, but for now just shut up the error.

Cc Paulo Zanoni <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +3 -3
index 5a70aca71d6b..ab8ffbc48e2d 100644
@@ -1497,8 +1497,7 @@ static int intel_runtime_suspend(struct device *device)
 	 * We could deadlock here in case another thread holding struct_mutex
 	 * calls RPM suspend concurrently, since the RPM suspend will wait
 	 * first for this RPM suspend to finish. In this case the concurrent
-	 * RPM resume will be followed by its RPM suspend counterpart. Still
-	 * for consistency return -EAGAIN, which will reschedule this suspend.
+	 * RPM resume will be followed by its RPM suspend counterpart.
 	 */
 	if (!mutex_trylock(&dev->struct_mutex)) {
 		DRM_DEBUG_KMS("device lock contention, deffering suspend\n");
@@ -1508,7 +1507,8 @@ static int intel_runtime_suspend(struct device *device)
 		 */
 		pm_runtime_mark_last_busy(device);
 
-		return -EAGAIN;
+		/* Fail silently to avoid upsetting the pm core. */
+		return 0;
 	}
 	/*
 	 * We are safe here against re-faults, since the fault handler takes
Signature · 6 lines
2.5.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 32 lines · Daniel Vetter

If we can't acquire dev->struct_mutex we need to fail runtime suspend, at least with the current design. Currently we do that using -EAGAIN, but that upsets the pm core, resulting in the occasional fail testcase in our CI with the following dmesg dirt:

pci_pm_runtime_suspend(): intel_runtime_suspend+0x0/0x240 [i915] returns -11

Chris has some ideas to improve this, but for now just shut up the error.

Cc Paulo Zanoni <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +1 -2
index 5a70aca71d6b..ab8ffbc48e2d 100644
@@ -1497,8 +1497,7 @@ static int intel_runtime_suspend(struct device *device)
 	 * We could deadlock here in case another thread holding struct_mutex
 	 * calls RPM suspend concurrently, since the RPM suspend will wait
 	 * first for this RPM suspend to finish. In this case the concurrent
-	 * RPM resume will be followed by its RPM suspend counterpart. Still
-	 * for consistency return -EAGAIN, which will reschedule this suspend.
+	 * RPM resume will be followed by its RPM suspend counterpart.
 	 */
 	if (!mutex_trylock(&dev->struct_mutex)) {
 		DRM_DEBUG_KMS("device lock contention, deffering suspend\n");

drivers/gpu/drm/i915/i915_drv.c static int intel_runtime_suspend(struct device *device) · line 1511

Quoted 6 lines
drivers/gpu/drm/i915/i915_drv.c +2 -1
@@ -1508,7 +1507,8 @@ static int intel_runtime_suspend(struct device *device)
 		 */
 		pm_runtime_mark_last_busy(device);
 
-		return -EAGAIN;
+		/* Fail silently to avoid upsetting the pm core. */
+		return 0;

So the core will assume we're now suspended and then resume gets called while we're still powered on. Sounds like a bad plan to me. I'm especially worried about VLV here with its GT no wake dance and manual save/restore.

Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.c +0 -0
 	}
 	/*
 	 * We are safe here against re-faults, since the fault handler takes
Signature · 6 lines
2.5.1

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

If we can't acquire dev->struct_mutex we need to fail runtime suspend, at least with the current design. Currently we do that using -EAGAIN, but that upsets the pm core, resulting in the occasional fail testcase in our CI with the following dmesg dirt:

pci_pm_runtime_suspend(): intel_runtime_suspend+0x0/0x240 [i915] returns -11

Chris has some ideas to improve this, but for now just shut up the error.

Cc Paulo Zanoni <[email protected]>
Cc Chris Wilson <[email protected]>

---
 drivers/gpu/drm/i915/i915_drv.c | 6 +++---

 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +1 -2
index 5a70aca71d6b..ab8ffbc48e2d 100644
@@ -1497,8 +1497,7 @@ static int intel_runtime_suspend(struct device *device)
  	 * We could deadlock here in case another thread holding struct_mutex
  	 * calls RPM suspend concurrently, since the RPM suspend will wait
  	 * first for this RPM suspend to finish. In this case the concurrent
-	 * RPM resume will be followed by its RPM suspend counterpart. Still
-	 * for consistency return -EAGAIN, which will reschedule this suspend.
+	 * RPM resume will be followed by its RPM suspend counterpart.
  	 */
  	if (!mutex_trylock(&dev->struct_mutex)) {
  		DRM_DEBUG_KMS("device lock contention, deffering suspend\n");
@@ -1508,7 +1507,8 @@ static int intel_runtime_suspend(struct device *device)
  		 */
  		pm_runtime_mark_last_busy(device);

Quoted 8 lines

drivers/gpu/drm/i915/i915_drv.c static int intel_runtime_suspend(struct device *device) · line 1511

Quoted 3 lines
drivers/gpu/drm/i915/i915_drv.c +2 -1
-		return -EAGAIN;
+		/* Fail silently to avoid upsetting the pm core. */
+		return 0;

So the core will assume we're now suspended and then resume gets called while we're still powered on. Sounds like a bad plan to me. I'm especially worried about VLV here with its GT no wake dance and manual save/restore.

Also the PCI core will put the device into D3 if we report success.

Quoted 7 lines
Quoted 7 lines

  }
  /*
   * We are safe here against re-faults, since the fault handler takes --
2.5.1

Quoted 5 lines
Quoted 4 lines

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

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

#3 lore raw
Quoted 46 lines · Imre Deak
Quoted 36 lines · Ville Syrjälä
Quoted 35 lines · Daniel Vetter

If we can't acquire dev->struct_mutex we need to fail runtime suspend, at least with the current design. Currently we do that using -EAGAIN, but that upsets the pm core, resulting in the occasional fail testcase in our CI with the following dmesg dirt:

pci_pm_runtime_suspend(): intel_runtime_suspend+0x0/0x240 [i915] returns -11

Chris has some ideas to improve this, but for now just shut up the error.

Cc Paulo Zanoni <[email protected]>
Cc Chris Wilson <[email protected]>

---
 drivers/gpu/drm/i915/i915_drv.c | 6 +++---

 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +1 -2
index 5a70aca71d6b..ab8ffbc48e2d 100644
@@ -1497,8 +1497,7 @@ static int intel_runtime_suspend(struct device *device)
  	 * We could deadlock here in case another thread holding struct_mutex
  	 * calls RPM suspend concurrently, since the RPM suspend will wait
  	 * first for this RPM suspend to finish. In this case the concurrent
-	 * RPM resume will be followed by its RPM suspend counterpart. Still
-	 * for consistency return -EAGAIN, which will reschedule this suspend.
+	 * RPM resume will be followed by its RPM suspend counterpart.
  	 */
  	if (!mutex_trylock(&dev->struct_mutex)) {
  		DRM_DEBUG_KMS("device lock contention, deffering suspend\n");
@@ -1508,7 +1507,8 @@ static int intel_runtime_suspend(struct device *device)
  		 */
  		pm_runtime_mark_last_busy(device);

Quoted 8 lines

drivers/gpu/drm/i915/i915_drv.c static int intel_runtime_suspend(struct device *device) · line 1511

Quoted 3 lines
drivers/gpu/drm/i915/i915_drv.c +2 -1
-		return -EAGAIN;
+		/* Fail silently to avoid upsetting the pm core. */
+		return 0;

So the core will assume we're now suspended and then resume gets called while we're still powered on. Sounds like a bad plan to me. I'm especially worried about VLV here with its GT no wake dance and manual save/restore.

Quoted 1 line

Also the PCI core will put the device into D3 if we report success.

Oh right. Somehow I remembered that it was for system suspend only, but it's there for runtime pm as well.

So I think if we want to hide the dmesg spew temporarily, the only sane option is to reduce the loglevel in __suspend_report_result().

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines

  }
  /*
   * We are safe here against re-faults, since the fault handler takes --
2.5.1

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

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