Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

media: rkvdec: reduce stack usage in rkvdec_init_v4l2_vp9_count_tbl()

The deeply nested loop in rkvdec_init_v4l2_vp9_count_tbl() needs a lot
of registers, so when the clang register allocator runs out, it ends up
spilling countless temporaries to the stack:

drivers/media/platform/rockchip/rkvdec/rkvdec-vp9.c:966:12: error: stack frame size (1472) exceeds limit (1280) in 'rkvdec_vp9_start' [-Werror,-Wframe-larger-than]

Marking this function as noinline_for_stack keeps it out of
rkvdec_vp9_start(), giving the compiler more room for optimization.

The resulting code is good enough that both the total stack usage
and the loop get enough better to stay under the warning limit,
though it's still slow, and would need a larger rework if this
function ends up being called in a fast path.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

authored by

Arnd Bergmann and committed by
Mauro Carvalho Chehab
c03b7dec 446c6a25

+2 -1
+2 -1
drivers/media/platform/rockchip/rkvdec/rkvdec-vp9.c
··· 893 893 update_ctx_last_info(vp9_ctx); 894 894 } 895 895 896 - static void rkvdec_init_v4l2_vp9_count_tbl(struct rkvdec_ctx *ctx) 896 + static noinline_for_stack void 897 + rkvdec_init_v4l2_vp9_count_tbl(struct rkvdec_ctx *ctx) 897 898 { 898 899 struct rkvdec_vp9_ctx *vp9_ctx = ctx->priv; 899 900 struct rkvdec_vp9_intra_frame_symbol_counts *intra_cnts = vp9_ctx->count_tbl.cpu;