From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linux-alpha@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org,
loongarch@lists.linux.dev, linux-mips@vger.kernel.org,
linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org,
sparclinux@vger.kernel.org, x86@kernel.org, bpf@vger.kernel.org,
linux-perf-users@vger.kernel.org,
linux-kselftest@vger.kernel.org,
Linux-Arch <linux-arch@vger.kernel.org>,
llvm@lists.linux.dev, linux-kernel@vger.kernel.org,
loongson-kernel@lists.loongnix.cn
Subject: Re: [RFC PATCH] asm-generic: Unify uapi bitsperlong.h
Date: Thu, 8 Jun 2023 15:04:13 +0800 [thread overview]
Message-ID: <76d3be65-91df-7969-5303-38231a7df926@loongson.cn> (raw)
In-Reply-To: <b9624545-2c80-49a1-ac3c-39264a591f7b@app.fastmail.com>
Hi all,
On 05/09/2023 05:37 PM, Arnd Bergmann wrote:
> On Tue, May 9, 2023, at 09:05, Tiezhu Yang wrote:
>> Now we specify the minimal version of GCC as 5.1 and Clang/LLVM as 11.0.0
>> in Documentation/process/changes.rst, __CHAR_BIT__ and __SIZEOF_LONG__ are
>> usable, just define __BITS_PER_LONG as (__CHAR_BIT__ * __SIZEOF_LONG__) in
>> asm-generic uapi bitsperlong.h, simpler, works everywhere.
>>
>> Remove all the arch specific uapi bitsperlong.h which will be generated as
>> arch/*/include/generated/uapi/asm/bitsperlong.h.
>>
>> Suggested-by: Xi Ruoyao <xry111@xry111.site>
>> Link:
>> https://lore.kernel.org/all/d3e255e4746de44c9903c4433616d44ffcf18d1b.camel@xry111.site/
>> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
>
> I originally introduced the bitsperlong.h header, and I'd love to
> see it removed if it's no longer needed. Your patch certainly
> seems like it does this well.
>
> There is one minor obstacle to this, which is that the compiler
> requirements for uapi headers are not the same as for kernel
> internal code. In particular, the uapi headers may be included
> by user space code that is built with an older compiler version,
> or with a compiler that is not gcc or clang.
>
> I think we are completely safe on the architectures that were
> added since the linux-3.x days (arm64, riscv, csky, openrisc,
> loongarch, nios2, and hexagon), but for the older ones there
> is a regression risk. Especially on targets that are not that
> actively maintained (sparc, alpha, ia64, sh, ...) there is
> a good chance that users are stuck on ancient toolchains.
>
> It's probably also a safe assumption that anyone with an older
> libc version won't be using the latest kernel headers, so
> I think we can still do this across architectures if both
> glibc and musl already require a compiler that is new enough,
> or alternatively if we know that the kernel headers require
> a new compiler for other reasons and nobody has complained.
>
> For glibc, it looks the minimum compiler version was raised
> from gcc-5 to gcc-8 four years ago, so we should be fine.
>
> In musl, the documentation states that at least gcc-3.4 or
> clang-3.2 are required, which probably predate the
> __SIZEOF_LONG__ macro. On the other hand, musl was only
> released in 2011, and building musl itself explicitly
> does not require kernel uapi headers, so this may not
> be too critical.
>
> There is also uClibc, but I could not find any minimum
> supported compiler version for that. Most commonly, this
> one is used for cross-build environments, so it's also
> less likely to have libc/gcc/headers being wildly out of
> sync. Not sure.
>
> Arnd
>
> [1] https://sourceware.org/pipermail/libc-alpha/2019-January/101010.html
>
Thanks Arnd for the detailed reply.
Any more comments? What should I do in the next step?
Thanks,
Tiezhu
next prev parent reply other threads:[~2023-06-08 7:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-09 7:05 [RFC PATCH] asm-generic: Unify uapi bitsperlong.h Tiezhu Yang
2023-05-09 9:37 ` Arnd Bergmann
2023-06-08 7:04 ` Tiezhu Yang [this message]
2023-06-08 12:56 ` Arnd Bergmann
2023-06-09 6:50 ` Tiezhu Yang
2023-06-09 13:05 ` Xi Ruoyao
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=76d3be65-91df-7969-5303-38231a7df926@loongson.cn \
--to=yangtiezhu@loongson.cn \
--cc=arnd@arndb.de \
--cc=bpf@vger.kernel.org \
--cc=linux-alpha@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-s390@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=llvm@lists.linux.dev \
--cc=loongarch@lists.linux.dev \
--cc=loongson-kernel@lists.loongnix.cn \
--cc=sparclinux@vger.kernel.org \
--cc=x86@kernel.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).