public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Riyan Dhiman <riyandhiman14@gmail.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Paolo Perego <pperego@suse.de>,
	Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Jeff Johnson <jeff.johnson@oss.qualcomm.com>,
	dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fbtft: reduce stack usage
Date: Tue, 10 Jun 2025 13:26:39 +0300	[thread overview]
Message-ID: <aEgIX221QIt5k0zY@smile.fi.intel.com> (raw)
In-Reply-To: <20250610092445.2640575-1-arnd@kernel.org>

On Tue, Jun 10, 2025 at 11:24:38AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The use of vararg function pointers combined with a huge number of
> arguments causes some configurations to exceed the stack size warning
> limit:
> 
> drivers/staging/fbtft/fbtft-core.c:863:12: error: stack frame size (1512) exceeds limit (1280) in 'fbtft_init_display_from_property' [-Werror,-Wframe-larger-than]
> 
> drivers/staging/fbtft/fb_ssd1331.c:131:30: error: stack frame size (1392) exceeds limit (1280) in 'set_gamma' [-Werror,-Wframe-larger-than]
>                   ^
> drivers/staging/fbtft/fb_ssd1351.c:120:30: error: stack frame size (1392) exceeds limit (1280) in 'set_gamma' [-Werror,-Wframe-larger-than]
> 
> Move the varargs handling into a separate noinline function so each
> individual function stays below the limit. A better approach might be to
> replace the varargs function with one that takes an array of arguments,
> but that would be a much larger rework of the other callers.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

...

> +static noinline_for_stack void fbtft_write_register_64(struct fbtft_par *par,
> +							int i, int buf[64])

Perhaps int i, int buf[64] should be u32?

> +{
> +	par->fbtftops.write_register(par, i,
> +		buf[0], buf[1], buf[2], buf[3],
> +		buf[4], buf[5], buf[6], buf[7],
> +		buf[8], buf[9], buf[10], buf[11],
> +		buf[12], buf[13], buf[14], buf[15],
> +		buf[16], buf[17], buf[18], buf[19],
> +		buf[20], buf[21], buf[22], buf[23],
> +		buf[24], buf[25], buf[26], buf[27],
> +		buf[28], buf[29], buf[30], buf[31],
> +		buf[32], buf[33], buf[34], buf[35],
> +		buf[36], buf[37], buf[38], buf[39],
> +		buf[40], buf[41], buf[42], buf[43],
> +		buf[44], buf[45], buf[46], buf[47],
> +		buf[48], buf[49], buf[50], buf[51],
> +		buf[52], buf[53], buf[54], buf[55],
> +		buf[56], buf[57], buf[58], buf[59],
> +		buf[60], buf[61], buf[62], buf[63]);
> +}

Wondering if we may reuse this in other cases (by providing the additional
length parameter). But it may be done later on.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2025-06-10 10:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-10  9:24 [PATCH] fbtft: reduce stack usage Arnd Bergmann
2025-06-10 10:26 ` Andy Shevchenko [this message]
2025-06-10 10:35   ` Arnd Bergmann
2025-06-10 10:53     ` Andy Shevchenko

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=aEgIX221QIt5k0zY@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jeff.johnson@oss.qualcomm.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=pperego@suse.de \
    --cc=riyandhiman14@gmail.com \
    --cc=tzimmermann@suse.de \
    --cc=willy@infradead.org \
    /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