[PATCH] i915: increase frame warning limit in intel_workaround when using KASAN or KCSAN

flyingpenghao at gmail.com flyingpenghao at gmail.com
Thu Jun 13 02:23:43 UTC 2024


From: Peng Hao <flyingpeng at tencent.com>

When building kernel with clang, which will typically
have sanitizers enabled, there is a warning about a large stack frame.

drivers/gpu/drm/i915/gt/intel_workarounds.c:3044:6: error: stack frame size (5176)
exceeds limit (2048) in 'intel_engine_init_workarounds' [-Werror,-Wframe-larger-than]
void intel_engine_init_workarounds(struct intel_engine_cs *engine)
     ^
128/5176 (2.47%) spills, 5048/5176 (97.53%) variables

so increase the limit for configurations that have KASAN or KCSAN enabled for not
breaking the majority of builds.

Signed-off-by: Peng Hao <flyingpeng at tencent.com>
---
 drivers/gpu/drm/i915/Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index fba73c38e235..884e2f010bdd 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -36,7 +36,11 @@ subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror
 CFLAGS_i915_pci.o = -Wno-override-init
 CFLAGS_display/intel_display_device.o = -Wno-override-init
 CFLAGS_display/intel_fbdev.o = -Wno-override-init
-
+ifneq ($(CONFIG_FRAME_WARN),0)
+ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)
+CFLAGS_gt/intel_workarounds.o = -Wframe-larger-than=5272
+endif
+endif
 # Support compiling the display code separately for both i915 and xe
 # drivers. Define I915 when building i915.
 subdir-ccflags-y += -DI915
-- 
2.27.0



More information about the dri-devel mailing list