Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5368633imb; Thu, 7 Mar 2019 14:04:40 -0800 (PST) X-Google-Smtp-Source: APXvYqzUeAq1f0nxylKdK6xl3x0GRQXmr1SianOrUYH510HEs4PYjR7Upi4ci56SnXUDBX2BKSid X-Received: by 2002:aa7:8c4d:: with SMTP id e13mr15134776pfd.53.1551996280464; Thu, 07 Mar 2019 14:04:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551996280; cv=none; d=google.com; s=arc-20160816; b=a+N/rpPYJBrZ8zIn/AA2V8AtJxdYr9X6HdZ1DBU7eSSMspjl4lFjnj4qrPrPYF97mP scLmDtSYYhuMRaKTHcSqvnCpdl/ScjBG+sivsedwXq1ikq8JhsIkzzeetWlVqaqd2suZ KAetPTefnHTr1NaAs09ePGDzKzHBDGlbdyVVJjtJLbUohNYdoMnHAKBOjdvMOV56PtEY ZaQE04kMDmzl5NRkZTj1aVKYAhaO43sHQqhqdR9+pYNUSriXV17YDUcQxGV2HeQ0Kh54 nXfpNAtPQH7udGVm39H1o2e55Mij1GDAn1Ajf2Cq1B1hCYcvDJdl85uBKHnOsIlQHQRO r3tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=umZpGxIUGsQMJuR46UExM++Jzi2x8tjM5mlu9y31iZ4=; b=xUPEGtisURKuoAODAtV5hjg3rGHM60tE9iuZe2zpC3suGfDR4DwXEA8hkmnZBZzSrU X514CpKLpEpb6pOLJkX5E3qAL2UQ3m8HkXHYU1EOr3FZnoq2b+FWic2sGy6pC+CaYDV0 5b7UR3ABNusioBZvjBuhb5r/QnnAe5bbMRoVDMyOA1SPx2vk5mn3KhilhdEGi2ZJkygN 6CEwdYgkUXZiYM7xyNUXT9QI+3jUzdNUlIdoqq/upsSYVaAt7OBn6rNqK0W+y/Caugll DwrkrJbVkqFQzJQMdPzltNhHa5AbrX0j0Yc1qkN845G7YMtGX+5p/IkJNa+KhJLZIiTF /glQ== 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 r12si4648619pgv.293.2019.03.07.14.04.24; Thu, 07 Mar 2019 14:04:40 -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 S1726283AbfCGWED (ORCPT + 99 others); Thu, 7 Mar 2019 17:04:03 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:36007 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726224AbfCGWEC (ORCPT ); Thu, 7 Mar 2019 17:04:02 -0500 Received: by mail-qt1-f195.google.com with SMTP id p25so19074762qtb.3; Thu, 07 Mar 2019 14:04:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=umZpGxIUGsQMJuR46UExM++Jzi2x8tjM5mlu9y31iZ4=; b=icrsJCUN6Te11VWe1duFjHq0x5tzlTQMelN075UnbCk8tx0Xx/s/3jK3aFxPTXTPEk pcjR8e7jNmRjDMwzw63piHho0ykPjP3vu+7vjQOW6v4sXH7DKd4Kz6+6MHiD7EMNRSTY r0M0Q3OXQ4KZcmnxnoyNzfLn36HJI0R+Fy7y9Tbi0EuEkWuE0yurcLjjhS8baS51vcQc +/XegLgsphQMHa5COPBlghVuqi6eH4Nj/zynbvHpP2zdHMOyIZ+hlfRC25QS/mIB3l6C 8m+f/fvhEkuSdPQpkkwuc/rf5fO6qrn9ZaSXYviBLXpQka+tNNqWoBvYgtbdFxbtDNdR RajA== X-Gm-Message-State: APjAAAWG9/Stzgs40NGeX+rRTX2SQCe0l4rpPwayV+CJuE9THHK7pOnV 7bhUdnq1V/7JiQckwOS5+D1QzH+jrBu9KyFsG1X122cV X-Received: by 2002:ac8:33f1:: with SMTP id d46mr11997576qtb.319.1551996241725; Thu, 07 Mar 2019 14:04:01 -0800 (PST) MIME-Version: 1.0 References: <20190307160017.3120362-1-arnd@arndb.de> <20190307.094600.334828809875646248.davem@davemloft.net> In-Reply-To: <20190307.094600.334828809875646248.davem@davemloft.net> From: Arnd Bergmann Date: Thu, 7 Mar 2019 23:03:44 +0100 Message-ID: Subject: Re: [PATCH] [v2] ethtool: reduce stack usage with clang To: David Miller Cc: Florian Fainelli , Jakub Kicinski , Jiri Pirko , Wenwen Wang , Michal Kubecek , Networking , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 7, 2019 at 6:46 PM David Miller wrote: > > From: Arnd Bergmann > Date: Thu, 7 Mar 2019 16:58:35 +0100 > > > 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 > > --- > > v2: don't annotate dev_ethtool itself, as pointed out by Michal Kubecek > > I'll apply this, but as Michal said this is just papering over the problem, > the aggregate stack allocation is still the same and very large. Thanks, I looked at it again and found that ethtool_get_per_queue_coalesce() and ethtool_set_per_queue_coalesce() in fact use the same stack slots (as one would hope) when they are both inlined, so you are both right that this doesn't change as much for the ethtool_set_per_queue() function as I had hoped. On the other hand, at least it helps reduce the stack usage for all the other sub-functions of dev_ethtool(), which now don't pile on top of the 1216 bytes for the combined function but only on top of the 272 bytes for the rest of dev_ethtool. Arnd