diff mbox

[09/17] drm/i915: Report requested frequency alongside current frequency in debugfs

Message ID 1377557469-4078-10-git-send-email-rodrigo.vivi@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Rodrigo Vivi Aug. 26, 2013, 10:51 p.m. UTC
From: Chris Wilson <chris@chris-wilson.co.uk>

It can be useful to compare at times the current vs requested frequency
of the GPU, so provide the contents of RPNSWREQ alonside CAGF.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Rodrigo Vivi Aug. 27, 2013, 12:12 p.m. UTC | #1
On Mon, Aug 26, 2013 at 7:51 PM, Rodrigo Vivi <rodrigo.vivi@gmail.com> wrote:
> From: Chris Wilson <chris@chris-wilson.co.uk>
>
> It can be useful to compare at times the current vs requested frequency
> of the GPU, so provide the contents of RPNSWREQ alonside CAGF.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 55ab924..a6f4cb5 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -857,7 +857,7 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
>                 u32 gt_perf_status = I915_READ(GEN6_GT_PERF_STATUS);
>                 u32 rp_state_limits = I915_READ(GEN6_RP_STATE_LIMITS);
>                 u32 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP);
> -               u32 rpstat, cagf;
> +               u32 rpstat, cagf, reqf;
>                 u32 rpupei, rpcurup, rpprevup;
>                 u32 rpdownei, rpcurdown, rpprevdown;
>                 int max_freq;
> @@ -869,6 +869,14 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
>
>                 gen6_gt_force_wake_get(dev_priv);
>
> +               reqf = I915_READ(GEN6_RPNSWREQ);
> +               reqf &= ~GEN6_TURBO_DISABLE;
> +               if (IS_HASWELL(dev))
> +                       reqf >>= 24;
> +               else
> +                       reqf >>= 25;

I would prefer a define like HSW_REQF_SHIFT 24 close to HSW_FREQUENCY
to avoid people asking why magic 24/25 value.
I added the HSW_FREQUENCY there and still asked "why 24?"

But with or without this bikeshed:
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>

> +               reqf *= GT_FREQUENCY_MULTIPLIER;
> +
>                 rpstat = I915_READ(GEN6_RPSTAT1);
>                 rpupei = I915_READ(GEN6_RP_CUR_UP_EI);
>                 rpcurup = I915_READ(GEN6_RP_CUR_UP);
> @@ -893,6 +901,7 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
>                            gt_perf_status & 0xff);
>                 seq_printf(m, "Render p-state limit: %d\n",
>                            rp_state_limits & 0xff);
> +               seq_printf(m, "RPNSWREQ: %dMHz\n", reqf);
>                 seq_printf(m, "CAGF: %dMHz\n", cagf);
>                 seq_printf(m, "RP CUR UP EI: %dus\n", rpupei &
>                            GEN6_CURICONT_MASK);
> --
> 1.8.1.4
>
Chris Wilson Aug. 27, 2013, 12:36 p.m. UTC | #2
On Tue, Aug 27, 2013 at 09:12:40AM -0300, Rodrigo Vivi wrote:
> On Mon, Aug 26, 2013 at 7:51 PM, Rodrigo Vivi <rodrigo.vivi@gmail.com> wrote:
> > From: Chris Wilson <chris@chris-wilson.co.uk>
> >
> > It can be useful to compare at times the current vs requested frequency
> > of the GPU, so provide the contents of RPNSWREQ alonside CAGF.
> >
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > ---
> >  drivers/gpu/drm/i915/i915_debugfs.c | 11 ++++++++++-
> >  1 file changed, 10 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> > index 55ab924..a6f4cb5 100644
> > --- a/drivers/gpu/drm/i915/i915_debugfs.c
> > +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> > @@ -857,7 +857,7 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
> >                 u32 gt_perf_status = I915_READ(GEN6_GT_PERF_STATUS);
> >                 u32 rp_state_limits = I915_READ(GEN6_RP_STATE_LIMITS);
> >                 u32 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP);
> > -               u32 rpstat, cagf;
> > +               u32 rpstat, cagf, reqf;
> >                 u32 rpupei, rpcurup, rpprevup;
> >                 u32 rpdownei, rpcurdown, rpprevdown;
> >                 int max_freq;
> > @@ -869,6 +869,14 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
> >
> >                 gen6_gt_force_wake_get(dev_priv);
> >
> > +               reqf = I915_READ(GEN6_RPNSWREQ);
> > +               reqf &= ~GEN6_TURBO_DISABLE;
> > +               if (IS_HASWELL(dev))
> > +                       reqf >>= 24;
> > +               else
> > +                       reqf >>= 25;
> 
> I would prefer a define like HSW_REQF_SHIFT 24 close to HSW_FREQUENCY
> to avoid people asking why magic 24/25 value.
> I added the HSW_FREQUENCY there and still asked "why 24?"

Heck, I wrote it straight out of the bspec, and was too lazy to chase
the meaning of CAGF_SHIFT simply because it is not obvious from reading
the code and require header chasing.

I'll let our hard working maintainer decide how he wants it if he
applies it. For longer term, I have this exported through perf anyway.
-Chris
Daniel Vetter Aug. 28, 2013, 8:15 a.m. UTC | #3
On Tue, Aug 27, 2013 at 09:12:40AM -0300, Rodrigo Vivi wrote:
> On Mon, Aug 26, 2013 at 7:51 PM, Rodrigo Vivi <rodrigo.vivi@gmail.com> wrote:
> > From: Chris Wilson <chris@chris-wilson.co.uk>
> >
> > It can be useful to compare at times the current vs requested frequency
> > of the GPU, so provide the contents of RPNSWREQ alonside CAGF.
> >
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > ---
> >  drivers/gpu/drm/i915/i915_debugfs.c | 11 ++++++++++-
> >  1 file changed, 10 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> > index 55ab924..a6f4cb5 100644
> > --- a/drivers/gpu/drm/i915/i915_debugfs.c
> > +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> > @@ -857,7 +857,7 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
> >                 u32 gt_perf_status = I915_READ(GEN6_GT_PERF_STATUS);
> >                 u32 rp_state_limits = I915_READ(GEN6_RP_STATE_LIMITS);
> >                 u32 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP);
> > -               u32 rpstat, cagf;
> > +               u32 rpstat, cagf, reqf;
> >                 u32 rpupei, rpcurup, rpprevup;
> >                 u32 rpdownei, rpcurdown, rpprevdown;
> >                 int max_freq;
> > @@ -869,6 +869,14 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
> >
> >                 gen6_gt_force_wake_get(dev_priv);
> >
> > +               reqf = I915_READ(GEN6_RPNSWREQ);
> > +               reqf &= ~GEN6_TURBO_DISABLE;
> > +               if (IS_HASWELL(dev))
> > +                       reqf >>= 24;
> > +               else
> > +                       reqf >>= 25;
> 
> I would prefer a define like HSW_REQF_SHIFT 24 close to HSW_FREQUENCY
> to avoid people asking why magic 24/25 value.
> I added the HSW_FREQUENCY there and still asked "why 24?"
> 
> But with or without this bikeshed:
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>

Queued for -next, thanks for the patch.
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 55ab924..a6f4cb5 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -857,7 +857,7 @@  static int i915_cur_delayinfo(struct seq_file *m, void *unused)
 		u32 gt_perf_status = I915_READ(GEN6_GT_PERF_STATUS);
 		u32 rp_state_limits = I915_READ(GEN6_RP_STATE_LIMITS);
 		u32 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP);
-		u32 rpstat, cagf;
+		u32 rpstat, cagf, reqf;
 		u32 rpupei, rpcurup, rpprevup;
 		u32 rpdownei, rpcurdown, rpprevdown;
 		int max_freq;
@@ -869,6 +869,14 @@  static int i915_cur_delayinfo(struct seq_file *m, void *unused)
 
 		gen6_gt_force_wake_get(dev_priv);
 
+		reqf = I915_READ(GEN6_RPNSWREQ);
+		reqf &= ~GEN6_TURBO_DISABLE;
+		if (IS_HASWELL(dev))
+			reqf >>= 24;
+		else
+			reqf >>= 25;
+		reqf *= GT_FREQUENCY_MULTIPLIER;
+
 		rpstat = I915_READ(GEN6_RPSTAT1);
 		rpupei = I915_READ(GEN6_RP_CUR_UP_EI);
 		rpcurup = I915_READ(GEN6_RP_CUR_UP);
@@ -893,6 +901,7 @@  static int i915_cur_delayinfo(struct seq_file *m, void *unused)
 			   gt_perf_status & 0xff);
 		seq_printf(m, "Render p-state limit: %d\n",
 			   rp_state_limits & 0xff);
+		seq_printf(m, "RPNSWREQ: %dMHz\n", reqf);
 		seq_printf(m, "CAGF: %dMHz\n", cagf);
 		seq_printf(m, "RP CUR UP EI: %dus\n", rpupei &
 			   GEN6_CURICONT_MASK);