Skip to contentSkip to conversation

drm/i915: add turbo boost trace point

PATCH In review Jesse Barnes 5 participants 9 messages Nov 18, 2014 – Nov 19, 2014

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

PATCH 1/1 drm/i915: add turbo boost trace point

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

---
 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(-)
drivers/gpu/drm/i915/i915_gem.c +4 -2
index 86cf428..b03cb07 100644
@@ -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;
drivers/gpu/drm/i915/i915_trace.h +15 -0
index 751d4ad..d710fe1 100644
@@ -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 */
drivers/gpu/drm/i915/intel_pm.c +7 -2
index 7558ba2..2944593 100644
@@ -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);
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tested-by on v1 1/1
#1 lore raw

-------------------------------------Summary-------------------------------------
Platform: baseline_drm_intel_nightly_pass_rate->patch_applied_pass_rate
BYT: pass/total=290/290->290/290
PNV: pass/total=362/362->362/362
ILK: pass/total=381/381->379/381
IVB: pass/total=522/559->522/559
SNB: pass/total=444/444->444/444
HSW: pass/total=595/595->595/595
BDW: pass/total=436/436->436/436
-------------------------------------Detailed-------------------------------------
test_platform: test_suite, test_case, result_with_drm_intel_nightly(count, machine_id...)...->result_with_patch_applied(count, machine_id)...
ILK: Intel_gpu_tools, igt_kms_flip_flip-vs-wf_vblank-interruptible, DMESG_WARN(2, M26)PASS(2, M37M26) -> DMESG_WARN(1, M26)PASS(3, M26)
ILK: Intel_gpu_tools, igt_kms_flip_single-buffer-flip-vs-dpms-off-vs-modeset, DMESG_WARN(1, M26)PASS(3, M37M26) -> DMESG_WARN(1, M26)PASS(3, M26)
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
Quoted 14 lines · On 18 Nov 2014 19:15:18 -0800 [email protected] wrote:

-------------------------------------Summary-------------------------------------
Platform: baseline_drm_intel_nightly_pass_rate->patch_applied_pass_rate
BYT: pass/total=290/290->290/290
PNV: pass/total=362/362->362/362
ILK: pass/total=381/381->379/381
IVB: pass/total=522/559->522/559
SNB: pass/total=444/444->444/444
HSW: pass/total=595/595->595/595
BDW: pass/total=436/436->436/436
-------------------------------------Detailed-------------------------------------
test_platform: test_suite, test_case, result_with_drm_intel_nightly(count, machine_id...)...->result_with_patch_applied(count, machine_id)...
ILK: Intel_gpu_tools, igt_kms_flip_flip-vs-wf_vblank-interruptible, DMESG_WARN(2, M26)PASS(2, M37M26) -> DMESG_WARN(1, M26)PASS(3, M26)
ILK: Intel_gpu_tools, igt_kms_flip_single-buffer-flip-vs-dpms-off-vs-modeset, DMESG_WARN(1, M26)PASS(3, M37M26) -> DMESG_WARN(1, M26)PASS(3, M26)

Looks like these two tests are flakey; this patch shouldn't affect those cases. Do we have bugs open for these subtests already?

Thanks,

Signature · 5 lines
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
In reply to Jesse Barnes
Quoted 2 lines · Jesse Barnes

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

Might be feels a bit weak justification for a new tracepoint imo. Please drum up more support.

Quoted 12 lines
---
 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(-)
drivers/gpu/drm/i915/i915_gem.c +0 -0
index 86cf428..b03cb07 100644

drivers/gpu/drm/i915/i915_gem.c i915_gem_object_ggtt_unpin(struct drm_i915_gem_object *obj) · line 4215

Quoted 9 lines
drivers/gpu/drm/i915/i915_gem.c +4 -2
@@ -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;

Separate patch. Can you please split it out with the usual "BUG_ON considered harmful" commit message?

Thanks, Daniel

Quoted 58 lines
drivers/gpu/drm/i915/i915_gem.c +0 -0
 	if (--vma->pin_count == 0)
 		obj->pin_mappable = false;
drivers/gpu/drm/i915/i915_trace.h +15 -0
index 751d4ad..d710fe1 100644
@@ -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 */
drivers/gpu/drm/i915/intel_pm.c +7 -2
index 7558ba2..2944593 100644
@@ -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);
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
Quoted 21 lines · Daniel Vetter
Quoted 2 lines · Jesse Barnes

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

Might be feels a bit weak justification for a new tracepoint imo. Please drum up more support.

Quoted 14 lines
---
 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(-)
drivers/gpu/drm/i915/i915_gem.c +0 -0
index 86cf428..b03cb07 100644
@@ -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);
 
Quoted 10 lines

drivers/gpu/drm/i915/i915_gem.c i915_gem_object_ggtt_unpin(struct drm_i915_gem_object *obj) · line 4215

Quoted 7 lines
drivers/gpu/drm/i915/i915_gem.c +4 -2
 	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;

Separate patch. Can you please split it out with the usual "BUG_ON considered harmful" commit message?

I have argued that these represent extreme fail on the part of the programmer - you have left the hardware accessing random physical pages in the system, game over.

I need a stronger argument than that because presumably Jesse did end up fixing whatever he did actually blow up.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw
In reply to Daniel Vetter
Quoted 6 lines · On Wed, 19 Nov 2014 15:00:04 +0100 Daniel Vetter <[email protected]> wrote:
Quoted 2 lines · Jesse Barnes

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

Might be feels a bit weak justification for a new tracepoint imo. Please drum up more support.

I put it together for some media playback debugging we're doing on Chrome, where I suspect we're boosting when we don't want to (possibly due to userspace waits).

Quoted 15 lines
Quoted 15 lines
---
 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(-)
drivers/gpu/drm/i915/i915_gem.c +0 -0
index 86cf428..b03cb07 100644
@@ -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);
 
Quoted 10 lines

drivers/gpu/drm/i915/i915_gem.c i915_gem_object_ggtt_unpin(struct drm_i915_gem_object *obj) · line 4215

Quoted 7 lines
drivers/gpu/drm/i915/i915_gem.c +4 -2
 	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;

Separate patch. Can you please split it out with the usual "BUG_ON considered harmful" commit message?

Oops forgot about that hunk. Yeah I was debugging a mode setting failure and ran into this BUG, which made things a little tougher when I only had one machine... But this hunk can be ignored.

Signature · 5 lines
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw
Quoted 7 lines · Jesse Barnes
Quoted 4 lines · On Wed, 19 Nov 2014 15:00:04 +0100 Daniel Vetter <[email protected]> wrote:
Quoted 2 lines · Jesse Barnes

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

Quoted 6 lines
Quoted 2 lines

Might be feels a bit weak justification for a new tracepoint imo. Please drum up more support.

I put it together for some media playback debugging we're doing on Chrome, where I suspect we're boosting when we don't want to (possibly due to userspace waits).

Hm, I've discussed this exact topic many moons ago with vpg folks and they've said that the boosting done for media workloads on the idle->busy transition annoys them. Iirc the plan we've hashed out was to add an execbuf flag to prevent the execbuf boosting.

We've also discussed the wait boosting but that's imo just a bug in libva ;-) And for debugging pointless waits we already have good tracepoints imo.

Unfortunately nothing ever came out of that discussion :( -Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw
Quoted 15 lines · On Wed, 19 Nov 2014 17:19:23 +0100 Daniel Vetter <[email protected]> wrote:
Quoted 7 lines · Jesse Barnes
Quoted 4 lines · On Wed, 19 Nov 2014 15:00:04 +0100 Daniel Vetter <[email protected]> wrote:
Quoted 2 lines · Jesse Barnes

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

Quoted 6 lines
Quoted 2 lines

Might be feels a bit weak justification for a new tracepoint imo. Please drum up more support.

I put it together for some media playback debugging we're doing on Chrome, where I suspect we're boosting when we don't want to (possibly due to userspace waits).

Quoted 8 lines

Hm, I've discussed this exact topic many moons ago with vpg folks and they've said that the boosting done for media workloads on the idle->busy transition annoys them. Iirc the plan we've hashed out was to add an execbuf flag to prevent the execbuf boosting.

We've also discussed the wait boosting but that's imo just a bug in libva ;-) And for debugging pointless waits we already have good tracepoints imo.

We have tracing for waits, but my expectation was that we may end up growing or adding new boost points elsewhere, so having an explicit trace would make sense anyway.

But we've already typed many more lines about this than the patch itself contains, so feel free to drop/ignore. It's easy enough to add on an ad-hoc basis.

Signature · 5 lines
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw
Quoted 27 lines · Jesse Barnes
Quoted 15 lines · On Wed, 19 Nov 2014 17:19:23 +0100 Daniel Vetter <[email protected]> wrote:
Quoted 7 lines · Jesse Barnes
Quoted 4 lines · On Wed, 19 Nov 2014 15:00:04 +0100 Daniel Vetter <[email protected]> wrote:
Quoted 2 lines · Jesse Barnes

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

Quoted 6 lines
Quoted 2 lines

Might be feels a bit weak justification for a new tracepoint imo. Please drum up more support.

I put it together for some media playback debugging we're doing on Chrome, where I suspect we're boosting when we don't want to (possibly due to userspace waits).

Quoted 8 lines

Hm, I've discussed this exact topic many moons ago with vpg folks and they've said that the boosting done for media workloads on the idle->busy transition annoys them. Iirc the plan we've hashed out was to add an execbuf flag to prevent the execbuf boosting.

We've also discussed the wait boosting but that's imo just a bug in libva ;-) And for debugging pointless waits we already have good tracepoints imo.

Quoted 7 lines

We have tracing for waits, but my expectation was that we may end up growing or adding new boost points elsewhere, so having an explicit trace would make sense anyway.

But we've already typed many more lines about this than the patch itself contains, so feel free to drop/ignore. It's easy enough to add on an ad-hoc basis.

Or just use the function tracer. And combine with the already existing rps event in case you want the freq too.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx