Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 5/7] drm/i915: Use cpu clock to calculate rc0 residency
Date: Tue, 14 Mar 2017 15:17:27 +0200	[thread overview]
Message-ID: <1489497449-31640-5-git-send-email-mika.kuoppala@intel.com> (raw)
In-Reply-To: <1489497449-31640-1-git-send-email-mika.kuoppala@intel.com>

Avoid more costly punit access and use the local cpu clock.
The time diff between separate processor units is irrelevant in
our rc0 residency granularity so we can ignore it.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h |  2 +-
 drivers/gpu/drm/i915/i915_irq.c | 10 ++++------
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 0023e21..70e335c 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1323,7 +1323,7 @@ struct vlv_s0ix_state {
 };
 
 struct intel_rps_ei {
-	u32 cz_clock;
+	u64 cpu_clock;
 	u32 render_c0;
 	u32 media_c0;
 };
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 31f0d7c..00e7875 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1076,7 +1076,7 @@ static void notify_ring(struct intel_engine_cs *engine)
 static void vlv_c0_read(struct drm_i915_private *dev_priv,
 			struct intel_rps_ei *ei)
 {
-	ei->cz_clock = vlv_punit_read(dev_priv, PUNIT_REG_CZ_TIMESTAMP);
+	ei->cpu_clock = local_clock();
 	ei->render_c0 = I915_READ(VLV_RENDER_C0_COUNT);
 	ei->media_c0 = I915_READ(VLV_MEDIA_C0_COUNT);
 }
@@ -1096,19 +1096,17 @@ static u32 vlv_wa_c0_ei(struct drm_i915_private *dev_priv, u32 pm_iir)
 		return 0;
 
 	vlv_c0_read(dev_priv, &now);
-	if (now.cz_clock == 0)
-		return 0;
 
-	if (prev->cz_clock) {
+	if (prev->cpu_clock) {
 		u64 time, c0;
 		u32 render, media;
 		unsigned int mul;
 
-		mul = VLV_CZ_CLOCK_TO_MILLI_SEC * 100; /* scale to threshold% */
+		mul = 1000 * 1000 * 100; /* scale to threshold% */
 		if (I915_READ(VLV_COUNTER_CONTROL) & VLV_COUNT_RANGE_HIGH)
 			mul <<= 8;
 
-		time = now.cz_clock - prev->cz_clock;
+		time = now.cpu_clock - prev->cpu_clock;
 		time *= dev_priv->czclk_freq;
 
 		/* Workload can be split between render + media,
-- 
2.7.4

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

  parent reply	other threads:[~2017-03-14 13:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-14 13:17 [PATCH 1/7] drm/i915: Move residency calculation into intel_pm.c Mika Kuoppala
2017-03-14 13:17 ` [PATCH 2/7] drm/i915: Return residency as microseconds Mika Kuoppala
2017-03-14 14:18   ` Chris Wilson
2017-03-14 13:17 ` [PATCH 3/7] drm/i915: Extend vlv/chv residency resolution Mika Kuoppala
2017-03-14 14:16   ` Chris Wilson
2017-03-14 13:17 ` [PATCH 4/7] drm/i915: Convert debugfs to use generic residency calculator Mika Kuoppala
2017-03-14 14:19   ` Chris Wilson
2017-03-14 13:17 ` Mika Kuoppala [this message]
2017-03-14 13:30   ` [PATCH 5/7] drm/i915: Use cpu clock to calculate rc0 residency Chris Wilson
2017-03-14 13:48     ` Ville Syrjälä
2017-03-14 13:17 ` [PATCH 6/7] drm/i915: Use coarse grained residency counter with byt Mika Kuoppala
2017-03-14 13:17 ` [PATCH 7/7] drm/i915: Upclock on the first residency calculation Mika Kuoppala
2017-03-14 13:34   ` Chris Wilson
2017-03-14 13:36     ` Mika Kuoppala
2017-03-14 18:46 ` ✗ Fi.CI.BAT: warning for series starting with [1/7] drm/i915: Move residency calculation into intel_pm.c 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=1489497449-31640-5-git-send-email-mika.kuoppala@intel.com \
    --to=mika.kuoppala@linux.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