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 EDA993D75C2; Fri, 24 Apr 2026 13:34:01 +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=1777037642; cv=none; b=cIGEYM8QzgAFIkqEeO/uFknOxl9jEO8CC8FvmhmBbcnattsxUrhSWXXRQevz6hDWizNKi/tRUKmv9fb19d1Lu4dI7V5x40qwUG6Q6hyugEMLv31i6a72LDWUDPsqQmdjP2FBLgnGu1m0FM02y17GGqGBJJV2xMM/3X4Vh8QP86g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777037642; c=relaxed/simple; bh=rIWRLxpy50MVvo5N0A8NzzTz+gn5PRI5Oh5OdZdPoBg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=if6IStn5gPyWNS27cmeP+c1JKEV02KjHvCOad4sM8RTNTrk7O7VG7yUIe/v1SU+P18AOy0NDE32JwkQ7oZpk4yTmCw0xKrw5xHmVkpwrYFShhq4jtpWeT1Lr+ijg0zc0JrqSp7WOzy8NnZBjTxWHDplrAmPFkyD3naDCNuzkEl0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=0Gf2/XvA; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="0Gf2/XvA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7836DC19425; Fri, 24 Apr 2026 13:34:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1777037641; bh=rIWRLxpy50MVvo5N0A8NzzTz+gn5PRI5Oh5OdZdPoBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0Gf2/XvAucGwWcwTTai7k14lSkK6qv7r5og2KxL3ueidFyvXBvoIWee1aKAIPiGZJ vpdcGfod71viDDrC+Ybs5elINaVLNR+9ORmGd+5uUZ5Q/mrsIhzq4VDjI03mZueyoY 52fDNLezemA3NLxSX1C2ocdJssHZXn46jVnJ6ZDE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Arnd Bergmann , Nicolas Dufresne , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 6.6 005/166] media: rkvdec: reduce stack usage in rkvdec_init_v4l2_vp9_count_tbl() Date: Fri, 24 Apr 2026 15:28:39 +0200 Message-ID: <20260424132533.956267303@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260424132532.812258529@linuxfoundation.org> References: <20260424132532.812258529@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ 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 --- drivers/staging/media/rkvdec/rkvdec-vp9.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/rkvdec/rkvdec-vp9.c b/drivers/staging/media/rkvdec/rkvdec-vp9.c index 0e7e16f20eeb0..bc74d2d824ef2 100644 --- a/drivers/staging/media/rkvdec/rkvdec-vp9.c +++ b/drivers/staging/media/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