[Intel-gfx] [PATCH] drm/i915/display: Fix warning callstack for imbalance wakeref

Mitul Golani mitulkumar.ajitkumar.golani at intel.com
Fri Aug 12 04:47:24 UTC 2022


While executing i915_selftest, wakeref imbalance warning is seen
with i915_selftest failure.

When device is already suspended, wakeref is acquired by
disable_rpm_wakeref_asserts and rpm ownership is transferred back
to core. During this case wakeref_count will not be zero.
Once driver is unregistered, this wakeref is released with
enable_rpm_wakeref_asserts and balancing wakeref_count acquired
by driver.

This patch will fix the warning callstack by adding check if device
is already suspended and rpm ownership transfer is going on.

Signed-off-by: Mitul Golani <mitulkumar.ajitkumar.golani at intel.com>
---
 drivers/gpu/drm/i915/i915_driver.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
index deb8a8b76965..6530a8680cfd 100644
--- a/drivers/gpu/drm/i915/i915_driver.c
+++ b/drivers/gpu/drm/i915/i915_driver.c
@@ -1670,7 +1670,13 @@ static int intel_runtime_resume(struct device *kdev)
 
 	drm_dbg(&dev_priv->drm, "Resuming device\n");
 
-	drm_WARN_ON_ONCE(&dev_priv->drm, atomic_read(&rpm->wakeref_count));
+	/*
+	 * When device is already suspended, Wakeref is acquired by disable_rpm_wakeref_asserts
+	 * and rpm ownership is transferred back to core. During this case wakeref_count will
+	 * not be zero. Once driver is unregistered, this wakeref is released with
+	 * enable_rpm_wakeref_asserts and balancing wakeref_count acquired by driver.
+	 */
+	drm_WARN_ON_ONCE(&dev_priv->drm, atomic_read(&rpm->wakeref_count) && !rpm->suspended);
 	disable_rpm_wakeref_asserts(rpm);
 
 	intel_opregion_notify_adapter(dev_priv, PCI_D0);
-- 
2.25.1



More information about the Intel-gfx mailing list