Skip to content

Commit 555a322

Browse files
committed
drm/i915/gt: Trace RPS events
Add tracek to the RPS events (interrupts, worker, enabling, threshold selection, frequency setting), so that if we have to debug reticent HW we have some traces to start from. Signed-off-by: Chris Wilson <[email protected]> Reviewed-by: Andi Shyti <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 1ebf7aa commit 555a322

File tree

1 file changed

+44
-4
lines changed

1 file changed

+44
-4
lines changed

drivers/gpu/drm/i915/gt/intel_rps.c

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ static void rps_enable_interrupts(struct intel_rps *rps)
7171
{
7272
struct intel_gt *gt = rps_to_gt(rps);
7373

74+
GT_TRACE(gt, "interrupts:on rps->pm_events: %x, rps_pm_mask:%x\n",
75+
rps->pm_events, rps_pm_mask(rps, rps->last_freq));
76+
7477
rps_reset_ei(rps);
7578

7679
spin_lock_irq(&gt->irq_lock);
@@ -128,6 +131,7 @@ static void rps_disable_interrupts(struct intel_rps *rps)
128131
cancel_work_sync(&rps->work);
129132

130133
rps_reset_interrupts(rps);
134+
GT_TRACE(gt, "interrupts:off\n");
131135
}
132136

133137
static const struct cparams {
@@ -569,6 +573,10 @@ static void rps_set_power(struct intel_rps *rps, int new_power)
569573
if (IS_VALLEYVIEW(i915))
570574
goto skip_hw_write;
571575

576+
GT_TRACE(rps_to_gt(rps),
577+
"changing power mode [%d], up %d%% @ %dus, down %d%% @ %dus\n",
578+
new_power, threshold_up, ei_up, threshold_down, ei_down);
579+
572580
set(uncore, GEN6_RP_UP_EI, GT_INTERVAL_FROM_US(i915, ei_up));
573581
set(uncore, GEN6_RP_UP_THRESHOLD,
574582
GT_INTERVAL_FROM_US(i915, ei_up * threshold_up / 100));
@@ -633,6 +641,8 @@ static void gen6_rps_set_thresholds(struct intel_rps *rps, u8 val)
633641

634642
void intel_rps_mark_interactive(struct intel_rps *rps, bool interactive)
635643
{
644+
GT_TRACE(rps_to_gt(rps), "mark interactive: %s\n", yesno(interactive));
645+
636646
mutex_lock(&rps->power.mutex);
637647
if (interactive) {
638648
if (!rps->power.interactive++ && READ_ONCE(rps->active))
@@ -660,6 +670,9 @@ static int gen6_rps_set(struct intel_rps *rps, u8 val)
660670
GEN6_AGGRESSIVE_TURBO);
661671
set(uncore, GEN6_RPNSWREQ, swreq);
662672

673+
GT_TRACE(rps_to_gt(rps), "set val:%x, freq:%d, swreq:%x\n",
674+
val, intel_gpu_freq(rps, val), swreq);
675+
663676
return 0;
664677
}
665678

@@ -672,6 +685,9 @@ static int vlv_rps_set(struct intel_rps *rps, u8 val)
672685
err = vlv_punit_write(i915, PUNIT_REG_GPU_FREQ_REQ, val);
673686
vlv_punit_put(i915);
674687

688+
GT_TRACE(rps_to_gt(rps), "set val:%x, freq:%d\n",
689+
val, intel_gpu_freq(rps, val));
690+
675691
return err;
676692
}
677693

@@ -705,6 +721,8 @@ void intel_rps_unpark(struct intel_rps *rps)
705721
if (!rps->enabled)
706722
return;
707723

724+
GT_TRACE(rps_to_gt(rps), "unpark:%x\n", rps->cur_freq);
725+
708726
/*
709727
* Use the user's desired frequency as a guide, but for better
710728
* performance, jump directly to RPe as our starting frequency.
@@ -772,6 +790,8 @@ void intel_rps_park(struct intel_rps *rps)
772790
*/
773791
rps->cur_freq =
774792
max_t(int, round_down(rps->cur_freq - 1, 2), rps->min_freq);
793+
794+
GT_TRACE(rps_to_gt(rps), "park:%x\n", rps->cur_freq);
775795
}
776796

777797
void intel_rps_boost(struct i915_request *rq)
@@ -788,6 +808,9 @@ void intel_rps_boost(struct i915_request *rq)
788808
!dma_fence_is_signaled_locked(&rq->fence)) {
789809
set_bit(I915_FENCE_FLAG_BOOST, &rq->fence.flags);
790810

811+
GT_TRACE(rps_to_gt(rps), "boost fence:%llx:%llx\n",
812+
rq->fence.context, rq->fence.seqno);
813+
791814
if (!atomic_fetch_inc(&rps->num_waiters) &&
792815
READ_ONCE(rps->cur_freq) < rps->boost_freq)
793816
schedule_work(&rps->work);
@@ -883,6 +906,7 @@ static void gen6_rps_init(struct intel_rps *rps)
883906
static bool rps_reset(struct intel_rps *rps)
884907
{
885908
struct drm_i915_private *i915 = rps_to_i915(rps);
909+
886910
/* force a reset */
887911
rps->power.mode = -1;
888912
rps->last_freq = -1;
@@ -1210,11 +1234,17 @@ void intel_rps_enable(struct intel_rps *rps)
12101234
if (!rps->enabled)
12111235
return;
12121236

1213-
drm_WARN_ON(&i915->drm, rps->max_freq < rps->min_freq);
1214-
drm_WARN_ON(&i915->drm, rps->idle_freq > rps->max_freq);
1237+
GT_TRACE(rps_to_gt(rps),
1238+
"min:%x, max:%x, freq:[%d, %d]\n",
1239+
rps->min_freq, rps->max_freq,
1240+
intel_gpu_freq(rps, rps->min_freq),
1241+
intel_gpu_freq(rps, rps->max_freq));
12151242

1216-
drm_WARN_ON(&i915->drm, rps->efficient_freq < rps->min_freq);
1217-
drm_WARN_ON(&i915->drm, rps->efficient_freq > rps->max_freq);
1243+
GEM_BUG_ON(rps->max_freq < rps->min_freq);
1244+
GEM_BUG_ON(rps->idle_freq > rps->max_freq);
1245+
1246+
GEM_BUG_ON(rps->efficient_freq < rps->min_freq);
1247+
GEM_BUG_ON(rps->efficient_freq > rps->max_freq);
12181248
}
12191249

12201250
static void gen6_rps_disable(struct intel_rps *rps)
@@ -1482,6 +1512,12 @@ static void rps_work(struct work_struct *work)
14821512
max = rps->max_freq_softlimit;
14831513
if (client_boost)
14841514
max = rps->max_freq;
1515+
1516+
GT_TRACE(gt,
1517+
"pm_iir:%x, client_boost:%s, last:%d, cur:%x, min:%x, max:%x\n",
1518+
pm_iir, yesno(client_boost),
1519+
adj, new_freq, min, max);
1520+
14851521
if (client_boost && new_freq < rps->boost_freq) {
14861522
new_freq = rps->boost_freq;
14871523
adj = 0;
@@ -1556,6 +1592,8 @@ void gen11_rps_irq_handler(struct intel_rps *rps, u32 pm_iir)
15561592
if (unlikely(!events))
15571593
return;
15581594

1595+
GT_TRACE(gt, "irq events:%x\n", events);
1596+
15591597
gen6_gt_pm_mask_irq(gt, events);
15601598

15611599
rps->pm_iir |= events;
@@ -1571,6 +1609,8 @@ void gen6_rps_irq_handler(struct intel_rps *rps, u32 pm_iir)
15711609
if (events) {
15721610
spin_lock(&gt->irq_lock);
15731611

1612+
GT_TRACE(gt, "irq events:%x\n", events);
1613+
15741614
gen6_gt_pm_mask_irq(gt, events);
15751615
rps->pm_iir |= events;
15761616

0 commit comments

Comments
 (0)