All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <przanoni@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [PATCH 02/19] drm/i915: get/put runtime PM without holding rps.hw_lock
Date: Thu, 19 Dec 2013 11:54:52 -0200	[thread overview]
Message-ID: <1387461309-2756-3-git-send-email-przanoni@gmail.com> (raw)
In-Reply-To: <1387461309-2756-1-git-send-email-przanoni@gmail.com>

From: Paulo Zanoni <paulo.r.zanoni@intel.com>

We'll need this when we merge PC8 and Runtime PM: the PC8
enable/disable functions need that lock.

Also, it's good practice to not hold a lock for longer than strictly
needed.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 430eb3e..1cdc5dd 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1414,7 +1414,7 @@ static int i915_ring_freq_table(struct seq_file *m, void *unused)
 	struct drm_info_node *node = (struct drm_info_node *) m->private;
 	struct drm_device *dev = node->minor->dev;
 	drm_i915_private_t *dev_priv = dev->dev_private;
-	int ret;
+	int ret = 0;
 	int gpu_freq, ia_freq;
 
 	if (!(IS_GEN6(dev) || IS_GEN7(dev))) {
@@ -1422,12 +1422,13 @@ static int i915_ring_freq_table(struct seq_file *m, void *unused)
 		return 0;
 	}
 
+	intel_runtime_pm_get(dev_priv);
+
 	flush_delayed_work(&dev_priv->rps.delayed_resume_work);
 
 	ret = mutex_lock_interruptible(&dev_priv->rps.hw_lock);
 	if (ret)
-		return ret;
-	intel_runtime_pm_get(dev_priv);
+		goto out;
 
 	seq_puts(m, "GPU freq (MHz)\tEffective CPU freq (MHz)\tEffective Ring freq (MHz)\n");
 
@@ -1444,10 +1445,11 @@ static int i915_ring_freq_table(struct seq_file *m, void *unused)
 			   ((ia_freq >> 8) & 0xff) * 100);
 	}
 
-	intel_runtime_pm_put(dev_priv);
 	mutex_unlock(&dev_priv->rps.hw_lock);
 
-	return 0;
+out:
+	intel_runtime_pm_put(dev_priv);
+	return ret;
 }
 
 static int i915_gfxec(struct seq_file *m, void *unused)
-- 
1.8.3.1

  parent reply	other threads:[~2013-12-19 13:55 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-19 13:54 [PATCH 00/19] Make PC8 become part of runtime PM Paulo Zanoni
2013-12-19 13:54 ` [PATCH 01/19] drm/i915: rename modeset_update_power_wells Paulo Zanoni
2014-02-27 13:44   ` Imre Deak
2013-12-19 13:54 ` Paulo Zanoni [this message]
2013-12-19 18:30   ` [PATCH 02/19] drm/i915: get/put runtime PM without holding rps.hw_lock Jesse Barnes
2013-12-19 21:20     ` Daniel Vetter
2013-12-19 21:31       ` Paulo Zanoni
2014-02-27 13:45   ` Imre Deak
2013-12-19 13:54 ` [PATCH 03/19] drm/i915: add forcewake functions that don't touch runtime PM Paulo Zanoni
2014-02-27 14:43   ` Imre Deak
2014-02-27 14:48     ` Paulo Zanoni
2014-02-27 15:24       ` Imre Deak
2014-03-04 14:18       ` Daniel Vetter
2013-12-19 13:54 ` [PATCH 04/19] drm/i915: extract __hsw_do_{en, dis}able_package_c8 Paulo Zanoni
2014-02-27 14:49   ` Imre Deak
2013-12-19 13:54 ` [PATCH 05/19] drm/i915: make PC8 be part of runtime PM suspend/resume Paulo Zanoni
2013-12-19 13:54 ` [PATCH 06/19] drm/i915: get/put runtime PM when we get/put a power domain Paulo Zanoni
2014-01-24 19:58   ` Paulo Zanoni
2013-12-19 13:54 ` [PATCH 07/19] drm/i915: remove dev_priv->pc8.requirements_met Paulo Zanoni
2013-12-19 13:54 ` [PATCH 08/19] drm/i915: make gpu_idle be part of runtime PM, not PC8 Paulo Zanoni
2013-12-19 13:54 ` [PATCH 09/19] drm/i915: kill pc8.disable_count Paulo Zanoni
2013-12-19 13:55 ` [PATCH 10/19] drm/i915: remove an indirection level on PC8 functions Paulo Zanoni
2013-12-19 13:55 ` [PATCH 11/19] drm/i915: don't get/put PC8 reference on freeze/thaw Paulo Zanoni
2013-12-19 13:55 ` [PATCH 12/19] drm/i915: get/put runtime PM references for GMBUS and DP AUX Paulo Zanoni
2013-12-19 13:55 ` [PATCH 13/19] drm/i915: don't get/put PC8 when getting/putting power wells Paulo Zanoni
2013-12-19 13:55 ` [PATCH 14/19] drm/i915: remove dev_priv->pc8.enabled Paulo Zanoni
2013-12-19 13:55 ` [PATCH 15/19] drm/i915: move pc8.irqs_disabled to pm.irqs_disabled Paulo Zanoni
2013-12-19 13:55 ` [PATCH 16/19] drm/i915: kill struct i915_package_c8 Paulo Zanoni
2013-12-19 13:55 ` [PATCH 17/19] drm/i915: rename __hsw_do_{en, dis}able_pc8 Paulo Zanoni
2013-12-19 13:55 ` [PATCH 18/19] drm/i915: update the PC8 and runtime PM documentation Paulo Zanoni
2013-12-19 13:55 ` [PATCH 19/19] drm/i915: init pm.suspended earlier Paulo Zanoni

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=1387461309-2756-3-git-send-email-przanoni@gmail.com \
    --to=przanoni@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.