[Intel-gfx] [PATCH v4] drm/i915/pmu: Use GT parked for estimating RC6 while asleep
Chris Wilson
chris at chris-wilson.co.uk
Thu Sep 12 10:16:53 UTC 2019
Quoting Chris Wilson (2019-09-12 11:13:39)
> +#if IS_ENABLED(CONFIG_PM)
> +
> +static inline s64 ktime_since(const ktime_t kt)
> +{
> + return ktime_to_ns(ktime_sub(ktime_get(), kt));
> +}
> +
> +void i915_pmu_gt_parked(struct drm_i915_private *i915)
> +{
> + struct i915_pmu *pmu = &i915->pmu;
> + u64 val;
> +
> + if (!pmu->base.event_init)
> + return;
> +
> + spin_lock_irq(&pmu->lock);
> +
> + val = 0;
> + if (pmu->sample[__I915_SAMPLE_RC6].cur)
> + val = __get_rc6(&i915->gt);
> +
> + if (val >= pmu->sample[__I915_SAMPLE_RC6_ESTIMATED].cur) {
> + pmu->sample[__I915_SAMPLE_RC6_ESTIMATED].cur = 0;
> + pmu->sample[__I915_SAMPLE_RC6].cur = val;
> + }
> + pmu->sleep_last = ktime_get();
> +
> + /*
> + * Signal sampling timer to stop if only engine events are enabled and
> + * GPU went idle.
> + */
> + pmu->timer_enabled = pmu_needs_timer(pmu, false);
The caveat here is that we don't stop the rc6 pmu timer while we sleep.
Seems like 6 of one, half-a-dozen of the other.
-Chris
More information about the Intel-gfx
mailing list