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=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 74420C48BE5 for ; Mon, 21 Jun 2021 08:10:52 +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 3BE8B61042 for ; Mon, 21 Jun 2021 08:10:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3BE8B61042 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com 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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=X9qfISyQssQLlucRwSAlFhV7dR3qp/MPmQr008oYcss=; b=lRdVTtb89Sw5lG KAwuqCY0TP2M8+wS0vRiYobUhUb/DvBs/PL7wKdCyl3c8ZZQmPXLSLqhXBQ+F4H4KoOPpFsRa0VOv yCPClNJn06mCsr2GBn3/J3LT64tUYwMN4KfjSpmkyx7gLfAefxkyJiBm/NqcJ/JrNJiP1aZHCF8Oa DOYNXBZu5VbPASTY8yNqKJX1eIg/6hs7L0TC8Om/hUZ+o/tz4QCSSWCzsWyflg80n6yxGUgWiYdMO Lq1Obz3sJs91O25S+AyzNsMk5aHtmThGE0aCpo6wkToWrhpemtVUx0mLOSA8A/04CteO6N9WBOKSK 91kkhpl1HK5dc730S1gw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lvEzO-002daY-Dw; Mon, 21 Jun 2021 08:09:02 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lvEzK-002dZo-FB for linux-arm-kernel@lists.infradead.org; Mon, 21 Jun 2021 08:09:00 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5B928D6E; Mon, 21 Jun 2021 01:08:51 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.12.39]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E1B3F3F718; Mon, 21 Jun 2021 01:08:49 -0700 (PDT) Date: Mon, 21 Jun 2021 09:08:30 +0100 From: Mark Rutland To: Nathan Chancellor Cc: will@kernel.org, linux-arm-kernel@lists.infradead.org, Catalin Marinas , clang-built-linux@googlegroups.com Subject: Re: [PATCH 2/2] arm64: insn: move AARCH64_INSN_SIZE into Message-ID: <20210621080830.GA37068@C02TD0UTHF1T.local> References: <20210609102301.17332-1-mark.rutland@arm.com> <20210609102301.17332-3-mark.rutland@arm.com> <20210618151835.GC8318@C02TD0UTHF1T.local> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210621_010858_652125_E300AB38 X-CRM114-Status: GOOD ( 39.56 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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? 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__ /* -- 2.11.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel