From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EF2AC48BC2 for ; Mon, 21 Jun 2021 16:14:29 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DF43E61001 for ; Mon, 21 Jun 2021 16:14:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DF43E61001 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=6Utxos33/sZ1C+SKvQJICOSaKtDhAzY/+QpRIdSPK7s=; b=tooirI1wSVMMgzx1lGW+tAawlu hkezd0cU4OGcDeSzOu6wQavBvaZs1SNmCyAhFjqIe/yFYOoZ+gizcOv6TCdH65hOE2W4JOo2E8Jn7 OZXVHNicOFZvuCQdy14mZlO9IKLBT+394QNXxELoEMBspOlt5HqTqz1gTwMKqN+iRU5Mlr7guZ0tp rL4ukMmKQDmSNaYi2XSSZIH0rPt4FFPKNgpQj1WJW+SmhJbwwIQ6zVzxLu1qimHo2rF0zicuC396j uk27kDlgD/zF28ldx+mDY136VtJVyJuWPfQbgYiWil9a+Tm/r/w8gFvUcrsKFnmmD8I+VPFU2xME5 UTULNJBQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lvMXj-00438v-QQ; Mon, 21 Jun 2021 16:13:00 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lvMXd-00436t-Jv for linux-arm-kernel@lists.infradead.org; Mon, 21 Jun 2021 16:12:55 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8318C6115B; Mon, 21 Jun 2021 16:12:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624291972; bh=AzRb76ooYdVr7sn2g1f2vZvc/DJJI2ab6D7xDGIWyt0=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=YAJE1EtlsLOEnxEVr8gyQJd6sMAk53PuQs0V0JFq+UQFlBp+qfk5u/KypY49/IInq 4K9sYx4L32BtuuvYq4eNGbNNpkL3qxyDROTINejvoex4EnAG3Dq7RL/IISicyZ+TVt YiX60NIRb0Iqv7BxomhVW5Tbm2jSiMIVZNsMgENwK81lamCc0uWdzU4/I0dDqT6Ju6 u5j1ojHxAXVEYU7Zc/7rcXkjZhsshRNPa4lIRXRwyEbnPB/Fk72UYi53qVZTL312W1 5k/JFDDK4o/61HppSwRFbetUuOMdQ367nwFvVgytyGgGLKOLN5MmNQOFMnXmmCTjmj w+bMI2BEcMi7Q== Subject: Re: [PATCH 2/2] arm64: insn: move AARCH64_INSN_SIZE into To: Mark Rutland Cc: will@kernel.org, linux-arm-kernel@lists.infradead.org, Catalin Marinas , clang-built-linux@googlegroups.com References: <20210609102301.17332-1-mark.rutland@arm.com> <20210609102301.17332-3-mark.rutland@arm.com> <20210618151835.GC8318@C02TD0UTHF1T.local> <20210621080830.GA37068@C02TD0UTHF1T.local> From: Nathan Chancellor Message-ID: <3cde2fe9-e5d5-3102-d527-4cc9c5059b7f@kernel.org> Date: Mon, 21 Jun 2021 09:12:51 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210621080830.GA37068@C02TD0UTHF1T.local> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210621_091253_769629_51300044 X-CRM114-Status: GOOD ( 36.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 6/21/2021 1:08 AM, Mark Rutland wrote: > On Fri, Jun 18, 2021 at 09:53:31AM -0700, Nathan Chancellor wrote: >> On Fri, Jun 18, 2021 at 04:18:35PM +0100, Mark Rutland wrote: >>> On Thu, Jun 17, 2021 at 06:25:27PM -0700, Nathan Chancellor wrote: >>>> Hi Mark, >>> >>> Hi Nathan, >>> >>>> On Wed, Jun 09, 2021 at 11:23:01AM +0100, Mark Rutland wrote: >>>>> For histroical reasons, we define AARCH64_INSN_SIZE in >>>>> , but it would make more sense to do so in >>>>> . Let's move it into , and add the necessary >>>>> include directives for this. >>> >>>> I bisected a CONFIG_LTO_CLANG_THIN=y build failure that our CI reported >>>> to this patch: >>>> >>>> https://builds.tuxbuild.com/1u4Fpx2FQkkgkyPxWtq0Ke4YFCQ/build.log >>> >>> Thanks for reporting this; the lopg is really helpful! >>> >>>> I have not had a whole ton of time to look into this (dealing with a >>>> million fires it seems :^) but it is not immediately obvious to me why >>>> this fails because include/linux/build_bug.h is included within >>>> arch/arm64/include/asm/insn.h. >>> >>> The problem is that with LTO, we patch READ_ONCE(), and >>> includes , creating a circular include chain: >>> >>> >>> >>> >>> >>> >>> >>> >>> ... and so when includes , none of the >>> BUILD_BUG* definitions have happened yet. >> >> Aha, that would certainly explain it. I figured something like this >> would be the root cause but figuring out header dependencies is not my >> cup of tea. >> >>> Will, are you happy to take the fixup patch below, or would you prefer >>> to drop this patch for now? > >>> arch/arm64/include/asm/alternative-macros.h | 2 +- >>> arch/arm64/include/asm/insn.h | 5 +---- >> >> Looks like arch/arm64/include/asm/insn-def.h is missing from this patch? >> >> If I add one with just the two deleted lines plus a header guard, the >> build passes. >> >> Tested-by: Nathan Chancellor > > Whoops; that should have been as below. > > Was that the same as you tested? Yes, that is exactly what I did so the tag should still be good. Cheers, Nathan > Thanks, > Mark. > > ---->8---- > From 622fd784c57423b1a276fbbfb270b84839e3afa8 Mon Sep 17 00:00:00 2001 > From: Mark Rutland > Date: Fri, 18 Jun 2021 16:11:22 +0100 > Subject: [PATCH] arm64: insn: avoid circular include dependency > > Nathan reports that when building with CONFIG_LTO_CLANG_THIN=y, the > build fails due to BUILD_BUG_ON() not being defined before its uss in > . > > The problem is that with LTO, we patch READ_ONCE(), and > includes , creating a circular include chain: > > > > > > > > > ... and so when includes , none of the > BUILD_BUG* definitions have happened yet. > > To avoid this, let's move AARCH64_INSN_SIZE into a header without any > dependencies, such that it can always be safely included. At the same > time, avoid including in , which should > no longer be necessary (and doesn't make sense when insn.h is consumed > by userspace). > > Reported-by: Nathan Chancellor > Signed-off-by: Mark Rutland > Cc: Catalin Marinas > Cc: Will Deacon > --- > arch/arm64/include/asm/alternative-macros.h | 2 +- > arch/arm64/include/asm/insn-def.h | 9 +++++++++ > arch/arm64/include/asm/insn.h | 5 +---- > 3 files changed, 11 insertions(+), 5 deletions(-) > create mode 100644 arch/arm64/include/asm/insn-def.h > > diff --git a/arch/arm64/include/asm/alternative-macros.h b/arch/arm64/include/asm/alternative-macros.h > index 703fbf310b79..eba3173a2a2c 100644 > --- a/arch/arm64/include/asm/alternative-macros.h > +++ b/arch/arm64/include/asm/alternative-macros.h > @@ -3,7 +3,7 @@ > #define __ASM_ALTERNATIVE_MACROS_H > > #include > -#include > +#include > > #define ARM64_CB_PATCH ARM64_NCAPS > > diff --git a/arch/arm64/include/asm/insn-def.h b/arch/arm64/include/asm/insn-def.h > new file mode 100644 > index 000000000000..2c075f615c6a > --- /dev/null > +++ b/arch/arm64/include/asm/insn-def.h > @@ -0,0 +1,9 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > + > +#ifndef __ASM_INSN_DEF_H > +#define __ASM_INSN_DEF_H > + > +/* A64 instructions are always 32 bits. */ > +#define AARCH64_INSN_SIZE 4 > + > +#endif /* __ASM_INSN_DEF_H */ > diff --git a/arch/arm64/include/asm/insn.h b/arch/arm64/include/asm/insn.h > index 1430b4973039..6b776c8667b2 100644 > --- a/arch/arm64/include/asm/insn.h > +++ b/arch/arm64/include/asm/insn.h > @@ -10,10 +10,7 @@ > #include > #include > > -#include > - > -/* A64 instructions are always 32 bits. */ > -#define AARCH64_INSN_SIZE 4 > +#include > > #ifndef __ASSEMBLY__ > /* > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel