Commit c51c29fb authored by Tvrtko Ursulin's avatar Tvrtko Ursulin

drm/i915/pmu: Use raw clock for rc6 estimation

RC6 is a hardware counter and as such estimating it using the raw clock
during runtime suspend is more appropriate.
Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
References: 34f43927 ("perf: Add per event clockid support")
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20201214094349.3563876-2-tvrtko.ursulin@linux.intel.com
parent dbe13ae1
...@@ -163,9 +163,9 @@ static u64 __get_rc6(struct intel_gt *gt) ...@@ -163,9 +163,9 @@ static u64 __get_rc6(struct intel_gt *gt)
#if IS_ENABLED(CONFIG_PM) #if IS_ENABLED(CONFIG_PM)
static inline s64 ktime_since(const ktime_t kt) static inline s64 ktime_since_raw(const ktime_t kt)
{ {
return ktime_to_ns(ktime_sub(ktime_get(), kt)); return ktime_to_ns(ktime_sub(ktime_get_raw(), kt));
} }
static u64 get_rc6(struct intel_gt *gt) static u64 get_rc6(struct intel_gt *gt)
...@@ -194,7 +194,7 @@ static u64 get_rc6(struct intel_gt *gt) ...@@ -194,7 +194,7 @@ static u64 get_rc6(struct intel_gt *gt)
* on top of the last known real value, as the approximated RC6 * on top of the last known real value, as the approximated RC6
* counter value. * counter value.
*/ */
val = ktime_since(pmu->sleep_last); val = ktime_since_raw(pmu->sleep_last);
val += pmu->sample[__I915_SAMPLE_RC6].cur; val += pmu->sample[__I915_SAMPLE_RC6].cur;
} }
...@@ -217,7 +217,7 @@ static void init_rc6(struct i915_pmu *pmu) ...@@ -217,7 +217,7 @@ static void init_rc6(struct i915_pmu *pmu)
pmu->sample[__I915_SAMPLE_RC6].cur = __get_rc6(&i915->gt); pmu->sample[__I915_SAMPLE_RC6].cur = __get_rc6(&i915->gt);
pmu->sample[__I915_SAMPLE_RC6_LAST_REPORTED].cur = pmu->sample[__I915_SAMPLE_RC6_LAST_REPORTED].cur =
pmu->sample[__I915_SAMPLE_RC6].cur; pmu->sample[__I915_SAMPLE_RC6].cur;
pmu->sleep_last = ktime_get(); pmu->sleep_last = ktime_get_raw();
} }
} }
...@@ -226,7 +226,7 @@ static void park_rc6(struct drm_i915_private *i915) ...@@ -226,7 +226,7 @@ static void park_rc6(struct drm_i915_private *i915)
struct i915_pmu *pmu = &i915->pmu; struct i915_pmu *pmu = &i915->pmu;
pmu->sample[__I915_SAMPLE_RC6].cur = __get_rc6(&i915->gt); pmu->sample[__I915_SAMPLE_RC6].cur = __get_rc6(&i915->gt);
pmu->sleep_last = ktime_get(); pmu->sleep_last = ktime_get_raw();
} }
#else #else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment