drm/i915/pmu: Report frequency as zero while GPU is sleeping
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Fri, 29 Nov 2019 10:54:36 +0000 (10:54 +0000)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Fri, 6 Dec 2019 13:03:36 +0000 (13:03 +0000)
commitb66ecd0438bf6079d08e8f2afea6114f468f56f4
treea6a6e554029ae7ae5db1292162916a0926627316
parent1a74934b0effbd979c520e1122b680624a1a6372
drm/i915/pmu: Report frequency as zero while GPU is sleeping

We used to report the minimum possible frequency as both requested and
active while GPU was in sleep state. This was a consequence of sampling
the value from the "current frequency" field in our software tracking.

This was strictly speaking wrong, but given that until recently the
current frequency in sleeping state used to be equal to minimum, it did
not stand out sufficiently to be noticed as such.

After some recent changes have made the current frequency be reported
as last active before GPU went to sleep, meaning both requested and active
frequencies could end up being reported at their maximum values for the
duration of the GPU idle state, it became much more obvious that this does
not make sense.

To fix this we will now sample the frequency counters only when the GPU is
awake. As a consequence reported frequencies could be reported as below
the GPU reported minimum but that should be much less confusing that the
current situation.

v2:
 * Split out early exit conditions for readability. (Chris)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Closes: https://gitlab.freedesktop.org/drm/intel/issues/675
Link: https://patchwork.freedesktop.org/patch/msgid/20191129105436.20100-1-tvrtko.ursulin@linux.intel.com
drivers/gpu/drm/i915/i915_pmu.c