Skip to contentSkip to conversation

drm/i915: fix locking around punit access in cur_delayinfo for VLV

PATCH In review Jesse Barnes 2 participants 3 messages Apr 22, 2013 – Apr 23, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: fix locking around punit access in cur_delayinfo for VLV

We need to hold the rps lock around punit access.

---
 drivers/gpu/drm/i915/i915_debugfs.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +2 -0
index 367b534..d195d09 100644
@@ -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");
 	}
Signature · 1 line
1.7.10.4
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 1 line · Jesse Barnes

We need to hold the rps lock around punit access.

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.

Quoted 33 lines
---
 drivers/gpu/drm/i915/i915_debugfs.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +2 -0
index 367b534..d195d09 100644
@@ -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");
 	}
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
Quoted 9 lines · On Tue, 23 Apr 2013 10:51:28 +0300 Jani Nikula <[email protected]>…
Quoted 1 line · Jesse Barnes

We need to hold the rps lock around punit access.

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.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center