From patchwork Mon Jul 22 15:00:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 169405 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp7631183ilk; Mon, 22 Jul 2019 08:00:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzKac6MHwKUiwbHcEVF7mXueCE3BiT7jJ0Y0gqlLqfmbAs8Rz7f+QuvFDayDUeUslXuin3f X-Received: by 2002:a63:f50d:: with SMTP id w13mr71899580pgh.411.1563807643099; Mon, 22 Jul 2019 08:00:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563807643; cv=none; d=google.com; s=arc-20160816; b=ltxBPJnA/4H6K5qM924q/aL29xoifg7T/uiqIoIc9k3+mTMFK4U/HY5alR5lgln4oc X2WwvAsA0JwJLsFIYPUHQyoJIzh9xTMjEQAkPkDI6lAeM2E8eTVZM6RoYBT8D3DUWcal WiJaFz9Fvu788V602Lz5eyZCJzGYj3x1zvsak3JwYRxiEguHqtlxYaQ81pYO6HvtjBqf DMQ+mCKe1+FDopTPa1JFU3R1w+uxtBxZEZENj9M/7/F82jLtqeNHd3iEBLEj3WT3nuye ej4bgL5/OuiOdSNANtWJSGzH7PA8niEx/yptT2zQIKl38mL3ARqV0Sk/ngwdknEPIZiU lusg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=bkwBHNPXcXAFXH5pYbkdiByZR7O4O5XYv/RgINQz6jA=; b=u0wVcphE0uuR7PXpl/e3sy4vpWEJngJVTugZECpdXD3O8os7LLZwlrshxrKdeSOWLH l02Ykzxizyf0XUEgA/mx1fzKCM1Bwqax8vxWodU8y41OpKpntavfeiA31d24Eq1urjE/ y412iMTLDKjSlaHwIsKCI4ldIOnp2/NF+qy/RQYaVopOQ2VvqVpy7nYh7OsnsLHUAIpH 6C4i4l3fev/Aty9YTXS+K3DpDdeiZovukmiZrGh3eE+fDa3OvpEqlICdi5O+83DDv3Ny SpswkUL7VYTI97y0MRDaCLkDvOzzdTXfMrm0KmCRJyrZ5KA3dUWSvvz9+uHw0KdpADqP LbGQ== 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 b40si11941328pla.49.2019.07.22.08.00.42; Mon, 22 Jul 2019 08:00:43 -0700 (PDT) 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 S1726920AbfGVPAl (ORCPT + 29 others); Mon, 22 Jul 2019 11:00:41 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:39053 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725899AbfGVPAl (ORCPT ); Mon, 22 Jul 2019 11:00:41 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1Mn2Jj-1iF2Sg2Z0h-00k8ux; Mon, 22 Jul 2019 17:00:21 +0200 From: Arnd Bergmann To: Pravin B Shelar , "David S. Miller" Cc: Arnd Bergmann , Tonghao Zhang , Johannes Berg , Kangjie Lu , netdev@vger.kernel.org, dev@openvswitch.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: [PATCH] ovs: datapath: hide clang frame-overflow warnings Date: Mon, 22 Jul 2019 17:00:01 +0200 Message-Id: <20190722150018.1156794-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:n38BZKXQeU4NCOj2u3jNETtHaDR3crTUgKISheti+Q/vGZ4iOf9 CEdgitQaFx19lylhbtU4GNob2+pIJoGxqHzfM/c0Y510k2PvKqagKwo4wxgp/wFzvEnZRAr 2qeqnFJWkAh9FMW6vYDyHXBJNcfl7PNO94jSWeEaAbMwbH+nN2KT/eYVXpX++zZrxMCIB6M 51tSASVvAUVMs9JjoCWzg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:BIxhja8daZY=:a3r2BQT8oflr6GgXt6Jes2 W45PjZlPErn72wTTrP4kq3o2NkWZx3eYlFz/FqMAlX1sEvyBzuIWG6sZ7I79ivukuKeDqt1Av A86XaIJYB7L31S6LtCZVKbtFdi+PWSoyH+ZESd5Kmr5XYPBynuYAZM6xraW/LYqJvNtLWtwmg Rc6jbSFKK0dGq0cFDK+ep7eUzrdRSTiHNhhDXzYH+CEnRxxgAlEgV9rCUFXjNVuyjTkkVSheg c4/INjS1MBkLRutGKrPt0lAIqjUpMAQCk4Dpr0IGcCkEEQ7+JXlJanSpGiADdniVWM1NgEMrG xLvDGBpVJO8TSRVS0O5bZTeB+WmDYauLUKaLYh6S7IYg/xrdb/bLOdkdohsQA/yFc7iiQv2HO abpRQTVBawt6wp0uxxFjSmmUGwrQxeQ2QMg8SDDnZ1QbVLTavQTztwWawywRiwf20XEHNMIdv 2qLG6QrhmQ+XgbY1UZqgxWznoLOe4dIeRglEJcXBTWj0nU310DWAcsSGhIJZlUlmYBohJGer0 HGRB8KD5gKnJEp0DAwUs0LmcD8SbfoKlWCswinBVQEUE3Fa81aVAaRY/r4BY62EG6zARO5OCO U90PkOFax25c9cZ6DjGbqVbx86vJRLD2r8Rpr0XyDwUHkD8UJzW1m5iBu5Xjb4VwrMsfH8Z7i M23qg4QUtWCPXitysMNbfZJV1LcBQ1s/KvA7UYDFJLxRZTEawnf+640BFZ59wprwt8OcDiKre Qj6/B5iDFVB8GZdhrAtwY8eWJWrJG2Qxng66jw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some functions in the datapath code are factored out so that each one has a stack frame smaller than 1024 bytes with gcc. However, when compiling with clang, the functions are inlined more aggressively and combined again so we get net/openvswitch/datapath.c:1124:12: error: stack frame size of 1528 bytes in function 'ovs_flow_cmd_set' [-Werror,-Wframe-larger-than=] Marking both get_flow_actions() and ovs_nla_init_match_and_action() as 'noinline_for_stack' gives us the same behavior that we see with gcc, and no warning. Note that this does not mean we actually use less stack, as the functions call each other, and we still get three copies of the large 'struct sw_flow_key' type on the stack. The comment tells us that this was previously considered safe, presumably since the netlink parsing functions are called with a known backchain that does not also use a lot of stack space. Fixes: 9cc9a5cb176c ("datapath: Avoid using stack larger than 1024.") Signed-off-by: Arnd Bergmann --- net/openvswitch/datapath.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) -- 2.20.0 diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 892287d06c17..d01410e52097 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -1047,7 +1047,7 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct genl_info *info) } /* Factor out action copy to avoid "Wframe-larger-than=1024" warning. */ -static struct sw_flow_actions *get_flow_actions(struct net *net, +static noinline_for_stack struct sw_flow_actions *get_flow_actions(struct net *net, const struct nlattr *a, const struct sw_flow_key *key, const struct sw_flow_mask *mask, @@ -1081,12 +1081,13 @@ static struct sw_flow_actions *get_flow_actions(struct net *net, * we should not to return match object with dangling reference * to mask. * */ -static int ovs_nla_init_match_and_action(struct net *net, - struct sw_flow_match *match, - struct sw_flow_key *key, - struct nlattr **a, - struct sw_flow_actions **acts, - bool log) +static noinline_for_stack int +ovs_nla_init_match_and_action(struct net *net, + struct sw_flow_match *match, + struct sw_flow_key *key, + struct nlattr **a, + struct sw_flow_actions **acts, + bool log) { struct sw_flow_mask mask; int error = 0;