From: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
To: intel-gfx@lists.freedesktop.org, john.c.harrison@intel.com
Subject: [PATCH 1/3] i915/guc: Reset engine utilization buffer before registration
Date: Wed, 27 Nov 2024 09:40:04 -0800 [thread overview]
Message-ID: <20241127174006.190128-2-umesh.nerlige.ramappa@intel.com> (raw)
In-Reply-To: <20241127174006.190128-1-umesh.nerlige.ramappa@intel.com>
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: 77cdd054dd2c ("drm/i915/pmu: Connect engine busyness stats from GuC to pmu")
Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Reviewed-by: John Harrison <John.C.Harrison@Intel.com>
---
.../gpu/drm/i915/gt/uc/intel_guc_submission.c | 21 +++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
index 353a9167c9a4..c71aedcbce43 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
@@ -1243,6 +1243,21 @@ static void __get_engine_usage_record(struct intel_engine_cs *engine,
} while (++i < 6);
}
+static void __set_engine_usage_record(struct intel_engine_cs *engine,
+ u32 last_in, u32 id, u32 total)
+{
+ struct iosys_map rec_map = intel_guc_engine_usage_record_map(engine);
+
+#define record_write(map_, field_, val_) \
+ iosys_map_wr_field(map_, 0, struct guc_engine_usage_record, field_, val_)
+
+ record_write(&rec_map, last_switch_in_stamp, last_in);
+ record_write(&rec_map, current_context_index, id);
+ record_write(&rec_map, total_runtime, total);
+
+#undef record_write
+}
+
static void guc_update_engine_gt_clks(struct intel_engine_cs *engine)
{
struct intel_engine_guc_stats *stats = &engine->stats.guc;
@@ -1543,6 +1558,9 @@ static void guc_timestamp_ping(struct work_struct *wrk)
static int guc_action_enable_usage_stats(struct intel_guc *guc)
{
+ struct intel_gt *gt = guc_to_gt(guc);
+ struct intel_engine_cs *engine;
+ enum intel_engine_id id;
u32 offset = intel_guc_engine_usage_offset(guc);
u32 action[] = {
INTEL_GUC_ACTION_SET_ENG_UTIL_BUFF,
@@ -1550,6 +1568,9 @@ static int guc_action_enable_usage_stats(struct intel_guc *guc)
0,
};
+ for_each_engine(engine, gt, id)
+ __set_engine_usage_record(engine, 0, 0xffffffff, 0);
+
return intel_guc_send(guc, action, ARRAY_SIZE(action));
}
--
2.34.1
next prev parent reply other threads:[~2024-11-27 17:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-27 17:40 [PATCH 0/3] Fix some races/bugs in GuC engine busyness Umesh Nerlige Ramappa
2024-11-27 17:40 ` Umesh Nerlige Ramappa [this message]
2024-11-27 17:40 ` [PATCH 2/3] i915/guc: Ensure busyness counter increases motonically Umesh Nerlige Ramappa
2024-11-27 17:40 ` [PATCH 3/3] i915/guc: Accumulate active runtime on gt reset Umesh Nerlige Ramappa
2024-12-05 22:11 ` John Harrison
2024-11-27 18:42 ` ✗ Fi.CI.SPARSE: warning for Fix some races/bugs in GuC engine busyness (rev4) Patchwork
2024-11-27 18:57 ` ✓ i915.CI.BAT: success " Patchwork
2024-11-27 20:36 ` ✗ i915.CI.Full: failure " Patchwork
2024-12-13 6:28 ` Umesh Nerlige Ramappa
2024-12-14 0:16 ` [PATCH 0/3] Fix some races/bugs in GuC engine busyness Umesh Nerlige Ramappa
-- strict thread matches above, loose matches on Subject: below --
2024-11-18 23:22 Umesh Nerlige Ramappa
2024-11-18 23:22 ` [PATCH 1/3] i915/guc: Reset engine utilization buffer before registration Umesh Nerlige Ramappa
2024-11-22 0:29 ` John Harrison
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241127174006.190128-2-umesh.nerlige.ramappa@intel.com \
--to=umesh.nerlige.ramappa@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=john.c.harrison@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox