[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <22ee464b-f59a-69a3-b669-f821d567fbf5@ti.com>
Date: Wed, 29 Apr 2020 10:56:19 +0300
From: Tomi Valkeinen <tomi.valkeinen@...com>
To: Arnd Bergmann <arnd@...db.de>, Andrzej Hajda <a.hajda@...sung.com>,
Neil Armstrong <narmstrong@...libre.com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Peter Ujfalusi <peter.ujfalusi@...com>
CC: Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
Jonas Karlman <jonas@...boo.se>,
Jernej Skrabec <jernej.skrabec@...l.net>,
Boris Brezillon <boris.brezillon@...labora.com>,
Sebastian Reichel <sebastian.reichel@...labora.com>,
<dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drm/bridge: fix stack usage warning on old gcc
On 29/04/2020 00:53, Arnd Bergmann wrote:
> Some older versions of gcc badly optimize code that passes
> an inline function argument into another function by reference,
> causing huge stack usage:
>
> drivers/gpu/drm/bridge/tc358768.c: In function 'tc358768_bridge_pre_enable':
> drivers/gpu/drm/bridge/tc358768.c:840:1: error: the frame size of 2256 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
>
> Use a temporary variable as a workaround and add a comment pointing
> to the gcc bug.
>
> Fixes: ff1ca6397b1d ("drm/bridge: Add tc358768 driver")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
> drivers/gpu/drm/bridge/tc358768.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/tc358768.c b/drivers/gpu/drm/bridge/tc358768.c
> index 1b39e8d37834..6650fe4cfc20 100644
> --- a/drivers/gpu/drm/bridge/tc358768.c
> +++ b/drivers/gpu/drm/bridge/tc358768.c
> @@ -178,6 +178,8 @@ static int tc358768_clear_error(struct tc358768_priv *priv)
>
> static void tc358768_write(struct tc358768_priv *priv, u32 reg, u32 val)
> {
> + /* work around https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81715 */
> + int tmpval = val;
> size_t count = 2;
>
> if (priv->error)
> @@ -187,7 +189,7 @@ static void tc358768_write(struct tc358768_priv *priv, u32 reg, u32 val)
> if (reg < 0x100 || reg >= 0x600)
> count = 1;
>
> - priv->error = regmap_bulk_write(priv->regmap, reg, &val, count);
> + priv->error = regmap_bulk_write(priv->regmap, reg, &tmpval, count);
> }
>
> static void tc358768_read(struct tc358768_priv *priv, u32 reg, u32 *val)
>
tc358768_write is not inline. What is the inline function here? Or is tc358768_write optimized to
inline by the compiler?
Tomi
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Powered by blists - more mailing lists