|
| 1 | +From 8b55f8818900c99dd4f55a59a103f5b29e41eb2c Mon Sep 17 00:00:00 2001 |
| 2 | +From: Arnd Bergmann < [email protected]> |
| 3 | +Date: Fri, 18 Oct 2024 15:14:42 +0000 |
| 4 | +Subject: media: mediatek: vcodec: mark vdec_vp9_slice_map_counts_eob_coef |
| 5 | + noinline |
| 6 | + |
| 7 | +With KASAN enabled, clang fails to optimize the inline version of |
| 8 | +vdec_vp9_slice_map_counts_eob_coef() properly, leading to kilobytes |
| 9 | +of temporary values spilled to the stack: |
| 10 | + |
| 11 | +drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c:1526:12: error: stack frame size (2160) exceeds limit (2048) in 'vdec_vp9_slice_update_prob' [-Werror,-Wframe-larger-than] |
| 12 | + |
| 13 | +This seems to affect all versions of clang including the latest (clang-20), |
| 14 | +but the degree of stack overhead is different per release. |
| 15 | + |
| 16 | +Marking the function as noinline_for_stack is harmless here and avoids |
| 17 | +the problem completely. |
| 18 | + |
| 19 | +Signed-off-by: Arnd Bergmann < [email protected]> |
| 20 | +Reviewed-by: Nathan Chancellor < [email protected]> |
| 21 | +Signed-off-by: Sebastian Fricke < [email protected]> |
| 22 | +Signed-off-by: Mauro Carvalho Chehab < [email protected]> |
| 23 | +--- |
| 24 | +Link: https://git.linuxtv.org/media.git/commit/?id=8b55f8818900c99dd4f55a59a103f5b29e41eb2c |
| 25 | +--- |
| 26 | + .../media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c | 3 ++- |
| 27 | + 1 file changed, 2 insertions(+), 1 deletion(-) |
| 28 | + |
| 29 | +diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c |
| 30 | +index eea709d93820..47c302745c1d 100644 |
| 31 | +--- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c |
| 32 | ++++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c |
| 33 | +@@ -1188,7 +1188,8 @@ err: |
| 34 | + return ret; |
| 35 | + } |
| 36 | + |
| 37 | +-static |
| 38 | ++/* clang stack usage explodes if this is inlined */ |
| 39 | ++static noinline_for_stack |
| 40 | + void vdec_vp9_slice_map_counts_eob_coef(unsigned int i, unsigned int j, unsigned int k, |
| 41 | + struct vdec_vp9_slice_frame_counts *counts, |
| 42 | + struct v4l2_vp9_frame_symbol_counts *counts_helper) |
| 43 | +-- |
| 44 | +cgit v1.2.3 |
| 45 | + |
0 commit comments