diff options
author | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2017-11-23 13:26:54 +0300 |
---|---|---|
committer | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2017-11-23 15:27:52 +0300 |
commit | fbba5559d91e812db0fd446fb383a37fde48b1cb (patch) | |
tree | de59a6a6afef6dcef4a11a92849943ecc5eec360 /drivers | |
parent | b552ae444e454eb3254c958e05b69820c0ef346d (diff) | |
download | linux-fbba5559d91e812db0fd446fb383a37fde48b1cb.tar.xz |
drm/i915/pmu: Clear the previous sample value when parking
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)
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20171123102654.29296-1-tvrtko.ursulin@linux.intel.com
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/i915/i915_pmu.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c index 1071935bfa67..6a42e7f7967d 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); @@ -839,6 +857,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); |