From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Alan Previn <alan.previn.teres.alexis@intel.com>,
intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [Intel-gfx 1/1] drm/i915/guc: Don't update engine busyness stats too frequently
Date: Mon, 13 Jun 2022 09:10:39 +0100 [thread overview]
Message-ID: <e583609b-8ca6-d064-6afd-6d4eaf907e6c@linux.intel.com> (raw)
In-Reply-To: <20220611172711.2154962-2-alan.previn.teres.alexis@intel.com>
On 11/06/2022 18:27, Alan Previn wrote:
> Using igt's gem-create and with additional patches to track object
> creation time, it was measured that guc_update_engine_gt_clks was
> getting called over 188 thousand times in the span of 15 seconds
> (running the test three times).
>
> Get a jiffies sample on every trigger and ensure we skip sampling
> if we are being called too soon. Use half of the ping_delay as a
> safe threshold.
>
> NOTE: with this change, the number of calls went down to just 14
> over the same span of time (matching the original intent of running
> about once every 24 seconds, at 19.2Mhz GT freq, per engine).
+ Umesh
What is the effect on accuracy? AFAIR up to date clock was needed for
correct accounting of running contexts.
Regards,
Tvrtko
>
> Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
> ---
> drivers/gpu/drm/i915/gt/intel_engine_types.h | 10 ++++++++++
> drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 9 +++++++++
> 2 files changed, 19 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_engine_types.h b/drivers/gpu/drm/i915/gt/intel_engine_types.h
> index 2286f96f5f87..63f4ecdf1606 100644
> --- a/drivers/gpu/drm/i915/gt/intel_engine_types.h
> +++ b/drivers/gpu/drm/i915/gt/intel_engine_types.h
> @@ -323,6 +323,16 @@ struct intel_engine_guc_stats {
> * @start_gt_clk: GT clock time of last idle to active transition.
> */
> u64 start_gt_clk;
> +
> + /**
> + * @last_jiffies: Jiffies at last actual stats collection time
> + *
> + * We use this timestamp to ensure we don't oversample the
> + * stats because runtime power management events can trigger
> + * stats collection at much higher rates than required.
> + */
> + u64 last_jiffies;
> +
> };
>
> struct intel_engine_cs {
> 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 5a1dfacf24ea..8f8bf6e40ccb 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
> @@ -1167,6 +1167,15 @@ static void guc_update_engine_gt_clks(struct intel_engine_cs *engine)
> struct intel_engine_guc_stats *stats = &engine->stats.guc;
> struct intel_guc *guc = &engine->gt->uc.guc;
> u32 last_switch, ctx_id, total;
> + u64 newjiffs;
> +
> + /* Don't worry about jiffies wrap-around, a rare additional sample won't have any impact */
> + newjiffs = get_jiffies_64();
> + if (stats->last_jiffies && (newjiffs - stats->last_jiffies <
> + (guc->timestamp.ping_delay << 1)))
> + return;
> +
> + stats->last_jiffies = newjiffs;
>
> lockdep_assert_held(&guc->timestamp.lock);
>
next prev parent reply other threads:[~2022-06-13 8:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-11 17:27 [Intel-gfx] [Intel-gfx 0/1] drm/i915/guc: Don't update engine busyness stats too frequently Alan Previn
2022-06-11 17:27 ` [Intel-gfx] [Intel-gfx 1/1] " Alan Previn
2022-06-13 8:10 ` Tvrtko Ursulin [this message]
2022-06-14 1:10 ` Umesh Nerlige Ramappa
2022-06-14 7:07 ` Tvrtko Ursulin
2022-06-15 18:59 ` Lucas De Marchi
2022-06-16 16:41 ` Tvrtko Ursulin
2022-06-17 16:38 ` Teres Alexis, Alan Previn
2022-06-17 21:43 ` Teres Alexis, Alan Previn
2022-06-20 8:38 ` Tvrtko Ursulin
2022-06-13 23:12 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/guc: Don't update engine busyness stats too frequently (rev2) Patchwork
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=e583609b-8ca6-d064-6afd-6d4eaf907e6c@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=alan.previn.teres.alexis@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/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