Archive-only list for patches
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>
Cc: Nick Desaulniers <ndesaulniers@google.com>,
	Claudio Suarez <cssk@net-c.es>,
	dri-devel@lists.freedesktop.org, llvm@lists.linux.dev,
	patches@lists.linux.dev, Nathan Chancellor <nathan@kernel.org>,
	kernel test robot <lkp@intel.com>
Subject: [PATCH] drm/selftest: plane_helper: Put test structures in static storage
Date: Wed,  2 Mar 2022 16:59:09 -0700	[thread overview]
Message-ID: <20220302235909.784935-1-nathan@kernel.org> (raw)

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@intel.com>
Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 drivers/gpu/drm/selftests/test-drm_plane_helper.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/selftests/test-drm_plane_helper.c b/drivers/gpu/drm/selftests/test-drm_plane_helper.c
index ceebeede55ea..b61273e9c403 100644
--- a/drivers/gpu/drm/selftests/test-drm_plane_helper.c
+++ b/drivers/gpu/drm/selftests/test-drm_plane_helper.c
@@ -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


             reply	other threads:[~2022-03-03  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-02 23:59 Nathan Chancellor [this message]
2022-03-08 22:47 ` [PATCH] drm/selftest: plane_helper: Put test structures in static storage Nick Desaulniers
2022-03-18 17:11 ` Nathan Chancellor
2022-03-21 10:08 ` (subset) " Maxime Ripard
2022-03-25 18:30 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220302235909.784935-1-nathan@kernel.org \
    --to=nathan@kernel.org \
    --cc=airlied@linux.ie \
    --cc=cssk@net-c.es \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=ndesaulniers@google.com \
    --cc=patches@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox