Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp3937802pxb; Tue, 7 Sep 2021 10:45:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymDRiewfWPqN0kWzKGOpZ2af8iF825F+wLM3Ri/nxteyMAkzFS9PuUDadaaXhrgIplYCsM X-Received: by 2002:a17:906:2642:: with SMTP id i2mr19718941ejc.323.1631036742883; Tue, 07 Sep 2021 10:45:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631036742; cv=none; d=google.com; s=arc-20160816; b=Wd08zbEHLBmeN4Oj4irotvEeLolWbF+mCjVbrDbl00ryLZ4PYnPikJGoDve2etrRMo 7eRS+gDw/SNg4lcYxD05wHxD0v7kO7KWPKcGjCEmE6s3RjHmwvubJ/SSkVE0fzXFdmIF /x9GoGGTsSnsBNf8J1NTwndM3UKPRxQZKQJeb0jU9JDJ+fTTryyiRQCTNhaucQn6dWwK V9TJRtcTp+xY/F55AS+3QluJic4UDayir3+do+FcGMSR+IEUyMx72xKViZXe1KCng/E2 PozBot6rq61GA6VcwL8XRJaOP38rMTAjKcEb0N4xgx/DfeE861Mndh+jJGiqFrc/y4vK X4zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=H+GlpUmGC3s0m862BFnaEghUBDcmr0hsoDqEpHfudes=; b=BPZmkERl6bJYrPrabeihBpOIfGV41NBP/0ItCVI39tNqBNHTYgVICG5l1SVxNDw8Bb qBzc2wUgonmpEZ89Wj/FurT40YTewlJK7UwLgGvUvG0m7bD+rFJQbqcHov9UDmO1o+53 ZY3XHf7JirwluzZzeyUdj+apLOqsun6G/ZrTRyggirwsK31VEAZ2qlavqdHMSa2Ia835 YgxrM2O/Z1jCw4cgNFX0xvXbDOvy+xUV6qNH1Cp3K0AGrLwSZXZ9btVFdWEtBf3stEqF o3Nx0P7tpCRcJy79hjMF0PSKjZ+aV40/XXpthGXby8iatKSJW57ebNZdbn4LEdAM9+Mg vNhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=ZrpTD11Y; 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 j4si10303177eje.704.2021.09.07.10.45.18; Tue, 07 Sep 2021 10:45:42 -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; dkim=pass header.i=@linux-foundation.org header.s=google header.b=ZrpTD11Y; 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 S1345505AbhIGRLl (ORCPT + 99 others); Tue, 7 Sep 2021 13:11:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345398AbhIGRLj (ORCPT ); Tue, 7 Sep 2021 13:11:39 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3650AC061575 for ; Tue, 7 Sep 2021 10:10:30 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id c8so20887754lfi.3 for ; Tue, 07 Sep 2021 10:10:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=H+GlpUmGC3s0m862BFnaEghUBDcmr0hsoDqEpHfudes=; b=ZrpTD11YcoTzlnxV9wbY07amfLrzROABaXwapPT/EEW1bkKcXuC/n8hMUS1To0EImi DPnKnhPDFJMiXLp6aEjyyVpW8E7s3FPi0evoO0M+tFEFfJy19SP9BS7fxujNluGVqvaR KofKwxkpnp3XGnzZgyHrIyRK5eh2/qXYrkUjM= 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=H+GlpUmGC3s0m862BFnaEghUBDcmr0hsoDqEpHfudes=; b=Y8agEkZIXp6ftubAzNJ0KuQHD/UfDOkPzPdoMVxuz47X6o2XAlBqhXzHQIcY1bBK49 dYVCPu5mpTrMjFSSNqvijRssuP8sVY39HymwwjwOE1q/doOBXZR2R9W1GtGPaQ89dddH mV6hYbqi0NJQUXlLuSVvVdHZEE4gjUHGhtyuCk8u/v7X44EKK5CtRJ2Vuwv0j4q7q0Q3 sRwVpy3KYwezFBoyCCVoujPS8UXMjFY5lldYxKzDm3iCceoLeARhCVA3PyKpyiepDIJJ yQZmkwKDYxhgQGZ/pLSF/CQCuNmDzk+sgWrFzEObziTUrUx1DAoi4zloamtsQIflE47j 70jQ== X-Gm-Message-State: AOAM530qzGoj85/cPRsAw5KG6WxF7bu5gQSrVzRUFt8Y0kmcruRLvE3q tXF29t6Zhn7tLCigFD8gHBDNthSW07qANLM0G0k= X-Received: by 2002:a05:6512:1326:: with SMTP id x38mr13508989lfu.591.1631034627878; Tue, 07 Sep 2021 10:10:27 -0700 (PDT) Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com. [209.85.208.173]) by smtp.gmail.com with ESMTPSA id m5sm1497513ljg.55.2021.09.07.10.10.26 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Sep 2021 10:10:27 -0700 (PDT) Received: by mail-lj1-f173.google.com with SMTP id d16so17700643ljq.4 for ; Tue, 07 Sep 2021 10:10:26 -0700 (PDT) X-Received: by 2002:a2e:a7d0:: with SMTP id x16mr15231271ljp.494.1631034626531; Tue, 07 Sep 2021 10:10:26 -0700 (PDT) MIME-Version: 1.0 References: <20210906142615.GA1917503@roeck-us.net> In-Reply-To: From: Linus Torvalds Date: Tue, 7 Sep 2021 10:10:10 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] Enable '-Werror' by default for all kernel builds To: Arnd Bergmann Cc: Nathan Chancellor , Guenter Roeck , Linux Kernel Mailing List , llvm@lists.linux.dev, Nick Desaulniers Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 7, 2021 at 2:11 AM Arnd Bergmann wrote: > > > x86_64-alpine.log:drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:452:13: error: stack frame size (1800) exceeds limit (1280) in function 'dcn_bw_calc_rq_dlg_ttu' [-Werror,-Wframe-larger-than] > > x86_64-alpine.log:drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn21/display_rq_dlg_calc_21.c:1657:6: error: stack frame size (1336) exceeds limit (1280) in function 'dml21_rq_dlg_get_dlg_reg' [-Werror,-Wframe-larger-than] > > x86_64-alpine.log:drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_rq_dlg_calc_30.c:1831:6: error: stack frame size (1352) exceeds limit (1280) in function 'dml30_rq_dlg_get_dlg_reg' [-Werror,-Wframe-larger-than] > > x86_64-alpine.log:drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn31/display_rq_dlg_calc_31.c:1676:6: error: stack frame size (1336) exceeds limit (1280) in function 'dml31_rq_dlg_get_dlg_reg' [-Werror,-Wframe-larger-than] > > x86_64-alpine.log:drivers/vhost/scsi.c:1831:12: error: stack frame size (1320) exceeds limit (1280) in function 'vhost_scsi_release' [-Werror,-Wframe-larger-than] > > > > Another instance where distros lower CONFIG_FRAME_WARN below the 2048 > > default. Again, none look particularly scary but should still probably > > be dealt with. > > I would argue that they are still scary and should be addressed in the > code, it's just that we don't see them on build bots that use the 2048 byte default. No, they are scary for another reason entirely: clang is clearly doing a *HORRIBLE* job with stack usage. To take that dml30_rq_dlg_get_dlg_reg() function as an example: yes, it has a few structures on the stack, but gcc allocates 512-720 bytes of stack space depending on my config. Not 1280 bytes. So it's not even *close* to the 1024 byte limit with gcc, much less the 2kB one. I don't know why clang basically decides to use almost double the stack space. Maybe it's some other config option that does it, I tried a fairly normal one and a "almost everythign enabled" one, and couldn't get close to the reported stack frame size with gcc. Just to try to make things as close as possible, I tried with the exact same normal non-debug config (apart from obvious compiler-dependent things), and picked that dml30_rq_dlg_get_dlg_reg() function to look at (for no real reason other than that the stack frame was biggest above. Gcc did a 720-byte stack frame for that case. Not great, but whatever. clang did a 1136-byte stack frame for the same thing. Do I know why? No. I do note that that code is disgusting. It's passing one of those structs around by value, for example. That's a 72-byte structure that is copied on the stack due to stupid calling conventions. Maybe clang generates a few extra temporaries for it as part of the function call stack setup? Who knows.. Linus