[Intel-gfx] [PATCH 1/1] drm/i915/skl: fix RC6 residency time calculation

Imre Deak imre.deak at intel.com
Wed Feb 3 17:10:33 UTC 2016


On ke, 2016-02-03 at 11:29 +0530, Sagar Arun Kamble wrote:
> The RC6 residency time unit is 1.33us on SKL according to the
> specification, so update the calculation accordingly.
> 
> Cc: Imre Deak <imre.deak at intel.com>
> Signed-off-by: Sagar Arun Kamble <sagar.a.kamble at intel.com>
> ---
>  drivers/gpu/drm/i915/i915_sysfs.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_sysfs.c
> b/drivers/gpu/drm/i915/i915_sysfs.c
> index c6188dd..9aa49a9 100644
> --- a/drivers/gpu/drm/i915/i915_sysfs.c
> +++ b/drivers/gpu/drm/i915/i915_sysfs.c
> @@ -58,7 +58,8 @@ static u32 calc_residency(struct drm_device *dev,
>  	} else if (IS_BROXTON(dev)) {
>  		units = 1;
>  		div = 1200;		/* 833.33ns */
> -	}
> +	} else if (IS_SKYLAKE(dev))
> +		units = 133ULL;

Hrm. The SKL/GT_GFX_RC6 description in ConfigDB doesn't say anything
about the units, the BSpec "Timestamp Bases" provides two values for
two different modes:

1.33us and 1.28us

Not sure what are these different modes.

BSpec GT_GFX_RC6 description specifies 1.28us.

Running igt/pm_rc6_residency calculating with the current 1.28us results in:
Residency in rc6 or deeper state: 2983 ms (sleep duration 3003 ms) (ratio to expected duration: 0,99)
Subtest rc6-accuracy: SUCCESS (0,000s)

and after applying your patch (calculating with 1.33us):
Residency in rc6 or deeper state: 3101 ms (sleep duration 3001 ms) (ratio to expected duration: 1,03)
(pm_rc6_residency:6281) CRITICAL: Test assertion failure function residency_accuracy, file pm_rc6_residency.c:110:
(pm_rc6_residency:6281) CRITICAL: Failed assertion: ratio > 0.9 && ratio <= 1
(pm_rc6_residency:6281) CRITICAL: Sysfs RC6 residency counter is inaccurate.

While the measurement can be inaccurate, normally we should only err by
measuring less duration in RC6 than the duration of the actual sleep.
So I'm not convinced that 1.33us is the correct value..

--Imre

>  
>  	raw_time = I915_READ(reg) * units;
>  	ret = DIV_ROUND_UP_ULL(raw_time, div);


More information about the Intel-gfx mailing list