[PATCH] drm/selftest: plane_helper: Put test structures in static storage

Guenter Roeck linux at roeck-us.net
Fri Mar 25 18:30:31 UTC 2022


On Wed, Mar 02, 2022 at 04:59:09PM -0700, Nathan Chancellor wrote:
> Clang warns on certain 32-bit architectures:
> 
>   drivers/gpu/drm/selftests/test-drm_plane_helper.c:76:5: warning: stack frame size (1064) exceeds limit (1024) in 'igt_check_plane_state' [-Wframe-larger-than]
>   int igt_check_plane_state(void *ignored)
>       ^
>   1 warning generated.
> 
> The structures in igt_check_plane_state() total 1008 bytes, so any small
> amount of inlining will cause the stack frame to exceed the 32-bit limit
> of 1024, triggering the warning.
> 
> Move these structures to static storage, which dramatically reduces the
> amount of stack space in igt_check_plane_state(). There is no testing
> impact, as igt_check_plane_state() is only called once in the driver.
> 
> Fixes: 943e6a8beeac ("mock a drm_plane in igt_check_plane_state to make the test more robust")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1600
> Reported-by: kernel test robot <lkp at intel.com>
> Suggested-by: Nick Desaulniers <ndesaulniers at google.com>
> Signed-off-by: Nathan Chancellor <nathan at kernel.org>
> Reviewed-by: Nick Desaulniers <ndesaulniers at google.com>

Tested-by: Guenter Roeck <linux at roeck-us.net>

Note that the offending patch is now in mainline and results in test build
failures there.

Building csky:allmodconfig ... failed
--------------
Error log:
drivers/gpu/drm/selftests/test-drm_plane_helper.c: In function 'igt_check_plane_state':
drivers/gpu/drm/selftests/test-drm_plane_helper.c:223:1: error: the frame size of 1072 bytes is larger than 1024 bytes

This is with gcc 11.2.

Guenter


More information about the dri-devel mailing list