diff mbox series

[1/9] drm/i915/pmu: Support PMU for all engines

Message ID 20230330004103.1295413-2-umesh.nerlige.ramappa@intel.com (mailing list archive)
State New, archived
Headers show
Series Add MTL PMU support for multi-gt | expand

Commit Message

Umesh Nerlige Ramappa March 30, 2023, 12:40 a.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Given how the metrics are already exported, we also need to run sampling
over engines from all GTs.

Problem of GT frequencies is left for later.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/i915_pmu.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

Comments

Tvrtko Ursulin March 30, 2023, 12:27 p.m. UTC | #1
On 30/03/2023 01:40, Umesh Nerlige Ramappa wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> Given how the metrics are already exported, we also need to run sampling
> over engines from all GTs.
> 
> Problem of GT frequencies is left for later.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Just a reminder to add your s-o-b while moving patches from internal to 
upstream.

Regards,

Tvrtko

> ---
>   drivers/gpu/drm/i915/i915_pmu.c | 14 +++++++++++---
>   1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
> index 7ece883a7d95..e274dba58629 100644
> --- a/drivers/gpu/drm/i915/i915_pmu.c
> +++ b/drivers/gpu/drm/i915/i915_pmu.c
> @@ -10,6 +10,7 @@
>   #include "gt/intel_engine_pm.h"
>   #include "gt/intel_engine_regs.h"
>   #include "gt/intel_engine_user.h"
> +#include "gt/intel_gt.h"
>   #include "gt/intel_gt_pm.h"
>   #include "gt/intel_gt_regs.h"
>   #include "gt/intel_rc6.h"
> @@ -414,8 +415,9 @@ static enum hrtimer_restart i915_sample(struct hrtimer *hrtimer)
>   	struct drm_i915_private *i915 =
>   		container_of(hrtimer, struct drm_i915_private, pmu.timer);
>   	struct i915_pmu *pmu = &i915->pmu;
> -	struct intel_gt *gt = to_gt(i915);
>   	unsigned int period_ns;
> +	struct intel_gt *gt;
> +	unsigned int i;
>   	ktime_t now;
>   
>   	if (!READ_ONCE(pmu->timer_enabled))
> @@ -431,8 +433,14 @@ static enum hrtimer_restart i915_sample(struct hrtimer *hrtimer)
>   	 * grabbing the forcewake. However the potential error from timer call-
>   	 * back delay greatly dominates this so we keep it simple.
>   	 */
> -	engines_sample(gt, period_ns);
> -	frequency_sample(gt, period_ns);
> +
> +	for_each_gt(gt, i915, i) {
> +		engines_sample(gt, period_ns);
> +
> +		/* Sample only gt0 until gt support is added for frequency */
> +		if (i == 0)
> +			frequency_sample(gt, period_ns);
> +	}
>   
>   	hrtimer_forward(hrtimer, now, ns_to_ktime(PERIOD));
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
index 7ece883a7d95..e274dba58629 100644
--- a/drivers/gpu/drm/i915/i915_pmu.c
+++ b/drivers/gpu/drm/i915/i915_pmu.c
@@ -10,6 +10,7 @@ 
 #include "gt/intel_engine_pm.h"
 #include "gt/intel_engine_regs.h"
 #include "gt/intel_engine_user.h"
+#include "gt/intel_gt.h"
 #include "gt/intel_gt_pm.h"
 #include "gt/intel_gt_regs.h"
 #include "gt/intel_rc6.h"
@@ -414,8 +415,9 @@  static enum hrtimer_restart i915_sample(struct hrtimer *hrtimer)
 	struct drm_i915_private *i915 =
 		container_of(hrtimer, struct drm_i915_private, pmu.timer);
 	struct i915_pmu *pmu = &i915->pmu;
-	struct intel_gt *gt = to_gt(i915);
 	unsigned int period_ns;
+	struct intel_gt *gt;
+	unsigned int i;
 	ktime_t now;
 
 	if (!READ_ONCE(pmu->timer_enabled))
@@ -431,8 +433,14 @@  static enum hrtimer_restart i915_sample(struct hrtimer *hrtimer)
 	 * grabbing the forcewake. However the potential error from timer call-
 	 * back delay greatly dominates this so we keep it simple.
 	 */
-	engines_sample(gt, period_ns);
-	frequency_sample(gt, period_ns);
+
+	for_each_gt(gt, i915, i) {
+		engines_sample(gt, period_ns);
+
+		/* Sample only gt0 until gt support is added for frequency */
+		if (i == 0)
+			frequency_sample(gt, period_ns);
+	}
 
 	hrtimer_forward(hrtimer, now, ns_to_ktime(PERIOD));