drm/selftest: plane_helper: Put test structures in static storage
Subsystems (2)
PATCH 1/1 drm/selftest: plane_helper: Put test structures in static storage
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.
--- drivers/gpu/drm/selftests/test-drm_plane_helper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/selftests/test-drm_plane_helper.c +4 -4
@@ -77,7 +77,7 @@ int igt_check_plane_state(void *ignored) {int ret; -const struct drm_crtc_state crtc_state = { +static const struct drm_crtc_state crtc_state = { .crtc =ZERO_SIZE_PTR , .enable = true, .active = true,
@@ -87,14 +87,14 @@ int igt_check_plane_state(void *ignored) DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, }; -struct drm_plane plane = { +static struct drm_plane plane = { .dev =NULL }; -struct drm_framebuffer fb = { +static struct drm_framebuffer fb = { .width =2048 , .height =2048 }; -struct drm_plane_state plane_state = { +static struct drm_plane_state plane_state = { .plane = &plane, .crtc =ZERO_SIZE_PTR , .fb = &fb,
base-commit: 9ae2ac4d31a85ce59cc560d514a31b95f4ace154
Signature · 1 line
2.35.1
Quoted 16 lines · Nathan Chancellor
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] intigt_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, asigt_check_plane_state()is only called once in the driver.
Quoted 5 lines
Fixes 943e6a8beeac ("mock a drm_plane in igt_check_plane_state to make the test more robust")Reported-by kernel test robot <[email protected]>Suggested-by Nick Desaulniers <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>
Thanks for the patch!
Quoted 40 lines
--- drivers/gpu/drm/selftests/test-drm_plane_helper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/selftests/test-drm_plane_helper.c +4
-4@@ -77,7 +77,7 @@ int igt_check_plane_state(void *ignored) {int ret; -const struct drm_crtc_state crtc_state = { +static const struct drm_crtc_state crtc_state = { .crtc =ZERO_SIZE_PTR , .enable = true, .active = true,@@ -87,14 +87,14 @@ int igt_check_plane_state(void *ignored) DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, }; -struct drm_plane plane = { +static struct drm_plane plane = { .dev =NULL }; -struct drm_framebuffer fb = { +static struct drm_framebuffer fb = { .width =2048 , .height =2048 }; -struct drm_plane_state plane_state = { +static struct drm_plane_state plane_state = { .plane = &plane, .crtc =ZERO_SIZE_PTR , .fb = &fb,base-commit:
9ae2ac4d31a85ce59cc560d514a31b95f4ace154--
2.35.1
Signature · 2 lines
Thanks, ~Nick Desaulniers
Ping, could someone review and/or pick this up? This is going to break a few builds with CONFIG_WERROR, it would be nice to have it in drm-misc-next-fixes, as the commit it is fixing is in drm-misc-next.
Cheers,
Nathan
Quoted 61 lines · Nathan Chancellor
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] intigt_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, asigt_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")Reported-by kernel test robot <[email protected]>Suggested-by Nick Desaulniers <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>--- drivers/gpu/drm/selftests/test-drm_plane_helper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/selftests/test-drm_plane_helper.c +4
-4@@ -77,7 +77,7 @@ int igt_check_plane_state(void *ignored) {int ret; -const struct drm_crtc_state crtc_state = { +static const struct drm_crtc_state crtc_state = { .crtc =ZERO_SIZE_PTR , .enable = true, .active = true,@@ -87,14 +87,14 @@ int igt_check_plane_state(void *ignored) DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, }; -struct drm_plane plane = { +static struct drm_plane plane = { .dev =NULL }; -struct drm_framebuffer fb = { +static struct drm_framebuffer fb = { .width =2048 , .height =2048 }; -struct drm_plane_state plane_state = { +static struct drm_plane_state plane_state = { .plane = &plane, .crtc =ZERO_SIZE_PTR , .fb = &fb,base-commit:
9ae2ac4d31a85ce59cc560d514a31b95f4ace154Signature · 1 line
2.35.1
Maxime Ripard
AppliedRe: (subset) [PATCH] drm/selftest: plane_helper: Put test structures in static storage
In reply to Nathan ChancellorQuoted 8 lines · Nathan Chancellor
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] intigt_check_plane_state(void *ignored)^1 warning generated.
[...]
Applied to drm/drm-misc (drm-misc-next-fixes).
Thanks!
Maxime
Quoted 15 lines · Nathan Chancellor
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] intigt_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, asigt_check_plane_state()is only called once in the driver.
Quoted 6 lines
Fixes 943e6a8beeac ("mock a drm_plane in igt_check_plane_state to make the test more robust")Reported-by kernel test robot <[email protected]>Suggested-by Nick Desaulniers <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>Reviewed-by Nick Desaulniers <[email protected]>
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