On 20.03.2023 00:57, Andi Shyti wrote:
Hi Andrzej,

On Mon, Mar 06, 2023 at 05:32:02PM +0100, Andrzej Hajda wrote:
From: Chris Wilson <ch...@chris-wilson.co.uk>

Extract the callstack tracking of intel_runtime_pm.c into its own
utility so that that we can reuse it for other online debugging of
scoped wakerefs.

Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
Signed-off-by: Andrzej Hajda <andrzej.ha...@intel.com>
---
  drivers/gpu/drm/i915/Kconfig.debug           |   9 ++
  drivers/gpu/drm/i915/Makefile                |   4 +
  drivers/gpu/drm/i915/intel_runtime_pm.c      | 222 +++----------------------
  drivers/gpu/drm/i915/intel_wakeref.h         |   2 +-
  drivers/gpu/drm/i915/intel_wakeref_tracker.c | 234 +++++++++++++++++++++++++++
  drivers/gpu/drm/i915/intel_wakeref_tracker.h |  52 ++++++
  6 files changed, 319 insertions(+), 204 deletions(-)

diff --git a/drivers/gpu/drm/i915/Kconfig.debug 
b/drivers/gpu/drm/i915/Kconfig.debug
index 93dfb7ed970547..5fde52107e3b44 100644
--- a/drivers/gpu/drm/i915/Kconfig.debug
+++ b/drivers/gpu/drm/i915/Kconfig.debug
@@ -25,6 +25,7 @@ config DRM_I915_DEBUG
        select PREEMPT_COUNT
        select I2C_CHARDEV
        select STACKDEPOT
+       select STACKTRACE
        select DRM_DP_AUX_CHARDEV
        select X86_MSR # used by igt/pm_rpm
        select DRM_VGEM # used by igt/prime_vgem (dmabuf interop checks)
@@ -37,6 +38,7 @@ config DRM_I915_DEBUG
        select DRM_I915_DEBUG_GEM
        select DRM_I915_DEBUG_GEM_ONCE
        select DRM_I915_DEBUG_MMIO
+       select DRM_I915_TRACK_WAKEREF
        select DRM_I915_DEBUG_RUNTIME_PM
        select DRM_I915_SW_FENCE_DEBUG_OBJECTS
        select DRM_I915_SELFTEST
@@ -227,11 +229,18 @@ config DRM_I915_DEBUG_VBLANK_EVADE
If in doubt, say "N". +config DRM_I915_TRACK_WAKEREF
+       depends on STACKDEPOT
+       depends on STACKTRACE
+       bool
+
  config DRM_I915_DEBUG_RUNTIME_PM
        bool "Enable extra state checking for runtime PM"
        depends on DRM_I915
        default n
        select STACKDEPOT
+       select STACKTRACE
+       select DRM_I915_TRACK_WAKEREF
        help
          Choose this option to turn on extra state checking for the
          runtime PM functionality. This may introduce overhead during
diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index b2f91a1f826858..42daff6d575a82 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -81,6 +81,10 @@ i915-$(CONFIG_DEBUG_FS) += \
        i915_debugfs_params.o \
        display/intel_display_debugfs.o \
        display/intel_pipe_crc.o
+
+i915-$(CONFIG_DRM_I915_TRACK_WAKEREF) += \
+       intel_wakeref_tracker.o
+

This patch, along with the previous one and two following it, is
a bit confusing. We add this file only to remove it later and
the code hops from file to file. There seem to be some extra
steps that could be avoided.

Is there room for simplification?

The reason behind this was that i915 had it's own tracker integrated with i915_runtime_pm, then it was abstracted out (05,06) to allow track gt->wakerefs (07) and then I proposed replacement of internal tracker with ref_tracker (09). I wanted to keep original history of development. I can squash all/some of this work, but I am afraid it will generate less readable patches - now we have separated abstract-out and replace steps.

Probably sending patches 05-08 1st, then proposing conversion to ref_tracker in another patchset would make it more clear.

Regards
Andrzej



Thanks,
Andi

Reply via email to