[Intel-gfx] [PATCH 10/39] drm/i915: Syntatic sugar for using intel_runtime_pm

Chris Wilson chris at chris-wilson.co.uk
Thu Jan 3 10:35:36 UTC 2019


Quoting Jani Nikula (2019-01-03 09:48:46)
> On Wed, 02 Jan 2019, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> > Frequently, we use intel_runtime_pm_get/_put around a small block.
> > Formalise that usage by providing a macro to define such a block with an
> > automatic closure to scope the intel_runtime_pm wakeref to that block,
> > i.e. macro abuse smelling of python.
> 
> I'm divided on this one. I'm not known to shy away from macro
> abuse... It does add yet another i915-ism to the learning curve. And you
> seem to have to add some variable initializations because the compiler
> is no longer able to figure it all out itself. What does this do to code
> size?

Honestly, it's not kind to the compiler. But I found the with() {} a
reasonable improvement to keep persisting with looking for a second
opinion.

add/remove: 0/0 grow/shrink: 32/5 up/down: 626/-165 (461)
Function                                     old     new   delta
check_whitelist_across_reset                 729     791     +62
igt_mmap_offset_exhaustion                  1070    1122     +52
i915_sseu_status                            1102    1137     +35
...
igt_ctx_exec.cold                            355     354      -1
i915_gem_shrinker_scan                       332     329      -3
guc_log_capture_logs                        1172    1169      -3
i915_energy_uJ                               289     266     -23
gen8_ppgtt_insert_4lvl                      2678    2543    -135
Total: Before=1885408, After=1885869, chg +0.02%

I am not even going to ask why the compiler changed its mind over
gen8_ppgtt_insert_4lvl when it doesn't even use the macro.
-Chris


More information about the Intel-gfx mailing list