Skip to content
Unverified Commit c3711610 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Rodrigo Vivi
Browse files

drm/i915: reduce stack usage in igt_vma_pin1()



The igt_vma_pin1() function has a rather high stack usage, which gets
in the way of reducing the default warning limit:

In file included from drivers/gpu/drm/i915/i915_vma.c:2285:
drivers/gpu/drm/i915/selftests/i915_vma.c:257:12: error: stack frame size (1288) exceeds limit (1280) in 'igt_vma_pin1' [-Werror,-Wframe-larger-than]

There are two things going on here:

 - The on-stack modes[] array is really large itself and gets constructed
   for every call, using around 1000 bytes itself depending on the configuration.

 - The call to i915_vma_pin() gets inlined and adds another 200 bytes for
   the i915_gem_ww_ctx structure since commit 7d1c2618 ("drm/i915: Take
   reservation lock around i915_vma_pin.")

The second one is easy enough to change, by moving the function into the
appropriate .c file. Since it is already large enough to not always be
inlined, this seems like a good idea regardless, reducing both the code size
and the internal stack usage of each of its 67 callers.

Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20250620113644.3844552-1-arnd@kernel.org


Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent ef69f9dd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment