[2/2] drm/i915/gt: Clear rc6 residency trackers across suspend
diff mbox series

Message ID 20200114105648.2172026-2-chris@chris-wilson.co.uk
State New
Headers show
Series
  • [1/2] drm/i915/pmu: Correct the rc6 offset upon enabling
Related show

Commit Message

Chris Wilson Jan. 14, 2020, 10:56 a.m. UTC
On suspend, the rc6 residency counters (stored in HW registers) will be
lost and cleared. However, we keep track of the rc6 residency to provide
a continuous 64b sampling, and if we see the HW value go backwards, we
assume it overflowed and add on 32b/40b -- an interesting artifact when
sampling across suspend.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/gt/intel_rc6.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Tvrtko Ursulin Jan. 14, 2020, 11:17 a.m. UTC | #1
On 14/01/2020 10:56, Chris Wilson wrote:
> On suspend, the rc6 residency counters (stored in HW registers) will be
> lost and cleared. However, we keep track of the rc6 residency to provide
> a continuous 64b sampling, and if we see the HW value go backwards, we
> assume it overflowed and add on 32b/40b -- an interesting artifact when
> sampling across suspend.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>   drivers/gpu/drm/i915/gt/intel_rc6.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_rc6.c b/drivers/gpu/drm/i915/gt/intel_rc6.c
> index 9e303c29d6e3..04eeb7740e53 100644
> --- a/drivers/gpu/drm/i915/gt/intel_rc6.c
> +++ b/drivers/gpu/drm/i915/gt/intel_rc6.c
> @@ -542,6 +542,8 @@ void intel_rc6_init(struct intel_rc6 *rc6)
>   
>   void intel_rc6_sanitize(struct intel_rc6 *rc6)
>   {
> +	memset(rc6->prev_hw_residency, 0, sizeof(rc6->prev_hw_residency));
> +
>   	if (rc6->enabled) { /* unbalanced suspend/resume */
>   		rpm_get(rc6);
>   		rc6->enabled = false;
> 

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/gt/intel_rc6.c b/drivers/gpu/drm/i915/gt/intel_rc6.c
index 9e303c29d6e3..04eeb7740e53 100644
--- a/drivers/gpu/drm/i915/gt/intel_rc6.c
+++ b/drivers/gpu/drm/i915/gt/intel_rc6.c
@@ -542,6 +542,8 @@  void intel_rc6_init(struct intel_rc6 *rc6)
 
 void intel_rc6_sanitize(struct intel_rc6 *rc6)
 {
+	memset(rc6->prev_hw_residency, 0, sizeof(rc6->prev_hw_residency));
+
 	if (rc6->enabled) { /* unbalanced suspend/resume */
 		rpm_get(rc6);
 		rc6->enabled = false;