Skip to content

Commit

Permalink
drm/tests: reduce drm_mm_test stack usage
Browse files Browse the repository at this point in the history
The check_reserve_boundaries function uses a lot of kernel stack,
and it gets inlined by clang, which makes __drm_test_mm_reserve
use even more of it, to the point of hitting the warning limit:

drivers/gpu/drm/tests/drm_mm_test.c:344:12: error: stack frame size (1048) exceeds limit (1024) in '__drm_test_mm_reserve' [-Werror,-Wframe-larger-than]

When building with gcc, this does not happen, but the structleak
plugin can similarly increase the stack usage and needs to be
disabled, as we do for all other kunit users.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Maíra Canal <mcanal@igalia.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Maíra Canal <mairacanal@riseup.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20221215163511.266214-1-arnd@kernel.org
  • Loading branch information
Arnd Bergmann authored and Maíra Canal committed Dec 23, 2022
1 parent b02897e commit 523dfa9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions drivers/gpu/drm/tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ obj-$(CONFIG_DRM_KUNIT_TEST) += \
drm_mm_test.o \
drm_plane_helper_test.o \
drm_rect_test.o

CFLAGS_drm_mm_test.o := $(DISABLE_STRUCTLEAK_PLUGIN)
6 changes: 3 additions & 3 deletions drivers/gpu/drm/tests/drm_mm_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,9 @@ static bool expect_reserve_fail(struct kunit *test, struct drm_mm *mm, struct dr
return false;
}

static bool check_reserve_boundaries(struct kunit *test, struct drm_mm *mm,
unsigned int count,
u64 size)
static bool noinline_for_stack check_reserve_boundaries(struct kunit *test, struct drm_mm *mm,
unsigned int count,
u64 size)
{
const struct boundary {
u64 start, size;
Expand Down

0 comments on commit 523dfa9

Please sign in to comment.