[Intel-gfx] [PATCH] drm/i915: add turbo boost trace point

Jesse Barnes jbarnes at virtuousgeek.org
Tue Nov 18 22:12:29 CET 2014


Might be helpful for debugging places where userspace ends up boosting
or waiting where it doesn't intend to.

Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>
---
 drivers/gpu/drm/i915/i915_gem.c   |  6 ++++--
 drivers/gpu/drm/i915/i915_trace.h | 15 +++++++++++++++
 drivers/gpu/drm/i915/intel_pm.c   |  9 +++++++--
 3 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 86cf428..b03cb07 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4209,8 +4209,10 @@ i915_gem_object_ggtt_unpin(struct drm_i915_gem_object *obj)
 	struct i915_vma *vma = i915_gem_obj_to_ggtt(obj);
 
 	BUG_ON(!vma);
-	BUG_ON(vma->pin_count == 0);
-	BUG_ON(!i915_gem_obj_ggtt_bound(obj));
+	if (WARN(vma->pin_count == 0, "bad pin count\n"))
+		return;
+	if (WARN(!i915_gem_obj_ggtt_bound(obj), "obj not bound\n"))
+		return;
 
 	if (--vma->pin_count == 0)
 		obj->pin_mappable = false;
diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h
index 751d4ad..d710fe1 100644
--- a/drivers/gpu/drm/i915/i915_trace.h
+++ b/drivers/gpu/drm/i915/i915_trace.h
@@ -691,6 +691,21 @@ TRACE_EVENT(switch_mm,
 		  __entry->dev, __entry->ring, __entry->to, __entry->vm)
 );
 
+TRACE_EVENT(turbo_boost,
+	    TP_PROTO(u32 freq),
+	    TP_ARGS(freq),
+
+	    TP_STRUCT__entry(
+		    __field(u32, freq)
+		    ),
+
+	    TP_fast_assign(
+		    __entry->freq = freq;
+		    ),
+
+	    TP_printk("turbo boost to %d MHz", __entry->freq)
+);
+
 #endif /* _I915_TRACE_H_ */
 
 /* This part must be outside protection */
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 7558ba2..2944593 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -4483,10 +4483,15 @@ void gen6_rps_boost(struct drm_i915_private *dev_priv)
 
 	mutex_lock(&dev_priv->rps.hw_lock);
 	if (dev_priv->rps.enabled) {
-		if (IS_VALLEYVIEW(dev))
+		if (IS_VALLEYVIEW(dev)) {
 			valleyview_set_rps(dev_priv->dev, dev_priv->rps.max_freq_softlimit);
-		else
+			trace_turbo_boost(vlv_gpu_freq(dev_priv,
+						       dev_priv->rps.max_freq_softlimit));
+		} else {
 			gen6_set_rps(dev_priv->dev, dev_priv->rps.max_freq_softlimit);
+			trace_turbo_boost(dev_priv->rps.max_freq_softlimit * 50);
+		}
+
 		dev_priv->rps.last_adj = 0;
 	}
 	mutex_unlock(&dev_priv->rps.hw_lock);
-- 
1.9.1




More information about the Intel-gfx mailing list