Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4858451imb; Thu, 7 Mar 2019 02:08:27 -0800 (PST) X-Google-Smtp-Source: APXvYqwLOtABSLakpFb9jby1v4w3ETVHlPPeTuZpxDW25REZUk+AzBWY1HpHCUxmYDOnkmvfGSml X-Received: by 2002:a17:902:8c95:: with SMTP id t21mr11755514plo.300.1551953307612; Thu, 07 Mar 2019 02:08:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551953307; cv=none; d=google.com; s=arc-20160816; b=mHfbu8hYeEijr5A+Y712oZjfK3NU8MqMB6TbZtbX9TfqWeM0yrYR1tDZf6qs1NSfcP bwklVqcd2rFM1Gw3+lnS/6Iaqv6s+cSLhzGjhcT6yKDD0vNrm1rOSlAEQCHawa1YrYFg eUzvqsivQo1Iw6wBA2P3j8PiJHAHn7OdyGlddytidZZCGbHEwwELWr/Ap2UHliS4TWxp gYVYqiGweE0s1rcD4Sl0KRJkjVHIrErVGsOMR2OXDtPn6ZYDSoETYIILKky05JWZT5kg FHdl4cACyirEm2nfPwGBoAcrDY4bHzyzLrXeiP/KRNSU5Y2LsTUlztGnWmdrgPj8yNKx 22Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=U6qNtgDXZ8mlUxOcJ1YElT/kbZceu8z3gteA9mToLeE=; b=RaNadnjyINyaBzVBQrofG3/OcQRI+3fN/GSJt7sp4wpVvMgRsPrXUp4EcpNdxYM/kh 7MRSny1y1fYn1NWbZtlLYWYNtluDHedKdbui/60m/qX2RyqiA5K1mLwCW0IE2FAZ6a8g QQqk7DLjV8TLr5jyEDM8CJQcyZsD++rEvY0JmX/a7N+TmuG5c9YPMo+PaqFf4bcY1qcc EAWgdh0xon2C7JxgfOGxYluytvMVQm7BlOEUAKStyPoVRqed5+VirQIelY+WTp56J76/ /w6K1GD5alwRMHpCbbkEI/J8vBtp0aultTRMJde/A+CXpLLJppHnp3miNQuFCW7EV4w/ M9zA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 70si4065856ple.294.2019.03.07.02.08.11; Thu, 07 Mar 2019 02:08:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726324AbfCGKGJ (ORCPT + 99 others); Thu, 7 Mar 2019 05:06:09 -0500 Received: from mx2.suse.de ([195.135.220.15]:42162 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726127AbfCGKGJ (ORCPT ); Thu, 7 Mar 2019 05:06:09 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 7F271ACC6; Thu, 7 Mar 2019 10:06:07 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id 4AC60E1175; Thu, 7 Mar 2019 11:06:05 +0100 (CET) Date: Thu, 7 Mar 2019 11:06:05 +0100 From: Michal Kubecek To: Arnd Bergmann Cc: "David S. Miller" , Florian Fainelli , Jakub Kicinski , Jiri Pirko , Nick Desaulniers , Kees Cook , Wenwen Wang , Ilya Lesokhin , Pablo Neira Ayuso , Edward Cree , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ethtool: reduce stack usage with clang Message-ID: <20190307100605.GA20309@unicorn.suse.cz> References: <20190307093408.3425010-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190307093408.3425010-1-arnd@arndb.de> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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