public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH] drm/i915/display: Fix warning callstack for imbalance wakeref
Date: Tue, 23 Aug 2022 08:05:46 +0530	[thread overview]
Message-ID: <20220823023546.2150989-1-mitulkumar.ajitkumar.golani@intel.com> (raw)

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(+)

diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
index deb8a8b76965..b3741bd49e2c 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(rpm->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);
-- 
2.25.1


             reply	other threads:[~2022-08-23  9:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-23  2:35 Mitul Golani [this message]
2022-08-23 10:53 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915/display: Fix warning callstack for imbalance wakeref (rev4) Patchwork
2022-08-23 11:00 ` [Intel-gfx] [PATCH] drm/i915/display: Fix warning callstack for imbalance wakeref Jani Nikula
  -- strict thread matches above, loose matches on Subject: below --
2022-08-30  8:51 Mitul Golani
2022-08-31 11:54 ` Imre Deak
2022-08-31 15:28 ` Andrzej Hajda
2022-08-29  8:31 Mitul Golani
2022-08-23  5:20 Mitul Golani
2022-08-23 14:31 ` Jani Nikula
2022-08-12  4:47 Mitul Golani
2022-08-17 12:49 ` Imre Deak
2022-08-23 12:39   ` Golani, Mitulkumar Ajitkumar
2022-08-23 12:56     ` Golani, Mitulkumar Ajitkumar
2022-08-25 10:51       ` Imre Deak
2022-08-29  6:45         ` Golani, Mitulkumar Ajitkumar
2022-08-29 14:46           ` Imre Deak
2022-08-29 16:59             ` Golani, Mitulkumar Ajitkumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220823023546.2150989-1-mitulkumar.ajitkumar.golani@intel.com \
    --to=mitulkumar.ajitkumar.golani@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox