All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: fix locking around punit access in cur_delayinfo for VLV
@ 2013-04-22 22:59 Jesse Barnes
  2013-04-23  7:51 ` Jani Nikula
  0 siblings, 1 reply; 3+ messages in thread
From: Jesse Barnes @ 2013-04-22 22:59 UTC (permalink / raw)
  To: intel-gfx

We need to hold the rps lock around punit access.

Reported-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/i915_debugfs.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 367b534..d195d09 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1012,6 +1012,7 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
 	} else if (IS_VALLEYVIEW(dev)) {
 		u32 freq_sts, val;
 
+		mutex_lock(&dev_priv->rps.hw_lock);
 		valleyview_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS,
 				      &freq_sts);
 		seq_printf(m, "PUNIT_REG_GPU_FREQ_STS: 0x%08x\n", freq_sts);
@@ -1028,6 +1029,7 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
 		seq_printf(m, "current GPU freq: %d MHz\n",
 			   vlv_gpu_freq(dev_priv->mem_freq,
 					(freq_sts >> 8) & 0xff));
+		mutex_unlock(&dev_priv->rps.hw_lock);
 	} else {
 		seq_printf(m, "no P-state info available\n");
 	}
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/i915: fix locking around punit access in cur_delayinfo for VLV
  2013-04-22 22:59 [PATCH] drm/i915: fix locking around punit access in cur_delayinfo for VLV Jesse Barnes
@ 2013-04-23  7:51 ` Jani Nikula
  2013-04-23 16:39   ` Jesse Barnes
  0 siblings, 1 reply; 3+ messages in thread
From: Jani Nikula @ 2013-04-23  7:51 UTC (permalink / raw)
  To: Jesse Barnes, intel-gfx

On Tue, 23 Apr 2013, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:
> We need to hold the rps lock around punit access.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

And a semi-related question while at it... we will need punit access
also for non-rps stuff. Shall we just bundle them under the semantically
wrong rps lock? It would also feel a bit awkward to add another level of
locking for punit when we already have a "hw_lock" in rps.

BR,
Jani.

> Reported-by: Kenneth Graunke <kenneth@whitecape.org>
> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c |    2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 367b534..d195d09 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -1012,6 +1012,7 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
>  	} else if (IS_VALLEYVIEW(dev)) {
>  		u32 freq_sts, val;
>  
> +		mutex_lock(&dev_priv->rps.hw_lock);
>  		valleyview_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS,
>  				      &freq_sts);
>  		seq_printf(m, "PUNIT_REG_GPU_FREQ_STS: 0x%08x\n", freq_sts);
> @@ -1028,6 +1029,7 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
>  		seq_printf(m, "current GPU freq: %d MHz\n",
>  			   vlv_gpu_freq(dev_priv->mem_freq,
>  					(freq_sts >> 8) & 0xff));
> +		mutex_unlock(&dev_priv->rps.hw_lock);
>  	} else {
>  		seq_printf(m, "no P-state info available\n");
>  	}
> -- 
> 1.7.10.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/i915: fix locking around punit access in cur_delayinfo for VLV
  2013-04-23  7:51 ` Jani Nikula
@ 2013-04-23 16:39   ` Jesse Barnes
  0 siblings, 0 replies; 3+ messages in thread
From: Jesse Barnes @ 2013-04-23 16:39 UTC (permalink / raw)
  To: Jani Nikula; +Cc: intel-gfx

On Tue, 23 Apr 2013 10:51:28 +0300
Jani Nikula <jani.nikula@linux.intel.com> wrote:

> On Tue, 23 Apr 2013, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:
> > We need to hold the rps lock around punit access.
> 
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> 
> And a semi-related question while at it... we will need punit access
> also for non-rps stuff. Shall we just bundle them under the semantically
> wrong rps lock? It would also feel a bit awkward to add another level of
> locking for punit when we already have a "hw_lock" in rps.

Unless the new users will need to take the lock in a blocking way
(thus potentially impacting freq changes for a long time), I'd say we
just keep abusing the rps hw_lock.

-- 
Jesse Barnes, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-23 16:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-22 22:59 [PATCH] drm/i915: fix locking around punit access in cur_delayinfo for VLV Jesse Barnes
2013-04-23  7:51 ` Jani Nikula
2013-04-23 16:39   ` Jesse Barnes

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.