public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Ian Rogers" <irogers@google.com>,
	"Tiezhu Yang" <yangtiezhu@loongson.cn>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-riscv@lists.infradead.org, loongarch@lists.linux.dev,
	Linux-Arch <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: Re: [PATCH v3 0/2] Unify uapi bitsperlong.h
Date: Fri, 14 Jul 2023 21:56:04 +0200	[thread overview]
Message-ID: <bf997965-71d1-4949-8cbc-de46ac6a1283@app.fastmail.com> (raw)
In-Reply-To: <CAP-5=fWmPQ9vtH1t9pSPCPBiOFxQQe43C7Bk4amLS08ASAnwGg@mail.gmail.com>

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2023-07-14 19:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-22 14:13 [PATCH v3 0/2] Unify uapi bitsperlong.h Tiezhu Yang
2023-06-22 14:13 ` [PATCH v3 1/2] asm-generic: Unify uapi bitsperlong.h for arm64, riscv and loongarch Tiezhu Yang
2023-07-27 21:36   ` Nathan Chancellor
2023-07-28 11:00     ` Arnd Bergmann
2023-07-28 17:31       ` Nathan Chancellor
2023-07-28 20:56         ` Arnd Bergmann
2023-07-28 23:44           ` Nathan Chancellor
2023-07-29  7:59             ` Arnd Bergmann
2023-07-29 17:46               ` Nathan Chancellor
2023-07-29 21:12                 ` Arnd Bergmann
2023-07-31 16:04                   ` Nathan Chancellor
2023-06-22 14:13 ` [PATCH v3 2/2] tools arch: Remove uapi bitsperlong.h of hexagon and microblaze Tiezhu Yang
2023-06-22 15:09 ` [PATCH v3 0/2] Unify uapi bitsperlong.h Arnd Bergmann
2023-07-14 18:34   ` Ian Rogers
2023-07-14 19:56     ` Arnd Bergmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bf997965-71d1-4949-8cbc-de46ac6a1283@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=bpf@vger.kernel.org \
    --cc=irogers@google.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=loongarch@lists.linux.dev \
    --cc=loongson-kernel@lists.loongnix.cn \
    --cc=yangtiezhu@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox