From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 3BAF82BE05F; Sat, 30 May 2026 16:12:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780157573; cv=none; b=UiyoUSKYLWq3IZU471CQ3r7R8QNPA88cF4SLTK1EIx3AblHdTZL5K8UvnJx8RNzDgdB6MDnbWZvZBuXsEFwRLwxhMY8QBiLdlDfWurTp1VmKUAVzqWtoiRUZT8bu08Vf3QRn3B96ZJGDkNo5yKWmAY1vnKylA0yPpw22aYViZpw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780157573; c=relaxed/simple; bh=FKCD1+iG2KV+VOvQFVATrcEFo0zee/qxgeWjeFcT6Ys=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DB+97MX6fEa7Cf/9hQJ4yO7a6Br8PMNN784K0nuz8ZviwGkrsuPmAFTd7HY/gjKsKi0FwWdUDYw858uKaHQqYFtBa+LMnZPTZV+sfsR1mix90e+SGAmXm/0Ae/DGbXlqnIUr6E6CXi8ODyEO9YEAz4uBRKCI7leMPqq9PvAdDZ0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=vyMYPts+; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="vyMYPts+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B2F41F00893; Sat, 30 May 2026 16:12:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780157571; bh=0hd2ERUNCH+SqOrXh8v/ZJOdb28L5j6+2b/TnFAZ5Qw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=vyMYPts+qs/fqhGJqhbtPv1OBMVZ+gTwP2/pAI5PUxv+5HBvEBgE+0NDC55jUuHWy sZbgsEb9RkIkIecGWPJGI370OaNf2nw1nT4PCmFdFEX6NRydCsnJG0uONIzxKAuTHn Ra42sbURLxMAQ7ssySp6+CcNbSGYrNdv/4/jxqEY= 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.1 003/969] media: rkvdec: reduce stack usage in rkvdec_init_v4l2_vp9_count_tbl() Date: Sat, 30 May 2026 17:52:07 +0200 Message-ID: <20260530160300.582578003@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160300.485627683@linuxfoundation.org> References: <20260530160300.485627683@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-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 cfae99b40ccb4..dc3e6354c7974 100644 --- a/drivers/staging/media/rkvdec/rkvdec-vp9.c +++ b/drivers/staging/media/rkvdec/rkvdec-vp9.c @@ -924,7 +924,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