Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp944569rwb; Thu, 4 Aug 2022 14:05:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR4ObNfq3SEh06slV0CHNk32lfVMY1xY154HOpiU5MbtopyWS4oaldbfYT5FKC/Q2q/LsGcd X-Received: by 2002:a05:6402:1f01:b0:43a:239e:e65a with SMTP id b1-20020a0564021f0100b0043a239ee65amr3771129edb.428.1659647110201; Thu, 04 Aug 2022 14:05:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659647110; cv=none; d=google.com; s=arc-20160816; b=szltfnwCJlAF23kUjY3XUwMyHwRfAJBuEcLLfFFBJE1r4+33mNKLMayDcHXgCPWVGE PxTGrkH8CEsEUGAoC1bfO1lh4d4HsjgRwe5bmLge8f0t6XkTwYuyd/k66xsREUjl/ULG 6tjrIUj7U1qPN8MBTdGdW+8FCqyhNvaxDtceQJuc49cfH+Xo4l/+8Gegj1WWuHXiGDDD jVWpMHXkc8LEZff0tm77ZtgGAcK2UfNFSojtJ6l6znWDJa6yNRNe8nlxzGGPnmT2rqMn W1JIWNUpLsUBYVMHU30XrOPoEjIOPHAX3eZtzQ3VRxa4gy0o53Jzzu1V+4RjAejnwkDW ycBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=sxP/ZPMPJ0EvyfPtHpNtaBNZUNet+tHguMy8dAuPBbE=; b=eIbG6/FpjGtTHv40DLdc+fNku2exZ06HnwG6cTAlELhx2B4eKX9oZsQgEiwUegOqI9 Tdo19m+W4+c+lGO5tbR4XL15c+kSTbJVg8AAbbMLlxjnWJXQOfc3iOPzFQzge2rkTA5V sF93HuxSBQu8o3JtCeEOk1yQ4ThyywREw2xWKTheGZINy9EXWWzjAmya952Y5iAAFKPO k7zvhekdHHUBthqWBmubsfvTA6/3dlkNYcfO40dzFTDMhtvEhnq1sBrWQ/IMkpWPQtBg 8UZqQsy461gCxgcFh5dsCYZOKi9Y+HJRi03JdRrNYi3Ads3K8cqmkqbBhMLhdX9azpsk avwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=juU3p2LU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb22-20020a1709071c9600b0072ab9f8a4b9si2148328ejc.191.2022.08.04.14.04.45; Thu, 04 Aug 2022 14:05:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=juU3p2LU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235047AbiHDUnt (ORCPT + 99 others); Thu, 4 Aug 2022 16:43:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229813AbiHDUnr (ORCPT ); Thu, 4 Aug 2022 16:43:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4ABFB6D55B for ; Thu, 4 Aug 2022 13:43:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D6FF06176C for ; Thu, 4 Aug 2022 20:43:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AF40C433D6; Thu, 4 Aug 2022 20:43:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659645825; bh=/dBnGEelz0eNZ7ash2KCkOnK42Kq3O9zA1e57MIkXCU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=juU3p2LUjcxjMlM6vTTY1lLZWVXb/mcsQMqGkZ/WHOsek7V0hDFsZrX6Fy+36KdAL yn6BDe8wUhOCTy+9ZmfJBWS+mP62dLFKmdwlOlB9vlElBwclJg+RepYpdf+Rh/Cr1R u1r3hEtJJAPuVVjBIr5FfU5oSiL0TI8wqQ8BHsU7AMGN+99rp1KPkm9Dpm3bncEXmC lYPlURhbpMy9WqPtn0SPIKyz/PKWa3k6Nr+SvcKaVd542jSA8LDJaEgGIFbA2AG+zj aP9g14qRKxapm+F0brNeG0LRJa69nTT/49cOFbDE96HEXU1PPAUMgBawRt2tazl2La ZP/6K+bDSkX/w== Date: Thu, 4 Aug 2022 13:43:42 -0700 From: Nathan Chancellor To: Arnd Bergmann Cc: Linus Torvalds , "Sudip Mukherjee (Codethink)" , clang-built-linux , Alex Deucher , Christian =?iso-8859-1?Q?K=F6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , amd-gfx list , dri-devel , Linux Kernel Mailing List Subject: Re: mainline build failure for x86_64 allmodconfig with clang Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 04, 2022 at 09:24:41PM +0200, Arnd Bergmann wrote: > On Thu, Aug 4, 2022 at 8:52 PM Linus Torvalds > wrote: > > > > On Thu, Aug 4, 2022 at 11:37 AM Sudip Mukherjee (Codethink) > > wrote:cov_trace_cmp > > > > > > git bisect points to 3876a8b5e241 ("drm/amd/display: Enable building new display engine with KCOV enabled"). > > > > Ahh. So that was presumably why it was disabled before - because it > > presumably does disgusting things that make KCOV generate even bigger > > stack frames than it already has. > > > > Those functions do seem to have fairly big stack footprints already (I > > didn't try to look into why, I assume it's partly due to aggressive > > inlining, and probably some automatic structures on stack). But gcc > > doesn't seem to make it all that much worse with KCOV (and my clang > > build doesn't enable KCOV). > > > > So it's presumably some KCOV-vs-clang thing. Nathan? Looks like Arnd beat me to it :) > The dependency was originally added to avoid a link failure in 9d1d02ff3678 > ("drm/amd/display: Don't build DCN1 when kcov is enabled") after I reported the > problem in https://lists.freedesktop.org/archives/dri-devel/2018-August/186131.html > > The commit from the bisection just turns off KCOV for the entire directory > to avoid the link failure, so it's not actually a problem with KCOV vs clang, > but I think a problem with clang vs badly written code that was obscured > in allmodconfig builds prior to this. Right, I do think the sanitizers make things worse here too, as those get enabled with allmodconfig. I ran some really quick tests with allmodconfig and a few instrumentation options flipped on/off: allmodconfig (CONFIG_KASAN=y, CONFIG_KCSAN=n, CONFIG_KCOV=y, and CONFIG_UBSAN=y): warning: stack frame size (2216) exceeds limit (2048) in 'dml30_ModeSupportAndSystemConfigurationFull' [-Wframe-larger-than] warning: stack frame size (2184) exceeds limit (2048) in 'dml31_ModeSupportAndSystemConfigurationFull' [-Wframe-larger-than] warning: stack frame size (2176) exceeds limit (2048) in 'dml32_ModeSupportAndSystemConfigurationFull' [-Wframe-larger-than] allmodconfig + CONFIG_KASAN=n: warning: stack frame size (2112) exceeds limit (2048) in 'dml32_ModeSupportAndSystemConfigurationFull' [-Wframe-larger-than] allmodconfig + CONFIG_KCOV=n: warning: stack frame size (2216) exceeds limit (2048) in 'dml30_ModeSupportAndSystemConfigurationFull' [-Wframe-larger-than] warning: stack frame size (2184) exceeds limit (2048) in 'dml31_ModeSupportAndSystemConfigurationFull' [-Wframe-larger-than] warning: stack frame size (2176) exceeds limit (2048) in 'dml32_ModeSupportAndSystemConfigurationFull' [-Wframe-larger-than] allmodconfig + CONFIG_UBSAN=n: warning: stack frame size (2584) exceeds limit (2048) in 'dml30_ModeSupportAndSystemConfigurationFull' [-Wframe-larger-than] warning: stack frame size (2680) exceeds limit (2048) in 'dml31_ModeSupportAndSystemConfigurationFull' [-Wframe-larger-than] warning: stack frame size (2352) exceeds limit (2048) in 'dml32_ModeSupportAndSystemConfigurationFull' [-Wframe-larger-than] allmodconfig + CONFIG_KASAN=n + CONFIG_KCSAN=y + CONFIG_UBSAN=n: warning: stack frame size (2504) exceeds limit (2048) in 'dml30_ModeSupportAndSystemConfigurationFull' [-Wframe-larger-than] warning: stack frame size (2600) exceeds limit (2048) in 'dml31_ModeSupportAndSystemConfigurationFull' [-Wframe-larger-than] warning: stack frame size (2264) exceeds limit (2048) in 'dml32_ModeSupportAndSystemConfigurationFull' [-Wframe-larger-than] allmodconfig + CONFIG_KASAN=n + CONFIG_KCSAN=n + CONFIG_UBSAN=n: warning: stack frame size (2072) exceeds limit (2048) in 'dml31_ModeSupportAndSystemConfigurationFull' [-Wframe-larger-than] There might be other debugging configurations that make this worse too, as I don't see those warnings on my distribution configuration. > The dml30_ModeSupportAndSystemConfigurationFull() function exercises > a few paths in the compiler that are otherwise rare. On thing it does is to > pass up to 60 arguments to other functions, and it heavily uses float and > double variables. Both of these make it rather fragile when it comes to > unusual compiler options, so the files keep coming up whenever a new > instrumentation feature gets added. There is probably some other flag > in allmodconfig that we can disable to improve this again, but I have not > checked this time. I do notice that these files build with a non-configurable -Wframe-large-than value: $ rg frame_warn_flag drivers/gpu/drm/amd/display/dc/dml/Makefile 54:frame_warn_flag := -Wframe-larger-than=2048 70:CFLAGS_$(AMDDALPATH)/dc/dml/dcn30/display_mode_vba_30.o := $(dml_ccflags) $(frame_warn_flag) 72:CFLAGS_$(AMDDALPATH)/dc/dml/dcn31/display_mode_vba_31.o := $(dml_ccflags) $(frame_warn_flag) 76:CFLAGS_$(AMDDALPATH)/dc/dml/dcn32/display_mode_vba_32.o := $(dml_ccflags) $(frame_warn_flag) I suppose that could just be bumped as a quick workaround? Two of those files have a comment that implies modifying them in non-trivial ways is not recommended. /* * NOTE: * This file is gcc-parsable HW gospel, coming straight from HW engineers. * * It doesn't adhere to Linux kernel style and sometimes will do things in odd * ways. Unless there is something clearly wrong with it the code should * remain as-is as it provides us with a guarantee from HW that it is correct. */ I do note that commit 1b54a0121dba ("drm/amd/display: Reduce stack size in the mode support function") did have a workaround for GCC. It appears clang will still inline mode_support_configuration(). If I mark it as 'noinline', the warning disappears in that file. Cheers, Nathan