Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp823202ybj; Tue, 5 May 2020 08:05:36 -0700 (PDT) X-Google-Smtp-Source: APiQypId6pcTLZkbF6n2K6oySvKNKIPBgJL9au1QpiBXLaldH0JZ8gia01SbbBK/UiVI5qycsHH7 X-Received: by 2002:a05:6402:1ad0:: with SMTP id ba16mr3115214edb.11.1588691136506; Tue, 05 May 2020 08:05:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588691136; cv=none; d=google.com; s=arc-20160816; b=XF0f/cXTUjo+oly4OYForIYStInUM0dc1xZtwLzMaE4uyqouJCBHCcROvVT/nph4dl Gv3HNtEb8zs5WODcy+BSw3xvoM9Vs9oLidmecKUVRdquNtX5CY32krxU+K6TSM0FDemV 2113xALzrQDdiLlOQgzJh7VFKqt9AQ3pJn+qY7njCSMUPR+zVwLIizLLQ1MtqPNH75Im xRmaMLrCPxS8ibQBIaD+xIc6BCKw6tQ6Pa4urOHlSHae55M36USYvno1f8m9iaQq67+6 8Rz/PRNdk3LfhhyJPC+c+bEgsVKQOsX7cQKt5p/qibZpVr1I4EZEVq82mkwW3Awd4cS+ F3sA== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=jqvcv77fDmYHKL5MgnDtaK6CEg4+ZyagISbpMhId4jo=; b=aZIjOP2X0dMM1YQFzXh0tjlTUk5h4tLLRRjCIPOpuwZE/J31TIS0XUhxN0rta9gmLj ZNwr2hAWgtJeHpKXASEW3iSMXAoDBg6Nt47Z0OaGQFR6ta+Rceq7Vg69E+Fguycby/2N EUV2eawtT9kNt0VQakwl7Mv8vGyCtbijhS8buK6RTLFBl/L0OHOXGCHPit1b+ToT3SZI H7I4Wp3eYO7osovk6M7b3teIB4zS6u4xUfzhS9ctRDk2ZTo517ojFUF93uU6aQAb6+d5 AhXKJj0KqqdCwLoOfhjSOaYesX9fXN1uxI9Uf7fjvqSDYQwTfyBLHD3ww9yO1t/DCv1u EfUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r3si1379136edc.405.2020.05.05.08.05.04; Tue, 05 May 2020 08:05:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729781AbgEEPBh convert rfc822-to-8bit (ORCPT + 99 others); Tue, 5 May 2020 11:01:37 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:34411 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729754AbgEEPBg (ORCPT ); Tue, 5 May 2020 11:01:36 -0400 Received: from mail-qk1-f169.google.com ([209.85.222.169]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPSA (Nemesis) id 1MqbI0-1ijfm30e0G-00mZts for ; Tue, 05 May 2020 17:01:35 +0200 Received: by mail-qk1-f169.google.com with SMTP id t3so2590496qkg.1 for ; Tue, 05 May 2020 08:01:34 -0700 (PDT) X-Gm-Message-State: AGi0PuZ0WgklLu32gAaviTjfCYolnqRp8TAH5rD2R1ENOJX0GnpJYX/X 8zNg7fIbclkO2u3Ht5rPoLtnHgj02oYBxxRF9Ro= X-Received: by 2002:a37:aa82:: with SMTP id t124mr3769549qke.3.1588690894009; Tue, 05 May 2020 08:01:34 -0700 (PDT) MIME-Version: 1.0 References: <20200505141546.824573-1-arnd@arndb.de> <30d49e6d-570b-f6fd-3a6f-628abcc8b127@suse.com> In-Reply-To: <30d49e6d-570b-f6fd-3a6f-628abcc8b127@suse.com> From: Arnd Bergmann Date: Tue, 5 May 2020 17:01:18 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] xenbus: avoid stack overflow warning To: =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= Cc: Boris Ostrovsky , Stefano Stabellini , Yan Yankovskyi , Wei Liu , xen-devel , "linux-kernel@vger.kernel.org" , clang-built-linux Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Provags-ID: V03:K1:d7lBElUzkBtNaxgQhP5+oaHyPwAoN4rffrWRbwqyDF1rRwft1g2 KDdWB/phR4tgRakSWikVocfGk8ZzlbMGOlpYQQ5/IX5PPpP4Lz4NIZtHjcuY0ENpED1cQsN 9Gmm6K5XR+O5dSozN0JZ0qfXXvhBNCskaHgq+jL+ljM1e5m5LqhClAzTjkJ0QyuDYp6X+VW KwLfE91tlRYsFJet3+Y2w== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:tn8UadlDyzk=:aq9idjHfBaT0CX2ftAbrKj XsxzSmm1MOxpACfIdSAbr2VOCVazMz4jRCDkhdeA+hpanha8xqqEvlF5x7bbXBw7K9dAfWhoq sr/k7WNaTiPmzyTb0Hd8haiuyuVlnTSRZTYW61XWEgDSsg6bB4ohIdHhXmvIPesGfpht1In0i VEsvlD+ikoMYal+MqbXpPGCdB/fO3H5Lxt4mieLKA3piLH/z/qnTLBICWTjxRK9inbzDbL7fH qsNZAT15Rb/8kvZQUyLDEZ+mBEt43g74c4F0BPN1ci+bSS3qJgkALtsDh5LFBXiEtZqkpBC/q 0gVISe95lZI+BYdEQ3DyprdkGjRzr1g1IH3Ox/mmVYYa7cHnD4pYJxPUoCb+ngiCbz6qJZqVh Bjy96grpEbCYCpQOzwwQw3yfHa3uoZEBMc0JfPw6D5LVbGuJu1Qqe6EaXheHu3Q2aH8niPMMC mfN1y/fce7n66diG2YSBLFte/ZbwfJ3h73TtRaWMA+TvGMDDuifrvOg76aEG6Uykn2CClIflU HgIlyf1qWdE4IBaE4vs8ZHK4mCD2JDqYv/QZaIBQl8Lp22NpsGvCIji5rl4A4y61ro+dFEi9z XOtH1i8iCLyxncEkfKPJ992Xmi0XIn891/XCplUzS2ps19Y1FXNvkGmk3pYvs/G9A+ivvcTMM caa94t180oLJz8pKUYmqEfRS1MRKJbagQrrIK0ZzrKxQh8YvkrOOilxaIE30okh5ypbclGnEt u+N6zzlRuHmhhCKa/Mi5Plq/E49v8Ko5U1hc82NMAul2adzvMi9rR37lQ9qfLdzAwVCyBMWAZ r5NZJgdImCgX7r1D4x0a3ZimsjEYcpakaDM0JApa/7S5wazgCY= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 5, 2020 at 4:34 PM Jürgen Groß wrote: > On 05.05.20 16:15, Arnd Bergmann wrote: > > The __xenbus_map_ring() function has two large arrays, 'map' and > > 'unmap' on its stack. When clang decides to inline it into its caller, > > xenbus_map_ring_valloc_hvm(), the total stack usage exceeds the warning > > limit for stack size on 32-bit architectures. > > > > drivers/xen/xenbus/xenbus_client.c:592:12: error: stack frame size of 1104 bytes in function 'xenbus_map_ring_valloc_hvm' [-Werror,-Wframe-larger-than=] > > > > As far as I can tell, other compilers don't inline it here, so we get > > no warning, but the stack usage is actually the same. It is possible > > for both arrays to use the same location on the stack, but the compiler > > cannot prove that this is safe because they get passed to external > > functions that may end up using them until they go out of scope. > > > > Move the two arrays into separate basic blocks to limit the scope > > and force them to occupy less stack in total, regardless of the > > inlining decision. > > Why don't you put both arrays into a union? I considered that as well, and don't really mind either way. I think it does get a bit ugly whatever we do. If you prefer the union, I can respin the patch that way. Arnd