[Intel-gfx] [PATCH v6] drm/i915/pmu: Use GT parked for estimating RC6 while asleep

Chris Wilson chris at chris-wilson.co.uk
Thu Sep 12 11:29:28 UTC 2019


Quoting Chris Wilson (2019-09-12 11:41:31)
> +       spin_lock_irqsave(&pmu->lock, flags);
> +       if (intel_gt_pm_get_if_awake(gt)) {
> +               val = __get_rc6(gt);
> +               intel_gt_pm_put(gt);

As food for thought, what about

val = 0;
if (intel_gt_pm_get_if_awake(gt)) {
	val = __get_rc6(gt);
	intel_gt_pm_put(gt);
}

spin_lock_irqsave(&pmu->lock, flags);
if (val) {
> +
> +               /*
> +                * If we are coming back from being runtime suspended we must
> +                * be careful not to report a larger value than returned
> +                * previously.
> +                */
> +               val = __pmu_update_rc6(pmu, val);
> +       } else {
> +               /*
> +                * We are runtime suspended.
> +                *
> +                * Report the delta from when the device was suspended to now,
> +                * on top of the last known real value, as the approximated RC6
> +                * counter value.
> +                */
> +               val = __pmu_estimate_rc6(pmu);
> +       }
> +
> +       spin_unlock_irqrestore(&pmu->lock, flags);
> +
> +       return val;
> +}

Just feels riskier... But we can try and sleep on it.
-Chris


More information about the Intel-gfx mailing list