[Intel-gfx] [PATCH 0/3] drm/i915/uncore: unclaimed reg debug race fix and optimization

Jani Nikula jani.nikula at intel.com
Tue Jul 4 10:02:05 UTC 2023


On Tue, 04 Jul 2023, Jani Nikula <jani.nikula at intel.com> wrote:
> Fix a race in unclaimed reg debug. This does increase the code size for
> CONFIG_DRM_I915_DEBUG_MMIO=y.
>
> However, also add an optimization to reduce code size for
> CONFIG_DRM_I915_DEBUG_MMIO=n.
>
> Do we care about the bloat for the debug config?
>
> Before/after for both CONFIG_DRM_I915_DEBUG_MMIO=y and =n.
>
>
> $ scripts/bloat-o-meter intel_uncore.before.with-debug.o intel_uncore.after.with-debug.o
> add/remove: 0/2 grow/shrink: 10/0 up/down: 927/-149 (778)
> Function                                     old     new   delta
> fwtable_read16                               721     821    +100
> fwtable_read32                               719     817     +98
> fwtable_read8                                722     818     +96
> fwtable_read64                               722     817     +95
> gen6_write16                                 679     772     +93
> gen6_write8                                  678     769     +91
> gen6_write32                                 677     768     +91
> fwtable_write16                              742     831     +89
> fwtable_write8                               741     828     +87
> fwtable_write32                              740     827     +87
> __pfx___unclaimed_reg_debug                   16       -     -16
> __unclaimed_reg_debug                        133       -    -133

Looking at the size decrease for __unclaimed_reg_debug(), it occurs to
me the compiler wasn't previously inlining unclaimed_reg_debug()
regardless of the inline keyword. It just bundled unclaimed_reg_debug()
together with __unclaimed_reg_debug(), and called it.

The juggling here actually makes them both inline, which presumably was
the original intention.

The optimization for CONFIG_DRM_I915_DEBUG_MMIO=n below is the good
stuff.

BR,
Jani.

> Total: Before=33797, After=34575, chg +2.30%
>
> $ scripts/bloat-o-meter intel_uncore.before.without-debug.o intel_uncore.after.without-debug.o
> add/remove: 0/2 grow/shrink: 0/10 up/down: 0/-2557 (-2557)
> Function                                     old     new   delta
> __pfx___unclaimed_reg_debug                   16       -     -16
> __unclaimed_reg_debug                        133       -    -133
> gen6_write8                                  678     446    -232
> gen6_write32                                 677     445    -232
> gen6_write16                                 679     447    -232
> fwtable_read64                               722     482    -240
> fwtable_read32                               719     479    -240
> fwtable_read16                               721     481    -240
> fwtable_read8                                722     480    -242
> fwtable_write8                               741     491    -250
> fwtable_write32                              740     490    -250
> fwtable_write16                              742     492    -250
> Total: Before=33797, After=31240, chg -7.57%
>
> Cc: Lee Shawn C <shawn.c.lee at intel.com>
>
> Jani Nikula (3):
>   drm/i915/uncore: split unclaimed_reg_debug() to header and footer
>   drm/i915/uncore: fix race around i915->params.mmio_debug
>   drm/i915/uncore: optimize CONFIG_DRM_I915_DEBUG_MMIO=n more
>
>  drivers/gpu/drm/i915/intel_uncore.c | 47 ++++++++++++++++++-----------
>  1 file changed, 29 insertions(+), 18 deletions(-)

-- 
Jani Nikula, Intel Open Source Graphics Center


More information about the Intel-gfx mailing list