From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Andrzej Hajda <andrzej.hajda@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 1/2] drm/i915/pmu: Turn off the timer to sample frequencies when GT is parked
Date: Wed, 24 May 2023 14:46:04 -0700 [thread overview]
Message-ID: <87zg5tmmhv.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <86c706cc-9d98-3b28-d713-853938cabf74@intel.com>
On Wed, 24 May 2023 02:12:31 -0700, Andrzej Hajda wrote:
>
Hi Andrzej,
> On 23.05.2023 17:19, Ashutosh Dixit wrote:
> > pmu_needs_timer() keeps the timer running even when GT is parked,
> > ostensibly to sample requested/actual frequencies. However
> > frequency_sample() has the following:
> >
> > /* Report 0/0 (actual/requested) frequency while parked. */
> > if (!intel_gt_pm_get_if_awake(gt))
> > return;
> >
> > The above code prevents frequencies to be sampled while the GT is
> > parked. So we might as well turn off the sampling timer itself in this
> > case and save CPU cycles/power.
> >
> > v2: Instead of turning freq bits off, return false, since no counters will
> > run after this change when GT is parked (Tvrtko)
> >
> > Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
> > Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> > ---
> > drivers/gpu/drm/i915/i915_pmu.c | 12 +++++-------
> > 1 file changed, 5 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
> > index a814583e19fd7..b47d890d4ada1 100644
> > --- a/drivers/gpu/drm/i915/i915_pmu.c
> > +++ b/drivers/gpu/drm/i915/i915_pmu.c
> > @@ -144,6 +144,10 @@ static bool pmu_needs_timer(struct i915_pmu *pmu, bool gpu_active)
> > struct drm_i915_private *i915 = container_of(pmu, typeof(*i915), pmu);
> > u32 enable;
> > + /* When GPU is idle, at present no counters need to run */
> > + if (!gpu_active)
> > + return false;
> > +
>
> What is then purpose of calling pmu_needs_timer with 2nd arg false?
> Why not just replace all occurrences of pmu_needs_timer(.., false) with
> false? And remove the 2nd argument.
OK, this didn't seem unreasonable so I went ahead and made this change in
Patch v3. Copying Tvrtko too in case he prefers v2 for any reason. Please
review.
Thanks.
--
Ashutosh
>
>
>
> > /*
> > * Only some counters need the sampling timer.
> > *
> > @@ -157,17 +161,11 @@ static bool pmu_needs_timer(struct i915_pmu *pmu, bool gpu_active)
> > */
> > enable &= frequency_enabled_mask() | ENGINE_SAMPLE_MASK;
> > - /*
> > - * When the GPU is idle per-engine counters do not need to be
> > - * running so clear those bits out.
> > - */
> > - if (!gpu_active)
> > - enable &= ~ENGINE_SAMPLE_MASK;
> > /*
> > * Also there is software busyness tracking available we do not
> > * need the timer for I915_SAMPLE_BUSY counter.
> > */
> > - else if (i915->caps.scheduler & I915_SCHEDULER_CAP_ENGINE_BUSY_STATS)
> > + if (i915->caps.scheduler & I915_SCHEDULER_CAP_ENGINE_BUSY_STATS)
> > enable &= ~BIT(I915_SAMPLE_BUSY);
> > /*
>
WARNING: multiple messages have this Message-ID (diff)
From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Andrzej Hajda <andrzej.hajda@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 1/2] drm/i915/pmu: Turn off the timer to sample frequencies when GT is parked
Date: Wed, 24 May 2023 14:46:04 -0700 [thread overview]
Message-ID: <87zg5tmmhv.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <86c706cc-9d98-3b28-d713-853938cabf74@intel.com>
On Wed, 24 May 2023 02:12:31 -0700, Andrzej Hajda wrote:
>
Hi Andrzej,
> On 23.05.2023 17:19, Ashutosh Dixit wrote:
> > pmu_needs_timer() keeps the timer running even when GT is parked,
> > ostensibly to sample requested/actual frequencies. However
> > frequency_sample() has the following:
> >
> > /* Report 0/0 (actual/requested) frequency while parked. */
> > if (!intel_gt_pm_get_if_awake(gt))
> > return;
> >
> > The above code prevents frequencies to be sampled while the GT is
> > parked. So we might as well turn off the sampling timer itself in this
> > case and save CPU cycles/power.
> >
> > v2: Instead of turning freq bits off, return false, since no counters will
> > run after this change when GT is parked (Tvrtko)
> >
> > Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
> > Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> > ---
> > drivers/gpu/drm/i915/i915_pmu.c | 12 +++++-------
> > 1 file changed, 5 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
> > index a814583e19fd7..b47d890d4ada1 100644
> > --- a/drivers/gpu/drm/i915/i915_pmu.c
> > +++ b/drivers/gpu/drm/i915/i915_pmu.c
> > @@ -144,6 +144,10 @@ static bool pmu_needs_timer(struct i915_pmu *pmu, bool gpu_active)
> > struct drm_i915_private *i915 = container_of(pmu, typeof(*i915), pmu);
> > u32 enable;
> > + /* When GPU is idle, at present no counters need to run */
> > + if (!gpu_active)
> > + return false;
> > +
>
> What is then purpose of calling pmu_needs_timer with 2nd arg false?
> Why not just replace all occurrences of pmu_needs_timer(.., false) with
> false? And remove the 2nd argument.
OK, this didn't seem unreasonable so I went ahead and made this change in
Patch v3. Copying Tvrtko too in case he prefers v2 for any reason. Please
review.
Thanks.
--
Ashutosh
>
>
>
> > /*
> > * Only some counters need the sampling timer.
> > *
> > @@ -157,17 +161,11 @@ static bool pmu_needs_timer(struct i915_pmu *pmu, bool gpu_active)
> > */
> > enable &= frequency_enabled_mask() | ENGINE_SAMPLE_MASK;
> > - /*
> > - * When the GPU is idle per-engine counters do not need to be
> > - * running so clear those bits out.
> > - */
> > - if (!gpu_active)
> > - enable &= ~ENGINE_SAMPLE_MASK;
> > /*
> > * Also there is software busyness tracking available we do not
> > * need the timer for I915_SAMPLE_BUSY counter.
> > */
> > - else if (i915->caps.scheduler & I915_SCHEDULER_CAP_ENGINE_BUSY_STATS)
> > + if (i915->caps.scheduler & I915_SCHEDULER_CAP_ENGINE_BUSY_STATS)
> > enable &= ~BIT(I915_SAMPLE_BUSY);
> > /*
>
next prev parent reply other threads:[~2023-05-24 22:00 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-23 15:19 [Intel-gfx] [PATCH 0/2] drm/i915/pmu: couple of cleanups Ashutosh Dixit
2023-05-23 15:19 ` Ashutosh Dixit
2023-05-23 15:19 ` [Intel-gfx] [PATCH 1/2] drm/i915/pmu: Turn off the timer to sample frequencies when GT is parked Ashutosh Dixit
2023-05-23 15:19 ` Ashutosh Dixit
2023-05-24 9:12 ` [Intel-gfx] " Andrzej Hajda
2023-05-24 21:46 ` Dixit, Ashutosh [this message]
2023-05-24 21:46 ` Dixit, Ashutosh
2023-05-25 8:00 ` Tvrtko Ursulin
2023-05-23 15:19 ` [Intel-gfx] [PATCH 2/2] drm/i915/pmu: Make PMU sample array two-dimensional Ashutosh Dixit
2023-05-23 15:19 ` Ashutosh Dixit
2023-05-24 9:14 ` [Intel-gfx] " Andrzej Hajda
2023-05-24 11:38 ` Tvrtko Ursulin
2023-05-24 11:38 ` Tvrtko Ursulin
2023-05-24 17:38 ` [Intel-gfx] " Dixit, Ashutosh
2023-05-24 17:38 ` Dixit, Ashutosh
2023-05-24 17:53 ` [Intel-gfx] " Tvrtko Ursulin
2023-05-24 17:53 ` Tvrtko Ursulin
2023-05-24 21:46 ` [Intel-gfx] " Dixit, Ashutosh
2023-05-24 21:46 ` Dixit, Ashutosh
2023-05-23 16:11 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915/pmu: couple of cleanups Patchwork
2023-05-23 21:54 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-05-24 6:56 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2023-05-24 21:56 [Intel-gfx] [PATCH v2 0/2] " Ashutosh Dixit
2023-05-24 21:56 ` [Intel-gfx] [PATCH 1/2] drm/i915/pmu: Turn off the timer to sample frequencies when GT is parked Ashutosh Dixit
2023-05-25 6:45 ` Andrzej Hajda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zg5tmmhv.wl-ashutosh.dixit@intel.com \
--to=ashutosh.dixit@intel.com \
--cc=andrzej.hajda@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.