[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190307100605.GA20309@unicorn.suse.cz>
Date: Thu, 7 Mar 2019 11:06:05 +0100
From: Michal Kubecek <mkubecek@...e.cz>
To: Arnd Bergmann <arnd@...db.de>
Cc: "David S. Miller" <davem@...emloft.net>,
Florian Fainelli <f.fainelli@...il.com>,
Jakub Kicinski <jakub.kicinski@...ronome.com>,
Jiri Pirko <jiri@...lanox.com>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Kees Cook <keescook@...omium.org>,
Wenwen Wang <wang6495@....edu>,
Ilya Lesokhin <ilyal@...lanox.com>,
Pablo Neira Ayuso <pablo@...filter.org>,
Edward Cree <ecree@...arflare.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ethtool: reduce stack usage with clang
On Thu, Mar 07, 2019 at 10:33:35AM +0100, Arnd Bergmann wrote:
> clang inlines the dev_ethtool() more aggressively than gcc does, leading
> to a larger amount of used stack space:
>
> net/core/ethtool.c:2536:24: error: stack frame size of 1216 bytes in function 'dev_ethtool' [-Werror,-Wframe-larger-than=]
>
> Marking the sub-functions that require the most stack space as
> noinline_for_stack gives us reasonable behavior on all compilers.
>
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
> net/core/ethtool.c | 18 ++++++++++--------
> 1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/net/core/ethtool.c b/net/core/ethtool.c
> index d4918ffddda8..fcbed78172a0 100644
> --- a/net/core/ethtool.c
> +++ b/net/core/ethtool.c
...
> @@ -2533,7 +2535,7 @@ static int ethtool_set_fecparam(struct net_device *dev, void __user *useraddr)
>
> /* The main entry point in this file. Called from net/core/dev_ioctl.c */
>
> -int dev_ethtool(struct net *net, struct ifreq *ifr)
> +int noinline_for_stack dev_ethtool(struct net *net, struct ifreq *ifr)
> {
> struct net_device *dev = __dev_get_by_name(net, ifr->ifr_name);
> void __user *useraddr = ifr->ifr_data;
Is this part really needed? AFAICS dev_ethtool() is only called from
dev_ioctl() which is in a different compilation unit so that
dev_ethtool() won't be inlined anyway.
Michal Kubecek
Powered by blists - more mailing lists