diff mbox series

drm/i915/display: Fix warning callstack for imbalance wakeref

Message ID 20220823052050.2249138-1-mitulkumar.ajitkumar.golani@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/display: Fix warning callstack for imbalance wakeref | expand

Commit Message

Mitul Golani Aug. 23, 2022, 5:20 a.m. UTC
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@intel.com>
---
 drivers/gpu/drm/i915/i915_driver.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Jani Nikula Aug. 23, 2022, 2:31 p.m. UTC | #1
On Tue, 23 Aug 2022, Mitul Golani <mitulkumar.ajitkumar.golani@intel.com> wrote:
> 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.

Why have you sent the same patch multiple times in the same day?

Please see my earlier reply
https://lore.kernel.org/r/87k06zkyw3.fsf@intel.com

BR,
Jani.



>
> Signed-off-by: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_driver.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
> index deb8a8b76965..99d6df02dc67 100644
> --- a/drivers/gpu/drm/i915/i915_driver.c
> +++ b/drivers/gpu/drm/i915/i915_driver.c
> @@ -948,6 +948,15 @@ int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  
>  void i915_driver_remove(struct drm_i915_private *i915)
>  {
> +	int ret;
> +	/*
> +	 * Resuming Device if already suspended to complete driver unregistration
> +	 */
> +	if (i915->runtime_pm.suspended && !atomic_read(&i915->runtime_pm.wakeref_count)) {
> +		ret = pm_runtime_get_sync(i915->runtime_pm.kdev);
> +		drm_WARN_ONCE(&i915->drm, ret < 0, "pm_runtime_get_sync() failed: %d\n", ret);
> +	}
> +
>  	disable_rpm_wakeref_asserts(&i915->runtime_pm);
>  
>  	i915_driver_unregister(i915);
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
index deb8a8b76965..99d6df02dc67 100644
--- a/drivers/gpu/drm/i915/i915_driver.c
+++ b/drivers/gpu/drm/i915/i915_driver.c
@@ -948,6 +948,15 @@  int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 void i915_driver_remove(struct drm_i915_private *i915)
 {
+	int ret;
+	/*
+	 * Resuming Device if already suspended to complete driver unregistration
+	 */
+	if (i915->runtime_pm.suspended && !atomic_read(&i915->runtime_pm.wakeref_count)) {
+		ret = pm_runtime_get_sync(i915->runtime_pm.kdev);
+		drm_WARN_ONCE(&i915->drm, ret < 0, "pm_runtime_get_sync() failed: %d\n", ret);
+	}
+
 	disable_rpm_wakeref_asserts(&i915->runtime_pm);
 
 	i915_driver_unregister(i915);