Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp2836434rwp; Fri, 14 Jul 2023 12:07:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlEckBAQgOK8hzjCCQPROxg2yDihTpiYV4kc39RZX6UT5uqpCkr8/vkKbUYGzNosCBTBVtnM X-Received: by 2002:a17:902:9043:b0:1b8:b841:3ff2 with SMTP id w3-20020a170902904300b001b8b8413ff2mr3723401plz.64.1689361646449; Fri, 14 Jul 2023 12:07:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689361646; cv=none; d=google.com; s=arc-20160816; b=K8MGMGdHX4dPNRguQ4pfd/OYC6G1MCTpMaQ7b9K1xfwZGzUL+fuGN9YkIrLri8pHw2 SUynIjHaT229oM06tYFme4TYnoGAxO/ZX9b9JJ01G+nJmEJva65ENoZEGDZ/x5wXR5yT 7RkpK6YSD92ELh4RbWmBLtZBEVtUpggoyNqijRf8Aa6+ddV1S/TBVETO+ks4GqSyQJSP 0xrw13YHrrVTu7vAt4jUtd0eSy03cnW4tRgcA+pcjNhXB1XaBXB2KrIm2Jkf5poun0LL 7CR9Eazz4LzPeCM6lNaJYk1zMBz7ZztlxUhG1qufZ0FN7DwllM8tkvzPBHQpAjEliKCf +dFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=MoxXHdLDuf7uBFW6SzS0r7koKHamZIMQJhfLSozBhPo=; fh=eT6eYjuJK7G/cb53U95prLeBVJM/kQCc1nzCUyG4WhY=; b=eHoWRF2b5sxLwOMUSMIL2axcukr9AL8gw9/RtNeC6jlz3Wy1gYf4beMWurAryCahAX cIZehTWxA0OJ1tLSkPBkXrt+zoW/CDJjIWMBfR0suCQdMvY+TzR8X8Vq6xW3AqAKwEWy Qwt2FL9+ayUaP9CZNnEy0H+cTxqSTTAzkQWZCM0QRlrsK4kr2Rq8U6UjxBRj2BFEImL4 db+NJHD83BBz+cigsK0FG1ArLG6GEvLpo2bgVdOYk6lwZmX1axalGpttoKtww3uKBPwy ia1SWvKXpfmKEEY1fh8iezT3bBsC4wF9IbtkEFCs73ZP6Z6s6tyIwOuCI5PlnhtTyWXh lMng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=CoJVUT8L; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ko5-20020a17090307c500b001b5219acbbfsi7298664plb.359.2023.07.14.12.07.14; Fri, 14 Jul 2023 12:07:26 -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=@google.com header.s=20221208 header.b=CoJVUT8L; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236876AbjGNSe6 (ORCPT + 99 others); Fri, 14 Jul 2023 14:34:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236871AbjGNSey (ORCPT ); Fri, 14 Jul 2023 14:34:54 -0400 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CB3B2D79 for ; Fri, 14 Jul 2023 11:34:51 -0700 (PDT) Received: by mail-il1-x12b.google.com with SMTP id e9e14a558f8ab-3460770afe2so14485ab.1 for ; Fri, 14 Jul 2023 11:34:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689359690; x=1691951690; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=MoxXHdLDuf7uBFW6SzS0r7koKHamZIMQJhfLSozBhPo=; b=CoJVUT8LU2AtfsX0295LW0wALbl6vjYJVVvw4PYNsoOUACUrTE5e7vF2/JNBuTVytu 1YN5mfJ5LmOjGrkFWCjokami+/m/20rMXkXJE+kyg8lWJV1fM/eT2A5BSdTJVC10fUVP m/jcur+F1HfXOrnBNG3g4Z19YMly7vmf9OEGqCUncUEzhxkpRosdoOP4mfNJoabA4aFt bFSjNtQ8UDmaME5akhRaiUq6QjCF6ow/oqaG67xGj8OmK0bkihegJlrVL02S3uaHb+gx KJOLY1eELEHcsQjQJkzgzu2IlUsCPPJn84DLtUo2c4kVvsCgeYxQ7CLrtnN9yNYVzjuO 7vsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689359690; x=1691951690; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MoxXHdLDuf7uBFW6SzS0r7koKHamZIMQJhfLSozBhPo=; b=TjsFDk/08yDjPGH2vnIZ0W1TBuNU7yTA2oN5XMsNQuyZHTbwULGnlSvoiw++3sl8VV hGIjLEOsq6aOFDm9xqk9Ot4ifXFnxVXT2A9HHjXg5EN2hjw9FJDTqAdPoTgxwDVx/jkK 1quPXETmXCSzEU8HkPOd048DVC/DNY9Q8XhR1w84ME2n5TWAwRvisVALrFArV5TEn2e6 fbwXwQme8XORQFc2h2AE5vG6dCiPodVvoqFmdb9KE+OPuYNvvn0c51lTkxXTxzhtGekF jM21sVUqGM1QejzGkY/JNnh1D2DZbD64vvGddzC4vITEqq9oC3EGscsEBnsMAi9HCwe2 hHiQ== X-Gm-Message-State: ABy/qLYN0SZnkMeiPyN2eS+hfjHqzBnJD8w10auRTFiXa44FdH7JqEr+ WoKbzMjyQYaKrpuR6g4/GJyvaDNkherjq5Aby6co3g== X-Received: by 2002:a05:6e02:1a61:b0:33d:8f9f:9461 with SMTP id w1-20020a056e021a6100b0033d8f9f9461mr972322ilv.18.1689359690226; Fri, 14 Jul 2023 11:34:50 -0700 (PDT) MIME-Version: 1.0 References: <1687443219-11946-1-git-send-email-yangtiezhu@loongson.cn> <1412dbaf-56f4-418b-85ea-681b1c44cc26@app.fastmail.com> In-Reply-To: <1412dbaf-56f4-418b-85ea-681b1c44cc26@app.fastmail.com> From: Ian Rogers Date: Fri, 14 Jul 2023 11:34:38 -0700 Message-ID: Subject: Re: [PATCH v3 0/2] Unify uapi bitsperlong.h To: Arnd Bergmann , Tiezhu Yang Cc: linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, loongarch@lists.linux.dev, Linux-Arch , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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, Jun 22, 2023 at 8:10=E2=80=AFAM Arnd Bergmann 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/too= ls/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/too= ls/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 @@ -21,4 +21,4 @@ #define small_const_nbits(nbits) \ (__builtin_constant_p(nbits) && (nbits) <=3D 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-ya= ngtiezhu@loongson.cn/ > > I've applied these to the asm-generic tree now > > Thanks, > > Arnd