]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/i915: reduce stack usage in igt_vma_pin1()
authorArnd Bergmann <arnd@arndb.de>
Fri, 20 Jun 2025 11:36:38 +0000 (13:36 +0200)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Tue, 24 Jun 2025 21:23:02 +0000 (17:23 -0400)
commitc371161086153623796dff9de713e98c47f4c586
tree0efa3c55768b28049ec2303bfe858d25993c7c3e
parentef69f9dd1cd7301cdf04ba326ed28152a3affcf6
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 7d1c2618eac5 ("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: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20250620113644.3844552-1-arnd@kernel.org
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/i915/i915_vma.c
drivers/gpu/drm/i915/i915_vma.h