All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tursulin@ursulin.net>
To: Intel-gfx@lists.freedesktop.org
Subject: [PATCH v3] drm/i915/pmu: Clear the previous sample value when parking
Date: Thu, 23 Nov 2017 09:27:40 +0000	[thread overview]
Message-ID: <20171123092740.4750-1-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20171123085435.20352-1-chris@chris-wilson.co.uk>

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.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_pmu.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
index f1e932a3fb85..1a52a3d0e5a9 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 clear_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 = 0;
+}
+
 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)) {
+		clear_previous_samples(i915);
+
 		return HRTIMER_NORESTART;
+	}
 
 	engines_sample(i915);
 	frequency_sample(i915);
-- 
2.14.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-11-23  9: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   ` Tvrtko Ursulin [this message]
2017-11-23  9:37     ` [PATCH v3] " Chris Wilson
2017-11-23 10:17       ` Sagar Arun Kamble
2017-11-23 10:26       ` [PATCH v4] " Tvrtko Ursulin
2017-11-23 12:06         ` 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=20171123092740.4750-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.