From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4480947DF81; Mon, 20 Apr 2026 13:31:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776691868; cv=none; b=mmCiE/f/fz6VA2IHuU6rSg1FX5YnSGluIELNZCMcMoNn3iZbRepKGsSwDZTdmckSOQnryX4HBH0uPXmd1cCmyCM/8viu+ZT+rerA7z+P8B4PZHqzbW/SPKxTtkwjQqGowAJMjq8GY+kbd+ZLVcMyeyPqVnf1bm+97mpakUGEwOY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776691868; c=relaxed/simple; bh=AihTpc5zkJtlqLbw58hois0YKMIhUHFtmGkHGFinRlA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fLvvGlE2UDBd4HXqtCahB9Cj2NNlcwZOtg8ItIadvMFBsXeh6knN7911riKoBsnNsQOy+c6ToSQkmXlEk3jy1uHq1SbzxBCZ+A4iFYbDO2E/nAkdl6i/3sLo3nf/ekBm921IxGcD2Ql/2uuZl7Zlbr5ufo+6QU7Ze/hhmOGBiso= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DXlSNuOk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DXlSNuOk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF8A3C19425; Mon, 20 Apr 2026 13:31:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776691868; bh=AihTpc5zkJtlqLbw58hois0YKMIhUHFtmGkHGFinRlA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DXlSNuOkX1E6prdpOYzQjYgLYfzSipVs1hPKxKj1J7WZBU6ulLFt+8aqJQqBAylOr WGtKChpLkxzq7MgWpccH08Tho5rKsEKwQu2J0WmxcvBorGinm41LGG1PvcQriwSMAS shoTLfqy3EZaBkzydWKTJKml+4jE59hME/EYdR+Xg+MqxB56EaAh5x/a+UAyyM1fvL v+Yb46P9ugG7hW3PyJq4izHqN7du9YZUwY9p9pLkQg0Ce3EP/CnG9rbwCRYZDUpR7j 9McXDbJ3cIjo8xfMK9nnP5f4G0WmpNE1dsMF3BUOSTJ6RFjcLuf24QGGf00xR+zmS9 9eopClbdSIvEg== From: Sasha Levin To: patches@lists.linux.dev, stable@vger.kernel.org Cc: Arnd Bergmann , Nicolas Dufresne , Mauro Carvalho Chehab , Sasha Levin , detlev.casanova@collabora.com, ezequiel@vanguardiasur.com.ar, mchehab@kernel.org, heiko@sntech.de, linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH AUTOSEL 6.18] media: rkvdec: reduce stack usage in rkvdec_init_v4l2_vp9_count_tbl() Date: Mon, 20 Apr 2026 09:20:35 -0400 Message-ID: <20260420132314.1023554-241-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260420132314.1023554-1-sashal@kernel.org> References: <20260420132314.1023554-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.18.23 Content-Transfer-Encoding: 8bit From: Arnd Bergmann [ Upstream commit c03b7dec3c4ddc97872fa12bfca75bae9cb46510 ] 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 Reviewed-by: Nicolas Dufresne Signed-off-by: Nicolas Dufresne Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- LLM Generated explanations, may be completely bogus: Error: Failed to generate final synthesis drivers/media/platform/rockchip/rkvdec/rkvdec-vp9.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec-vp9.c b/drivers/media/platform/rockchip/rkvdec/rkvdec-vp9.c index 0e7e16f20eeb0..bc74d2d824ef2 100644 --- a/drivers/media/platform/rockchip/rkvdec/rkvdec-vp9.c +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec-vp9.c @@ -923,7 +923,8 @@ static void rkvdec_vp9_done(struct rkvdec_ctx *ctx, update_ctx_last_info(vp9_ctx); } -static void rkvdec_init_v4l2_vp9_count_tbl(struct rkvdec_ctx *ctx) +static noinline_for_stack void +rkvdec_init_v4l2_vp9_count_tbl(struct rkvdec_ctx *ctx) { struct rkvdec_vp9_ctx *vp9_ctx = ctx->priv; struct rkvdec_vp9_intra_frame_symbol_counts *intra_cnts = vp9_ctx->count_tbl.cpu; -- 2.53.0