Skip to content

Commit abd3182

Browse files
committed
i915/guc: Reset engine utilization buffer before registration
On GT reset, we store total busyness counts for all engines and re-register the utilization buffer with GuC. At that time we should reset the buffer, so that we don't get spurious busyness counts on subsequent queries. To repro this issue, run igt@perf_pmu@busy-hang followed by igt@perf_pmu@most-busy-idle-check-all for a couple iterations. 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 630e038 commit abd3182

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,6 +1243,21 @@ static void __get_engine_usage_record(struct intel_engine_cs *engine,
12431243
} while (++i < 6);
12441244
}
12451245

1246+
static void __set_engine_usage_record(struct intel_engine_cs *engine,
1247+
u32 last_in, u32 id, u32 total)
1248+
{
1249+
struct iosys_map rec_map = intel_guc_engine_usage_record_map(engine);
1250+
1251+
#define record_write(map_, field_, val_) \
1252+
iosys_map_wr_field(map_, 0, struct guc_engine_usage_record, field_, val_)
1253+
1254+
record_write(&rec_map, last_switch_in_stamp, last_in);
1255+
record_write(&rec_map, current_context_index, id);
1256+
record_write(&rec_map, total_runtime, total);
1257+
1258+
#undef record_write
1259+
}
1260+
12461261
static void guc_update_engine_gt_clks(struct intel_engine_cs *engine)
12471262
{
12481263
struct intel_engine_guc_stats *stats = &engine->stats.guc;
@@ -1543,13 +1558,19 @@ static void guc_timestamp_ping(struct work_struct *wrk)
15431558

15441559
static int guc_action_enable_usage_stats(struct intel_guc *guc)
15451560
{
1561+
struct intel_gt *gt = guc_to_gt(guc);
1562+
struct intel_engine_cs *engine;
1563+
enum intel_engine_id id;
15461564
u32 offset = intel_guc_engine_usage_offset(guc);
15471565
u32 action[] = {
15481566
INTEL_GUC_ACTION_SET_ENG_UTIL_BUFF,
15491567
offset,
15501568
0,
15511569
};
15521570

1571+
for_each_engine(engine, gt, id)
1572+
__set_engine_usage_record(engine, 0, 0xffffffff, 0);
1573+
15531574
return intel_guc_send(guc, action, ARRAY_SIZE(action));
15541575
}
15551576

0 commit comments

Comments
 (0)