diff mbox series

[3/4] drm/i915/pmu: Cheat when reading the actual frequency to avoid fw

Message ID 20191108085626.32429-3-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series [1/4] drm/i915/icl: Refine PG_HYSTERESIS | expand

Commit Message

Chris Wilson Nov. 8, 2019, 8:56 a.m. UTC
We want to avoid taking forcewake when querying the performance stats,
as we wish to avoid perturbing the system under observation. (And with
the forcewake being kept alive for 1ms after use, sampling the frequency
from a timer keeps forcewake 60% active.)

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

Comments

Chris Wilson Nov. 8, 2019, 9:05 a.m. UTC | #1
Quoting Chris Wilson (2019-11-08 08:56:24)
> We want to avoid taking forcewake when querying the performance stats,
> as we wish to avoid perturbing the system under observation. (And with
> the forcewake being kept alive for 1ms after use, sampling the frequency
> from a timer keeps forcewake 60% active.)

Oops, rc6 was reported as 60% active => fw 40% active.
-Chris
Tvrtko Ursulin Nov. 8, 2019, 10:19 a.m. UTC | #2
On 08/11/2019 08:56, Chris Wilson wrote:
> We want to avoid taking forcewake when querying the performance stats,
> as we wish to avoid perturbing the system under observation. (And with
> the forcewake being kept alive for 1ms after use, sampling the frequency
> from a timer keeps forcewake 60% active.)
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>   drivers/gpu/drm/i915/i915_pmu.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
> index 05395015d1f2..dbde80a376cb 100644
> --- a/drivers/gpu/drm/i915/i915_pmu.c
> +++ b/drivers/gpu/drm/i915/i915_pmu.c
> @@ -366,8 +366,12 @@ frequency_sample(struct intel_gt *gt, unsigned int period_ns)
>   
>   		val = rps->cur_freq;
>   		if (intel_gt_pm_get_if_awake(gt)) {
> -			val = intel_uncore_read_notrace(uncore, GEN6_RPSTAT1);
> -			val = intel_get_cagf(rps, val);
> +			u32 stat;
> +
> +			stat = intel_uncore_read_fw(uncore, GEN6_RPSTAT1);
> +			if (stat)
> +				val = intel_get_cagf(rps, stat);
> +
>   			intel_gt_pm_put(gt);
>   		}
>   
> 

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

Regards,

Tvrtko
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
index 05395015d1f2..dbde80a376cb 100644
--- a/drivers/gpu/drm/i915/i915_pmu.c
+++ b/drivers/gpu/drm/i915/i915_pmu.c
@@ -366,8 +366,12 @@  frequency_sample(struct intel_gt *gt, unsigned int period_ns)
 
 		val = rps->cur_freq;
 		if (intel_gt_pm_get_if_awake(gt)) {
-			val = intel_uncore_read_notrace(uncore, GEN6_RPSTAT1);
-			val = intel_get_cagf(rps, val);
+			u32 stat;
+
+			stat = intel_uncore_read_fw(uncore, GEN6_RPSTAT1);
+			if (stat)
+				val = intel_get_cagf(rps, stat);
+
 			intel_gt_pm_put(gt);
 		}