From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 1/2] drm/i915: fix possible refcount leak when resetting forcewake
Date: Fri, 6 Jun 2014 12:59:38 +0300 [thread overview]
Message-ID: <1402048779-14902-1-git-send-email-imre.deak@intel.com> (raw)
If the timer putting the last forcewake refcount was pending and we
canceled it, we'll leak the corresponding forcewake and RPM references.
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
drivers/gpu/drm/i915/intel_uncore.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
index c90222d..389e235 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -299,9 +299,8 @@ static void vlv_force_wake_put(struct drm_i915_private *dev_priv, int fw_engine)
spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
}
-static void gen6_force_wake_timer(unsigned long arg)
+static void __gen6_force_wake_timer(struct drm_i915_private *dev_priv)
{
- struct drm_i915_private *dev_priv = (void *)arg;
unsigned long irqflags;
assert_device_not_suspended(dev_priv);
@@ -316,12 +315,20 @@ static void gen6_force_wake_timer(unsigned long arg)
intel_runtime_pm_put(dev_priv);
}
+static void gen6_force_wake_timer(unsigned long arg)
+{
+ struct drm_i915_private *dev_priv = (void *)arg;
+
+ __gen6_force_wake_timer(dev_priv);
+}
+
static void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore)
{
struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long irqflags;
- del_timer_sync(&dev_priv->uncore.force_wake_timer);
+ if (del_timer_sync(&dev_priv->uncore.force_wake_timer))
+ __gen6_force_wake_timer(dev_priv);
/* Hold uncore.lock across reset to prevent any register access
* with forcewake not set correctly
--
1.8.4
next reply other threads:[~2014-06-06 10:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-06 9:59 Imre Deak [this message]
2014-06-06 9:59 ` [PATCH 2/2] drm/i915: preserve user forcewake over system suspend/resume Imre Deak
2014-06-06 10:03 ` [PATCH 1/2] drm/i915: fix possible refcount leak when resetting forcewake Chris Wilson
2014-06-06 11:04 ` [PATCH v2 " Imre Deak
2014-06-06 11:08 ` Chris Wilson
2014-06-06 17:46 ` Daniel Vetter
2014-06-06 18:38 ` Imre Deak
2014-06-06 20:15 ` Daniel Vetter
2014-06-06 20:19 ` Imre Deak
2014-06-06 20:35 ` Daniel Vetter
2014-06-06 20:44 ` Imre Deak
2014-06-06 20:54 ` Daniel Vetter
2014-06-10 16:35 ` Jani Nikula
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=1402048779-14902-1-git-send-email-imre.deak@intel.com \
--to=imre.deak@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