• Tvrtko Ursulin's avatar
    drm/i915/pmu: Ensure monotonic rc6 · df6a4205
    Tvrtko Ursulin authored
    Avoid rc6 counter going backward in close to 0% RC6 scenarios like:
    
        15.005477996        114,246,613 ns   i915/rc6-residency/
        16.005876662            667,657 ns   i915/rc6-residency/
        17.006131417              7,286 ns   i915/rc6-residency/
        18.006615031 18,446,744,073,708,914,688 ns   i915/rc6-residency/
        19.007158361 18,446,744,073,709,447,168 ns   i915/rc6-residency/
        20.007806498                  0 ns   i915/rc6-residency/
        21.008227495          1,440,403 ns   i915/rc6-residency/
    
    There are two aspects to this fix.
    
    First is not assuming rc6 value zero means GT is asleep since that can
    also mean GPU is fully busy and we do not want to enter the estimation
    path in that case.
    
    Second is ensuring monotonicity on the estimation path itself. I suspect
    what is happening is with extremely rapid park/unpark cycles we get no
    updates on the real rc6 and therefore have to careful not to
    unconditionally trust use last known real rc6 when creating a new
    estimation.
    
    v2:
     * Simplify logic by not tracking the estimate but last reported value.
    Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
    Fixes: 16ffe73c ("drm/i915/pmu: Use GT parked for estimating RC6 while asleep")
    Cc: Chris Wilson <chris@chris-wilson.co.uk>
    Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> # v1
    Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
    Link: https://patchwork.freedesktop.org/patch/msgid/20191217142057.1000-1-tvrtko.ursulin@linux.intel.com
    df6a4205
i915_pmu.h 3.21 KB