[Intel-gfx] [PATCH 00/22] .rodata diet
Tvrtko Ursulin
tursulin at ursulin.net
Wed Oct 5 12:33:27 UTC 2016
From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Dynamic typing in __I915__ (INTEL_INFO) has and unfortuante consequence that
for every time it is called under a WARN it generates a very verbose string
placed into the appropriate .rodata section.
Each instance of that can can several hundred bytes to the binary. One example
of such strings found in the binary, not word-wrapped is:
WARN_ON(!((&({ struct drm_i915_private *__p; if (__builtin_types_compatible_p(typeof(*dev_priv), struct drm_i915_private)) __p = (struct drm_i915_private *)dev_priv; else if (__builtin_types_compatible_p(typeof(*dev_priv), struct drm_device)) __p = to_i915((struct drm_device *)dev_priv); else do { bool __cond = !(!(1)); extern void __compiletime_assert_1912(void) __attribute__((error("BUILD_BUG failed"))); if (__cond) __compiletime_assert_1912(); do { } while (0); } while (0); __p; })->info)->has_ddi) && (control & (0xffff << 16)) != (0xabcd << 16))
If we gradually remove dynamic typing abilities from individual macros we can
start bringing the size of the binary down.
For example after this series:
text data bss dec hex filename
1067727 23256 576 1091559 10a7e7 i915.ko.nightly
1038202 23256 576 1062034 103492 i915.ko.diet
Which is a ~29KiB saving.
This is disruptive of course, but perhaps it is time to bite the bullet since we
now have a situation that even new platforms like Kabylake are adding code which
uses the wrong thing in those macros (dev instead of dev_priv).
The way I have done it here makes it impossible to use the converted macros in
a wrong way going forward.
P.S. Series starts with three diffrent type of .rodata shrinkage patches. I was
just lazy to split that up.
Tvrtko Ursulin (22):
drm/i915: Shrink cxsr_latency_table
drm/i915: Shrink sdvo_cmd_names
drm/i915: Shrink per-platform watermark configuration
drm/i915: Make HAS_DDI and HAS_PCH_LPT_LP only take dev_priv
drm/i915: Make INTEL_PCH_TYPE & co only take dev_priv
drm/i915: Make HAS_GMCH_DISPLAY only take dev_priv
drm/i915: Make HAS_RUNTIME_PM only take dev_priv
drm/i915: Do not use INTEL_INFO(dev_priv)->ring_mask inside WARNs
drm/i915: Make IS_GEN-range macro only take dev_priv
drm/i915: Make INTEL_DEVID only take dev_priv
drm/i915: Make IS_IVYBRIDGE only take dev_priv
drm/i915: Make IS_BROADWELL only take dev_priv
drm/i915: Make IS_HASWELL only take dev_priv
drm/i915: Make IS_KABYLAKE only take dev_priv
drm/i915: Make IS_SKYLAKE only take dev_priv
drm/i915: Make IS_BROXTON only take dev_priv
drm/i915: Make HAS_L3_DPF only take dev_priv
drm/i915: Make IS_G4X only take dev_priv
drm/i915: Make IS_CHERRYVIEW only take dev_priv
drm/i915: Make IS_VALLEYVIEW only take dev_priv
drm/i915: Make INTEL_GEN only take dev_priv
drm/i915: Make IS_GEN macros only take dev_priv
drivers/gpu/drm/i915/i915_debugfs.c | 4 +-
drivers/gpu/drm/i915/i915_drv.c | 63 ++--
drivers/gpu/drm/i915/i915_drv.h | 198 ++++++-------
drivers/gpu/drm/i915/i915_gem.c | 55 ++--
drivers/gpu/drm/i915/i915_gem_context.c | 2 +-
drivers/gpu/drm/i915/i915_gem_execbuffer.c | 4 +-
drivers/gpu/drm/i915/i915_gem_fence.c | 11 +-
drivers/gpu/drm/i915/i915_gem_gtt.c | 60 ++--
drivers/gpu/drm/i915/i915_gem_render_state.c | 6 +-
drivers/gpu/drm/i915/i915_gem_stolen.c | 17 +-
drivers/gpu/drm/i915/i915_gem_tiling.c | 7 +-
drivers/gpu/drm/i915/i915_gpu_error.c | 18 +-
drivers/gpu/drm/i915/i915_irq.c | 34 +--
drivers/gpu/drm/i915/i915_reg.h | 4 +-
drivers/gpu/drm/i915/i915_suspend.c | 8 +-
drivers/gpu/drm/i915/intel_audio.c | 6 +-
drivers/gpu/drm/i915/intel_color.c | 16 +-
drivers/gpu/drm/i915/intel_crt.c | 53 ++--
drivers/gpu/drm/i915/intel_ddi.c | 22 +-
drivers/gpu/drm/i915/intel_display.c | 416 ++++++++++++++-------------
drivers/gpu/drm/i915/intel_dp.c | 165 +++++------
drivers/gpu/drm/i915/intel_dpll_mgr.c | 10 +-
drivers/gpu/drm/i915/intel_drv.h | 28 +-
drivers/gpu/drm/i915/intel_dsi.c | 37 ++-
drivers/gpu/drm/i915/intel_dsi_pll.c | 26 +-
drivers/gpu/drm/i915/intel_engine_cs.c | 7 +-
drivers/gpu/drm/i915/intel_fifo_underrun.c | 8 +-
drivers/gpu/drm/i915/intel_guc_loader.c | 15 +-
drivers/gpu/drm/i915/intel_hdmi.c | 58 ++--
drivers/gpu/drm/i915/intel_i2c.c | 9 +-
drivers/gpu/drm/i915/intel_lvds.c | 29 +-
drivers/gpu/drm/i915/intel_pm.c | 166 +++++------
drivers/gpu/drm/i915/intel_psr.c | 22 +-
drivers/gpu/drm/i915/intel_runtime_pm.c | 15 +-
drivers/gpu/drm/i915/intel_sdvo.c | 25 +-
drivers/gpu/drm/i915/intel_sprite.c | 30 +-
drivers/gpu/drm/i915/intel_tv.c | 4 +-
37 files changed, 851 insertions(+), 807 deletions(-)
--
2.7.4
More information about the Intel-gfx
mailing list