mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
To: Arnd Bergmann <arnd@kernel.org>,
	Detlev Casanova	 <detlev.casanova@collabora.com>,
	Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>,
	 Mauro Carvalho Chehab	 <mchehab@kernel.org>,
	Heiko Stuebner <heiko@sntech.de>,
	Nathan Chancellor	 <nathan@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Nick Desaulniers	 <nick.desaulniers+lkml@gmail.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	Hans Verkuil <hverkuil+cisco@kernel.org>,
	 linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
	 linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,  llvm@lists.linux.dev,
	Jonas Karlman <jonas@kwiboo.se>, Alex Bee	 <knaerzche@gmail.com>
Subject: Re: [PATCH 2/2] media: rkvdec: reduce stack usage in rkvdec_init_v4l2_vp9_count_tbl()
Date: Mon, 02 Feb 2026 11:32:16 -0500	[thread overview]
Message-ID: <ca81b8b03651cdb4f997c89fffd489407be59b8b.camel@collabora.com> (raw)
In-Reply-To: <20260202094804.1231706-2-arnd@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 1843 bytes --]

Le lundi 02 février 2026 à 10:47 +0100, Arnd Bergmann a écrit :
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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>

> ---
>  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 ba51a7c2fe55..1c875d5a2bac 100644
> --- a/drivers/media/platform/rockchip/rkvdec/rkvdec-vp9.c
> +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec-vp9.c
> @@ -893,7 +893,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;

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-02-02 16:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-02  9:47 [PATCH 1/2] media: rkvdec: reduce excessive stack usage in assemble_hw_pps() Arnd Bergmann
2026-02-02  9:47 ` [PATCH 2/2] media: rkvdec: reduce stack usage in rkvdec_init_v4l2_vp9_count_tbl() Arnd Bergmann
2026-02-02 16:32   ` Nicolas Dufresne [this message]
2026-02-02 13:42 ` [PATCH 1/2] media: rkvdec: reduce excessive stack usage in assemble_hw_pps() Nicolas Dufresne
2026-02-02 14:09   ` Arnd Bergmann
2026-02-02 15:12     ` Nicolas Dufresne
2026-02-02 15:59       ` Arnd Bergmann
2026-02-02 16:31         ` Nicolas Dufresne
2026-02-02 22:45         ` David Laight

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ca81b8b03651cdb4f997c89fffd489407be59b8b.camel@collabora.com \
    --to=nicolas.dufresne@collabora.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=detlev.casanova@collabora.com \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=heiko@sntech.de \
    --cc=hverkuil+cisco@kernel.org \
    --cc=jonas@kwiboo.se \
    --cc=justinstitt@google.com \
    --cc=knaerzche@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=llvm@lists.linux.dev \
    --cc=mchehab@kernel.org \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®