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

Mitul Golani mitulkumar.ajitkumar.golani at intel.com
Sun Aug 28 23:06:10 UTC 2022


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

Currently when Driver is suspended, while doing unregister
it is taking wakeref without resuming the device.
This patch is resuming the device, if driver is already suspended
and doing unregister process. It will check the suspend state and
if driver is not resumed before taking wakeref then resume before
it.

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

diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
index 1332c70370a6..14abe7dc150f 100644
--- a/drivers/gpu/drm/i915/i915_driver.c
+++ b/drivers/gpu/drm/i915/i915_driver.c
@@ -953,6 +953,13 @@ int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 void i915_driver_remove(struct drm_i915_private *i915)
 {
+	intel_wakeref_t wakeref = 0;
+	/*
+	 * Resuming Device if already suspended to complete driver unregistration
+	 */
+	if (i915->runtime_pm.suspended && !atomic_read(&i915->runtime_pm.wakeref_count))
+		wakeref = intel_runtime_pm_get(&i915->runtime_pm);
+
 	disable_rpm_wakeref_asserts(&i915->runtime_pm);
 
 	i915_driver_unregister(i915);
@@ -978,6 +985,9 @@ void i915_driver_remove(struct drm_i915_private *i915)
 	i915_driver_hw_remove(i915);
 
 	enable_rpm_wakeref_asserts(&i915->runtime_pm);
+
+	if (wakeref)
+		intel_runtime_pm_put(&i915->runtime_pm, wakeref);
 }
 
 static void i915_driver_release(struct drm_device *dev)
-- 
2.25.1



More information about the Intel-gfx-trybot mailing list