Message ID | 1687443219-11946-1-git-send-email-yangtiezhu@loongson.cn |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5102112vqr; Thu, 22 Jun 2023 07:16:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ66ym5hpUgR/8aeld2vEcVSqgkIyGvibyNwvsFCvO4GMFuTSubngBNOqAsQdrgBlptyENeY X-Received: by 2002:a05:6a21:3a91:b0:119:69eb:886a with SMTP id zv17-20020a056a213a9100b0011969eb886amr14556737pzb.23.1687443377977; Thu, 22 Jun 2023 07:16:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687443377; cv=none; d=google.com; s=arc-20160816; b=tdWSNcwvA1JjuBM5PBNxFQTSwx0CwzWnxqRQk/S+p7uQclLI/iucrIw/1RDchm3lQy OH7uXDjtvb6Brm+kYfJzNVjT2PCVHM5WZgwKOGjo4ZPz/jihhMMOvNK77kXEVNeZ24wy wtLyLyWwIZRAHTs/XA4iysqy4NJ6O2f/O8uuEGfCKL38PWz2EqU608rf8ELJAV4/mpPu LEyL9soPN3luRwiYTRlaUphZqBX5sGqeiQmSHrUGgNJR0nGAaYJPGaXbZuKa7BMmkiC/ WxeJQh4EwqcybKPprLIE984teefym+QrJ29IMDQ1+lFEkQ3ktw6wTp74R/1zZQVyH9yc 3Q5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=17ROMJ1GIJ8ijujrwt52NMYKkh2qRu9wt3g9pTd44yQ=; b=bCHiHyfL+iHh6DcLnA4cHmmQ81225jkYYnbK6V9oF9BOlEn/S30Lw3PlkPJJVwQFgL OXR33frDJK+Ws1fw4iT8mJCYWpZ20aIKNbA+TqMA+mJIkZmaPhndf4rLtX5Wv1PdX/2Y /XbboJnukXLZUWDr8UKxKhrtCsYMyY3US8jrjL93MFSYlfbUx4FYrk6/9FbHP4wyoMrp zYCO0cFD3Bp1k3r5+i4P+/2LfT2a675kLsUC6moQP3OHReAPhVNSwy+yawJru+tDYizY k/yDUxT87YFWJiVMJ0QVAzZJd/F5LaB74yvSr3RNpLGQoNuqQ6jnWQET3DhlKTp7+dIu w7Aw== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w189-20020a6382c6000000b0055338995061si6467662pgd.754.2023.06.22.07.16.02; Thu, 22 Jun 2023 07:16:17 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231500AbjFVONu (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Thu, 22 Jun 2023 10:13:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230314AbjFVONs (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 22 Jun 2023 10:13:48 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D13D9E2; Thu, 22 Jun 2023 07:13:43 -0700 (PDT) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8Bx28YVV5Rk8XMAAA--.773S3; Thu, 22 Jun 2023 22:13:41 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxJ80TV5RkZSsCAA--.10045S2; Thu, 22 Jun 2023 22:13:40 +0800 (CST) From: Tiezhu Yang <yangtiezhu@loongson.cn> To: Arnd Bergmann <arnd@arndb.de> Cc: linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, loongarch@lists.linux.dev, linux-arch@vger.kernel.org, bpf@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn Subject: [PATCH v3 0/2] Unify uapi bitsperlong.h Date: Thu, 22 Jun 2023 22:13:37 +0800 Message-Id: <1687443219-11946-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf8DxJ80TV5RkZSsCAA--.10045S2 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj93XoW7ZF4rXFy3Kr4UKF17tr45CFX_yoW8tr15pF 93ArnxWF45CrWay3yrJa40qryUA397Gr4jgay2qry8XrWIvF1UGrsY9rs3Ca47GayUXFn5 uF9xGry5Ga1DK3XCm3ZEXasCq-sJn29KB7ZKAUJUUUU5529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUk2b4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r106r15M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Jr0_JF4l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Jr0_Gr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx 1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1Y6r17McIj6I8E87Iv 67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2 Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s02 6x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0x vE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE 42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6x kF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxU7XTmDUUUU X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769412627181601225?= X-GMAIL-MSGID: =?utf-8?q?1769412627181601225?= |
Series | Unify uapi bitsperlong.h | |
Message
Tiezhu Yang
June 22, 2023, 2:13 p.m. UTC
v3: -- Check the definition of __BITS_PER_LONG first at the beginning of uapi/asm-generic/bitsperlong.h v2: -- Check __CHAR_BIT__ and __SIZEOF_LONG__ rather than __aarch64__, __riscv, __loongarch__, thanks Ruoyao -- Update the code comment and commit message v1: -- Rebase on 6.4-rc6 -- Only unify uapi bitsperlong.h for arm64, riscv and loongarch -- Remove uapi bitsperlong.h of hexagon and microblaze in a new patch Here is the RFC patch: https://lore.kernel.org/linux-arch/1683615903-10862-1-git-send-email-yangtiezhu@loongson.cn/ Tiezhu Yang (2): asm-generic: Unify uapi bitsperlong.h for arm64, riscv and loongarch tools arch: Remove uapi bitsperlong.h of hexagon and microblaze arch/arm64/include/uapi/asm/bitsperlong.h | 24 ------------------- arch/loongarch/include/uapi/asm/bitsperlong.h | 9 -------- arch/riscv/include/uapi/asm/bitsperlong.h | 14 ----------- include/uapi/asm-generic/bitsperlong.h | 13 ++++++++++- tools/arch/arm64/include/uapi/asm/bitsperlong.h | 24 ------------------- tools/arch/hexagon/include/uapi/asm/bitsperlong.h | 27 ---------------------- .../arch/loongarch/include/uapi/asm/bitsperlong.h | 9 -------- .../arch/microblaze/include/uapi/asm/bitsperlong.h | 2 -- tools/arch/riscv/include/uapi/asm/bitsperlong.h | 14 ----------- tools/include/uapi/asm-generic/bitsperlong.h | 14 ++++++++++- tools/include/uapi/asm/bitsperlong.h | 6 ----- 11 files changed, 25 insertions(+), 131 deletions(-) delete mode 100644 arch/arm64/include/uapi/asm/bitsperlong.h delete mode 100644 arch/loongarch/include/uapi/asm/bitsperlong.h delete mode 100644 arch/riscv/include/uapi/asm/bitsperlong.h delete mode 100644 tools/arch/arm64/include/uapi/asm/bitsperlong.h delete mode 100644 tools/arch/hexagon/include/uapi/asm/bitsperlong.h delete mode 100644 tools/arch/loongarch/include/uapi/asm/bitsperlong.h delete mode 100644 tools/arch/microblaze/include/uapi/asm/bitsperlong.h delete mode 100644 tools/arch/riscv/include/uapi/asm/bitsperlong.h
Comments
On Thu, Jun 22, 2023, at 16:13, Tiezhu Yang wrote: > v3: > -- Check the definition of __BITS_PER_LONG first at > the beginning of uapi/asm-generic/bitsperlong.h > > v2: > -- Check __CHAR_BIT__ and __SIZEOF_LONG__ rather than > __aarch64__, __riscv, __loongarch__, thanks Ruoyao > -- Update the code comment and commit message > > v1: > -- Rebase on 6.4-rc6 > -- Only unify uapi bitsperlong.h for arm64, riscv and loongarch > -- Remove uapi bitsperlong.h of hexagon and microblaze in a new patch > > Here is the RFC patch: > https://lore.kernel.org/linux-arch/1683615903-10862-1-git-send-email-yangtiezhu@loongson.cn/ I've applied these to the asm-generic tree now Thanks, Arnd
On Thu, Jun 22, 2023 at 8:10 AM Arnd Bergmann <arnd@arndb.de> wrote: > > On Thu, Jun 22, 2023, at 16:13, Tiezhu Yang wrote: > > v3: > > -- Check the definition of __BITS_PER_LONG first at > > the beginning of uapi/asm-generic/bitsperlong.h > > Thanks for doing this cleanup! I just wanted to report an issue I ran into with building the Linux perf tool. The header guard in: tools/include/asm-generic/bitsperlong.h https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/include/asm-generic/bitsperlong.h Caused an issue with building: tools/perf/util/cs-etm.c https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/util/cs-etm.c The issue was that cs-etm.c would #include a system header, which would transitively include a header with the same header guard. This led to the tools/include/asm-generic/bitsperlong.h being ignored and the compilation of tools/perf/util/cs-etm.c failing due to a missing define. My local workaround is: ``` diff --git a/tools/include/asm-generic/bitsperlong.h b/tools/include/asm-generic/bitsperlong.h index 2093d56ddd11..88508a35cb45 100644 --- a/tools/include/asm-generic/bitsperlong.h +++ b/tools/include/asm-generic/bitsperlong.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_GENERIC_BITS_PER_LONG -#define __ASM_GENERIC_BITS_PER_LONG +#ifndef __LINUX_TOOLS_ASM_GENERIC_BITS_PER_LONG +#define __LINUX_TOOLS_ASM_GENERIC_BITS_PER_LONG #include <uapi/asm-generic/bitsperlong.h> @@ -21,4 +21,4 @@ #define small_const_nbits(nbits) \ (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG && (nbits) > 0) -#endif /* __ASM_GENERIC_BITS_PER_LONG */ +#endif /* __LINUX_TOOLS_ASM_GENERIC_BITS_PER_LONG */ ``` I'm not sure if a wider fix is necessary for this, but I thought it worthwhile to report that there are potential issues. I don't think we can use #pragma once, as an alternative to header guards, to avoid this kind of name collision. Thanks, Ian > > v2: > > -- Check __CHAR_BIT__ and __SIZEOF_LONG__ rather than > > __aarch64__, __riscv, __loongarch__, thanks Ruoyao > > -- Update the code comment and commit message > > > > v1: > > -- Rebase on 6.4-rc6 > > -- Only unify uapi bitsperlong.h for arm64, riscv and loongarch > > -- Remove uapi bitsperlong.h of hexagon and microblaze in a new patch > > > > Here is the RFC patch: > > https://lore.kernel.org/linux-arch/1683615903-10862-1-git-send-email-yangtiezhu@loongson.cn/ > > I've applied these to the asm-generic tree now > > Thanks, > > Arnd
On Fri, Jul 14, 2023, at 20:34, Ian Rogers wrote: > On Thu, Jun 22, 2023 at 8:10 AM Arnd Bergmann <arnd@arndb.de> wrote: >> >> On Thu, Jun 22, 2023, at 16:13, Tiezhu Yang wrote: >> > v3: >> > -- Check the definition of __BITS_PER_LONG first at >> > the beginning of uapi/asm-generic/bitsperlong.h >> > > > Thanks for doing this cleanup! I just wanted to report an issue I ran > into with building the Linux perf tool. The header guard in: > tools/include/asm-generic/bitsperlong.h > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/include/asm-generic/bitsperlong.h > > Caused an issue with building: > tools/perf/util/cs-etm.c > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/util/cs-etm.c > > The issue was that cs-etm.c would #include a system header, which > would transitively include a header with the same header guard. This > led to the tools/include/asm-generic/bitsperlong.h being ignored and > the compilation of tools/perf/util/cs-etm.c failing due to a missing > define. My local workaround is: > > ``` > diff --git a/tools/include/asm-generic/bitsperlong.h > b/tools/include/asm-generic/bitsperlong.h > index 2093d56ddd11..88508a35cb45 100644 > --- a/tools/include/asm-generic/bitsperlong.h > +++ b/tools/include/asm-generic/bitsperlong.h > @@ -1,6 +1,6 @@ > /* SPDX-License-Identifier: GPL-2.0 */ > -#ifndef __ASM_GENERIC_BITS_PER_LONG > -#define __ASM_GENERIC_BITS_PER_LONG > +#ifndef __LINUX_TOOLS_ASM_GENERIC_BITS_PER_LONG > +#define __LINUX_TOOLS_ASM_GENERIC_BITS_PER_LONG > #include <uapi/asm-generic/bitsperlong.h> > @@ -21,4 +21,4 @@ > #define small_const_nbits(nbits) \ > (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG && (nbits) > 0) > -#endif /* __ASM_GENERIC_BITS_PER_LONG */ > +#endif /* __LINUX_TOOLS_ASM_GENERIC_BITS_PER_LONG */ > ``` > > I'm not sure if a wider fix is necessary for this, but I thought it > worthwhile to report that there are potential issues. I don't think we > can use #pragma once, as an alternative to header guards, to avoid > this kind of name collision. Thanks for the report! I think the correct fix is to update the tools/include/ headers to have the same change as the kernel itself. I don't know why we end up including both, that sounds like a separate issue but should normally be harmless as long as the contents are the same. Arnd