Skip to content

Commit 7ed047d

Browse files
committed
i915/guc: Accumulate active runtime on gt reset
On gt reset, if a context is running, then accumulate it's active time into the busyness counter since there will be no chance for the context to switch out and update it's run time. v2: Move comment right above the if (John) Fixes: 77cdd05 ("drm/i915/pmu: Connect engine busyness stats from GuC to pmu") Signed-off-by: Umesh Nerlige Ramappa <[email protected]> Reviewed-by: John Harrison <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent cf907f6 commit 7ed047d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1449,8 +1449,21 @@ static void __reset_guc_busyness_stats(struct intel_guc *guc)
14491449

14501450
guc_update_pm_timestamp(guc, &unused);
14511451
for_each_engine(engine, gt, id) {
1452+
struct intel_engine_guc_stats *stats = &engine->stats.guc;
1453+
14521454
guc_update_engine_gt_clks(engine);
1453-
engine->stats.guc.prev_total = 0;
1455+
1456+
/*
1457+
* If resetting a running context, accumulate the active
1458+
* time as well since there will be no context switch.
1459+
*/
1460+
if (stats->running) {
1461+
u64 clk = guc->timestamp.gt_stamp - stats->start_gt_clk;
1462+
1463+
stats->total_gt_clks += clk;
1464+
}
1465+
stats->prev_total = 0;
1466+
stats->running = 0;
14541467
}
14551468

14561469
spin_unlock_irqrestore(&guc->timestamp.lock, flags);

0 commit comments

Comments
 (0)