From: Tvrtko Ursulin <tursulin@ursulin.net>
To: Intel-gfx@lists.freedesktop.org
Subject: [PATCH v4] drm/i915/pmu: Clear the previous sample value when parking
Date: Thu, 23 Nov 2017 10:26:54 +0000 [thread overview]
Message-ID: <20171123102654.29296-1-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <151142984945.29492.2814319999875099742@mail.alporthouse.com>
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
When turning off the engines, and the pmu sampling, clear the previous
value as the current measurement should be 0.
v2: Use a for-loop
v3:
* Move clearing to timer self-dis-arm to avoid race with parking.
* Clear frequency samples as well.
v4:
* Init frequency to idle_freq. (Chris Wilson)
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> (v3)
---
drivers/gpu/drm/i915/i915_pmu.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
index f1e932a3fb85..2906d2c7e395 100644
--- a/drivers/gpu/drm/i915/i915_pmu.c
+++ b/drivers/gpu/drm/i915/i915_pmu.c
@@ -262,13 +262,31 @@ static void frequency_sample(struct drm_i915_private *dev_priv)
}
}
+static void pmu_init_previous_samples(struct drm_i915_private *i915)
+{
+ struct intel_engine_cs *engine;
+ enum intel_engine_id id;
+ unsigned int i;
+
+ for_each_engine(engine, i915, id) {
+ for (i = 0; i < ARRAY_SIZE(engine->pmu.sample); i++)
+ engine->pmu.sample[i].prev = 0;
+ }
+
+ for (i = 0; i < ARRAY_SIZE(i915->pmu.sample); i++)
+ i915->pmu.sample[i].prev = i915->gt_pm.rps.idle_freq;
+}
+
static enum hrtimer_restart i915_sample(struct hrtimer *hrtimer)
{
struct drm_i915_private *i915 =
container_of(hrtimer, struct drm_i915_private, pmu.timer);
- if (!READ_ONCE(i915->pmu.timer_enabled))
+ if (!READ_ONCE(i915->pmu.timer_enabled)) {
+ pmu_init_previous_samples(i915);
+
return HRTIMER_NORESTART;
+ }
engines_sample(i915);
frequency_sample(i915);
@@ -834,6 +852,8 @@ void i915_pmu_register(struct drm_i915_private *i915)
hrtimer_init(&i915->pmu.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
i915->pmu.timer.function = i915_sample;
+ pmu_init_previous_samples(i915);
+
for_each_engine(engine, i915, id)
INIT_DELAYED_WORK(&engine->pmu.disable_busy_stats,
__disable_busy_stats);
--
2.14.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-11-23 10:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-23 0:06 [PATCH] drm/i915/pmu: Clear the previous sample value when parking Chris Wilson
2017-11-23 0:25 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-11-23 1:03 ` ✓ Fi.CI.IGT: " Patchwork
2017-11-23 6:56 ` [PATCH] " Tvrtko Ursulin
2017-11-23 7:15 ` Chris Wilson
2017-11-23 8:54 ` [PATCH v2] " Chris Wilson
2017-11-23 9:27 ` [PATCH v3] " Tvrtko Ursulin
2017-11-23 9:37 ` Chris Wilson
2017-11-23 10:17 ` Sagar Arun Kamble
2017-11-23 10:26 ` Tvrtko Ursulin [this message]
2017-11-23 12:06 ` [PATCH v4] " Chris Wilson
2017-11-23 10:22 ` ✓ Fi.CI.BAT: success for drm/i915/pmu: Clear the previous sample value when parking (rev3) Patchwork
2017-11-23 12:36 ` Tvrtko Ursulin
2017-11-23 11:20 ` ✓ Fi.CI.BAT: success for drm/i915/pmu: Clear the previous sample value when parking (rev4) Patchwork
2017-11-23 14:06 ` ✗ Fi.CI.IGT: warning " 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=20171123102654.29296-1-tvrtko.ursulin@linux.intel.com \
--to=tursulin@ursulin.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.