diff mbox series

drm/i915/pmu: Skip busyness sampling when and where not needed

Message ID 20190911160730.22687-1-tvrtko.ursulin@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/pmu: Skip busyness sampling when and where not needed | expand

Commit Message

Tvrtko Ursulin Sept. 11, 2019, 4:07 p.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Since d0aa694b9239 ("drm/i915/pmu: Always sample an active ringbuffer")
the cost of sampling the engine state on execlists platforms became a
little bit higher when both engine busyness and one of the wait states are
being monitored. (Previously the busyness sampling on legacy platforms was
done via seqno comparison so there was no cost of mmio read.)

We can avoid that by skipping busyness sampling when engine supports
software busy stats and so avoid the cost of potential mmio read and
sample accumulation.

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

Comments

Chris Wilson Sept. 11, 2019, 4:22 p.m. UTC | #1
Quoting Tvrtko Ursulin (2019-09-11 17:07:30)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> Since d0aa694b9239 ("drm/i915/pmu: Always sample an active ringbuffer")
> the cost of sampling the engine state on execlists platforms became a
> little bit higher when both engine busyness and one of the wait states are
> being monitored. (Previously the busyness sampling on legacy platforms was
> done via seqno comparison so there was no cost of mmio read.)
> 
> We can avoid that by skipping busyness sampling when engine supports
> software busy stats and so avoid the cost of potential mmio read and
> sample accumulation.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/i915_pmu.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
> index 8e251e719390..623ad32303a1 100644
> --- a/drivers/gpu/drm/i915/i915_pmu.c
> +++ b/drivers/gpu/drm/i915/i915_pmu.c
> @@ -194,6 +194,10 @@ engines_sample(struct intel_gt *gt, unsigned int period_ns)
>                 if (val & RING_WAIT_SEMAPHORE)
>                         add_sample(&pmu->sample[I915_SAMPLE_SEMA], period_ns);
>  
> +               /* No need to sample when busy stats are supported. */
> +               if (intel_engine_supports_stats(engine))
> +                       goto skip;
> +

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

I was worried we were double accounting, but later on we
have

if (intel_engine_supports_stats())
	val = ktime_to_ns(intel_engine_get_busy_time());
else
	val = engine->pmu.sample[sample].cur;

so indeed, this is just wasted effort.
-Chris
Tvrtko Ursulin Sept. 12, 2019, 12:33 p.m. UTC | #2
On 11/09/2019 17:50, Patchwork wrote:
> == Series Details ==
> 
> Series: drm/i915/pmu: Skip busyness sampling when and where not needed
> URL   : https://patchwork.freedesktop.org/series/66541/
> State : success
> 
> == Summary ==
> 
> CI Bug Log - changes from CI_DRM_6872 -> Patchwork_14363
> ====================================================
> 
> Summary
> -------
> 
>    **SUCCESS**
> 
>    No regressions found.
> 
>    External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14363/
> 
> Known issues
> ------------
> 
>    Here are the changes found in Patchwork_14363 that come from known issues:
> 
> ### IGT changes ###
> 
> #### Issues hit ####
> 
>    * igt@i915_module_load@reload:
>      - fi-icl-u3:          [PASS][1] -> [DMESG-WARN][2] ([fdo#107724] / [fdo#111214])
>     [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6872/fi-icl-u3/igt@i915_module_load@reload.html
>     [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14363/fi-icl-u3/igt@i915_module_load@reload.html
> 
>    * igt@i915_selftest@live_gem_contexts:
>      - fi-cfl-8700k:       [PASS][3] -> [INCOMPLETE][4] ([fdo#111514])
>     [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6872/fi-cfl-8700k/igt@i915_selftest@live_gem_contexts.html
>     [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14363/fi-cfl-8700k/igt@i915_selftest@live_gem_contexts.html
> 
>    * igt@kms_addfb_basic@invalid-set-prop-any:
>      - fi-icl-u3:          [PASS][5] -> [DMESG-WARN][6] ([fdo#107724])
>     [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6872/fi-icl-u3/igt@kms_addfb_basic@invalid-set-prop-any.html
>     [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14363/fi-icl-u3/igt@kms_addfb_basic@invalid-set-prop-any.html
> 
>    
> #### Possible fixes ####
> 
>    * igt@gem_mmap_gtt@basic-write-gtt:
>      - fi-icl-u3:          [DMESG-WARN][7] ([fdo#107724]) -> [PASS][8]
>     [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6872/fi-icl-u3/igt@gem_mmap_gtt@basic-write-gtt.html
>     [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14363/fi-icl-u3/igt@gem_mmap_gtt@basic-write-gtt.html
> 
>    * igt@i915_selftest@live_hangcheck:
>      - fi-icl-u3:          [INCOMPLETE][9] ([fdo#107713] / [fdo#108569]) -> [PASS][10]
>     [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6872/fi-icl-u3/igt@i915_selftest@live_hangcheck.html
>     [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14363/fi-icl-u3/igt@i915_selftest@live_hangcheck.html
> 
>    * igt@kms_chamelium@hdmi-hpd-fast:
>      - fi-kbl-7500u:       [FAIL][11] ([fdo#111407]) -> [PASS][12]
>     [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6872/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html
>     [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14363/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html
> 
>    
>    {name}: This element is suppressed. This means it is ignored when computing
>            the status of the difference (SUCCESS, WARNING, or FAILURE).
> 
>    [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
>    [fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
>    [fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
>    [fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
>    [fdo#111214]: https://bugs.freedesktop.org/show_bug.cgi?id=111214
>    [fdo#111407]: https://bugs.freedesktop.org/show_bug.cgi?id=111407
>    [fdo#111514]: https://bugs.freedesktop.org/show_bug.cgi?id=111514
> 
> 
> Participating hosts (54 -> 47)
> ------------------------------
> 
>    Missing    (7): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-icl-y fi-byt-clapper fi-bdw-samus
> 
> 
> Build changes
> -------------
> 
>    * CI: CI-20190529 -> None
>    * Linux: CI_DRM_6872 -> Patchwork_14363
> 
>    CI-20190529: 20190529
>    CI_DRM_6872: b27acd37b7dedf49557d6e41a3ee046c3f5d99ba @ git://anongit.freedesktop.org/gfx-ci/linux
>    IGT_5178: efb4539494d94f03374874d3b61bd04ef3802aaa @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
>    Patchwork_14363: 48733870bba853158fe3f7c529866078838f6198 @ git://anongit.freedesktop.org/gfx-ci/linux
> 
> 
> == Linux commits ==
> 
> 48733870bba8 drm/i915/pmu: Skip busyness sampling when and where not needed

Pushed, thanks for the review!

Regards,

Tvrtko

> 
> == Logs ==
> 
> For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14363/
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
index 8e251e719390..623ad32303a1 100644
--- a/drivers/gpu/drm/i915/i915_pmu.c
+++ b/drivers/gpu/drm/i915/i915_pmu.c
@@ -194,6 +194,10 @@  engines_sample(struct intel_gt *gt, unsigned int period_ns)
 		if (val & RING_WAIT_SEMAPHORE)
 			add_sample(&pmu->sample[I915_SAMPLE_SEMA], period_ns);
 
+		/* No need to sample when busy stats are supported. */
+		if (intel_engine_supports_stats(engine))
+			goto skip;
+
 		/*
 		 * While waiting on a semaphore or event, MI_MODE reports the
 		 * ring as idle. However, previously using the seqno, and with