Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp612327rdb; Thu, 19 Oct 2023 13:52:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFjLzfwiqWrSZmLGJuWzjrSinKQYBODEV6jPU5i3LIeDimeXyvUKkv4vS9HsZz5IFWwJuO3 X-Received: by 2002:a17:902:ced1:b0:1b5:561a:5c9a with SMTP id d17-20020a170902ced100b001b5561a5c9amr14745plg.39.1697748726809; Thu, 19 Oct 2023 13:52:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697748726; cv=none; d=google.com; s=arc-20160816; b=nNaM8WEdI7nO0UipLXq8iEw1G2DSRRAqdhE9OuBub6jfO7GMa4WIFT363JF//+hyUA UwvG2sI0fZ6MUApBOuTKjDAtq2XrfD/L9fcZKq/dyo+r1zjGv32T9OeL3NT2HTFK+UCN pIoaRSo1Ain0OJflJeIX2s4EzLAJwE6PCxpYPTUYB9mjnEe3zpVxwkBId4zgex4Cxkz+ UVh/tmXiLIMkVXfB23facmblOog74eZ7WKKb3tIgq4BG9IaUDNYVQtcmaUf+fAalfWng 8G/0+n70lx2nvcepUMuVGSgm6jNNGv/wf+RKBUU4K3TIZi8LHKBzzO2HByE7banoI/GO IyOg== 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=/0/MpGX+mjYot9sXxSWRIpxfp3cG4C1GN46xuWPAaF0=; fh=2+jpiAWqDKIt1NPzlsG0r1/dFsXWkQpbKRzEcGBBcY8=; b=yETJRGlGx3R+16IxKiEdK6u0OgPYuFsz3kNXKFIiGidQTywYwfmZDOoqxo+gyxNFhc PXyNIQl6O069QVdu+FjHEZwCl9d4d7V2XfTCXNqpPiSxh6gQbBw2daKIW+aZyhbze6qM gGkM6hnGEnx78Q5XT5YHVs0ZGC20r/nmZdT3upZNLKHyfgjY4jhrpea3qY5T7TaQpKA+ S9rM9LZ32nncNQiISvRvHX/ZabBtmjrdBAHNZvB9nroUtDGHGdlk8SlFQ5YRs+ykjfxI zfvr9Ad7XXh75tW3O4uxtWz0NSbVgl0qhlX+CSajy+OqT5ycBQDJPbbEuzgf2hpSaCsI 5OSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rJ+cw6Yu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id i16-20020a17090332d000b001c5f80bf574si277886plr.487.2023.10.19.13.51.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 13:52:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rJ+cw6Yu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 3637380E0B7D; Thu, 19 Oct 2023 13:51:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346553AbjJSUvY (ORCPT + 99 others); Thu, 19 Oct 2023 16:51:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229892AbjJSUvW (ORCPT ); Thu, 19 Oct 2023 16:51:22 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9F52C2; Thu, 19 Oct 2023 13:51:20 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE170C433C7; Thu, 19 Oct 2023 20:51:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697748680; bh=avvVhk562RDsloShDfVKbRwRR54xodJjv+T6J94vhjQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rJ+cw6Yu53WaCZw4SBhXOsLU55656lONyJVrRglH9t56UjH5t/DpaapyQldAZrWeZ MRJgZQBaWmn2reW0SrFN3YZAmcSvnfvFGKwIv4gTBRwLJBm+TRlPVL5v3ldSHwXc84 utZz868f+bdzqjHsX9nFyzcZYScMeqEv++Wv4GLHiMtEoALOvIzrVH0wim6LaAvwVP /Qq0RA8xOHjLsB5N3jJ40NqlLeco5kc2Ejje+V+9kjj1vT2NpiorfWBEweKmmS3Lgr 7j7IH7yb5s0p5v6paWW9zXY5d9GvJVbGBVmvTHVAIsWDOcbgNvhscLeC4qjk/iVRTc Xqx3C52GjjO6Q== Date: Thu, 19 Oct 2023 13:51:17 -0700 From: Nathan Chancellor To: Hamza Mahfooz Cc: Arnd Bergmann , Alexander Potapenko , Geert Uytterhoeven , linux-kernel@vger.kernel.org, Rodrigo Siqueira , Harry Wentland , Alex Deucher , stable@vger.kernel.org, Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Nick Terrell , Nick Desaulniers , Tom Rix , Andrew Morton , Masami Hiramatsu , Randy Dunlap , Kees Cook , Zhaoyang Huang , Li Hua , Rae Moar , rust-for-linux@vger.kernel.org, bpf@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] lib/Kconfig.debug: disable FRAME_WARN for kasan and kcsan Message-ID: <20231019205117.GA839902@dev-arch.thelio-3990X> References: <20231018182412.80291-1-hamza.mahfooz@amd.com> <22580470-7def-4723-b836-1688db6da038@app.fastmail.com> <20231019155600.GB60597@dev-arch.thelio-3990X> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 19 Oct 2023 13:51:34 -0700 (PDT) On Thu, Oct 19, 2023 at 04:17:26PM -0400, Hamza Mahfooz wrote: > On 10/19/23 11:56, Nathan Chancellor wrote: > > On Thu, Oct 19, 2023 at 02:53:01PM +0200, Arnd Bergmann wrote: > > > On Thu, Oct 19, 2023, at 12:04, Alexander Potapenko wrote: > > > > So the remaining option would be to just increase the frame size every > > > > time a new function surpasses the limit. > > > > > > That is clearly not an option, though we could try to > > > add Kconfig dependencies that avoid the known bad combinations, > > > such as annotating the AMD GPU driver as > > > > > > depends on (CC_IS_GCC || CLANG_VERSION >=180000) || !(KASAN || KCSAN) > > > > This would effectively disable the AMDGPU driver for allmodconfig, which > > is somewhat unfortunate as it is an easy testing target. > > > > Taking a step back, this is all being done because of a couple of > > warnings in the AMDGPU code. If fixing those in the source is too much > > effort (I did note [1] that GCC is at the current limit for that file > > even with Rodrigo's series applied [2]), couldn't we just take the > > existing workaround that this Makefile has for this file and its high > > stack usage and just extend it slightly for clang? > > I personally don't mind fixing these issues in the driver, but the fact > that they the creep back every time a new major version of Clang rolls > out (that has been true for the past couple of years at the very > least), makes it rather annoying to deal with. I am not sure I agree with that characterization of the situation. clang has been pretty consistent for the most part (which is certainly on us), as all versions that the kernel supports warns about this code. I believe it is more so the fact that there is a new copy of the dcn code added every year that has none of the fixes applied from earlier generations... It is not just me that has fixed issues like this, just run 'git log --grep=stack drivers/gpu/drm/amd/display'. It is not just clang that complains about the code when sanitizers are turned on, GCC does as well since Stephen reported them. Cheers, Nathan > > diff --git a/drivers/gpu/drm/amd/display/dc/dml2/Makefile b/drivers/gpu/drm/amd/display/dc/dml2/Makefile > > index 66431525f2a0..fd49e3526c0d 100644 > > --- a/drivers/gpu/drm/amd/display/dc/dml2/Makefile > > +++ b/drivers/gpu/drm/amd/display/dc/dml2/Makefile > > @@ -58,7 +58,7 @@ endif > > endif > > ifneq ($(CONFIG_FRAME_WARN),0) > > -frame_warn_flag := -Wframe-larger-than=2048 > > +frame_warn_flag := -Wframe-larger-than=$(if $(CONFIG_CC_IS_CLANG),3072,2048) > > endif > > CFLAGS_$(AMDDALPATH)/dc/dml2/display_mode_core.o := $(dml2_ccflags) $(frame_warn_flag) > > > > That would address the immediate concern of the warning breaking builds > > with CONFIG_WERROR=y while not raising the limit for other files in the > > kernel (just this one file in AMDGPU) and avoiding disabling the whole > > driver. The number could be lower, I think ~2500 bytes is the most usage > > I see with Rodrigo's series applied, so maybe 2800 would be a decent > > limit? Once there is a fix in the compiler, this expression could be > > changed to use clang-min-version or something of that sort. > > > > [1]: https://lore.kernel.org/20231017172231.GA2348194@dev-arch.thelio-3990X/ > > [2]: https://lore.kernel.org/20231016142031.241912-1-Rodrigo.Siqueira@amd.com/ > > > > Cheers, > > Nathan > -- > Hamza >