From: Al Viro <viro@zeniv.linux.org.uk>
To: linux-arch@vger.kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: [RFC][PATCHES] untangling asm/param.h
Date: Mon, 2 Dec 2024 04:02:07 +0000 [thread overview]
Message-ID: <20241202040207.GM3387508@ZenIV> (raw)
Currently the kernel-side include of asm/param.h is handled in four
different ways, depending upon the architecture:
1) alpha:
asm/param.h resolves to arch/alpha/include/asm/param.h, which
* pulls uapi/asm/param.h (resolves to arch/alpha/include/uapi/asm/param.h)
* which defines HZ, EXEC_PAGESIZE, NOGROUP and MAXHOSTNAMELEN
* undefines HZ
* redefines HZ to CONFIG_HZ
* defines USER_HZ to 1024, which is what uapi/asm/param.h had for HZ
* defines CLOCKS_PER_SEC to USER_HZ
2) arc, arm, csky, microblaze, nios2, parisc, powerpc, riscv, s390, sh, x86:
asm/param.h resolves to (generated) arch/$ARCH/include/uapi/asm/param.h, which
* pulls asm-generic/param.h, which resolves to include/asm-generic/param.h, which
* pulls uapi/asm-generic/param.h (resolves to include/uapi/asm-generic/param.h)
* which defines HZ, EXEC_PAGESIZE, NOGROUP and MAXHOSTNAMELEN
* undefines HZ
* redefines HZ to CONFIG_HZ
* defines USER_HZ to 100, which is what uapi/asm-generic/param.h had for HZ
* defines CLOCKS_PER_SEC to USER_HZ
3) arm64, hexagon, m68k, mips, openrisc, sparc:
asm/param.h resolves to arch/$ARCH/include/uapi/asm/param.h, which
* defines EXEC_PAGESIZE
* pulls asm-generic/param.h, which resolves to include/asm-generic/param.h, which
* pulls uapi/asm-generic/param.h (resolves to include/uapi/asm-generic/param.h)
* which defines HZ, NOGROUP and MAXHOSTNAMELEN
* undefines HZ
* redefines HZ to CONFIG_HZ
* defines USER_HZ to 100, which is what uapi/asm-generic/param.h had for HZ
* defines CLOCKS_PER_SEC to USER_HZ
4) loongarch, um, xtensa:
asm/param.h resolves to (generated) arch/$ARCH/include/asm/param.h, which
* pulls asm-generic/param.h, which resolves to include/asm-generic/param.h, which
* pulls uapi/asm-generic/param.h (resolves to include/uapi/asm-generic/param.h)
* which defines HZ, EXEC_PAGESIZE, NOGROUP and MAXHOSTNAMELEN
* undefines HZ
* redefines HZ to CONFIG_HZ
* defines USER_HZ to 100, which is what uapi/asm-generic/param.h had for HZ
* defines CLOCKS_PER_SEC to USER_HZ
There is an additional complication for userland side of xtensa - it has
a private copy of include/uapi/asm-generic/param.h, with extra definition
(NGROUPS) stuck in it.
Once upon a time we used to have NGROUPS in all asm/param.h (all with the
same value); in 2004 that got removed, along with the limit on number
of supplementary groups. Unfortunately, xtensa port got started out
of tree before the purge and hadn't been merged into mainline until
2005, and several years down the road that was enough to escape the
consolidation of asm/param.h.
The difference between alpha and the rest of architectures is that on
alpha the userland HZ is not 100 but 1024. That wouldn't be a big deal,
but kernel-side we want the userland definition seen as USER_HZ, with
HZ itself redefined as CONFIG_HZ. Since nothing in the macro body gets
expanded at #define time, there's no way to preserve the value HZ had
been defined to - not after we redefine it.
This series massages the things to simpler and more uniform shape.
By the end of it,
* all arch/*/include/uapi/asm/param.h are either generated includes
of <asm-generic/param.h> or a #define or two followed by such include.
* no arch/*/include/asm/param.h anywhere, generated or not.
* include <asm/param.h> resolves to arch/*/include/uapi/asm/param.h
of the architecture in question (or that of host in case of uml).
* include/asm-generic/param.h pulls uapi/asm-generic/param.h and
deals with USER_HZ, CLOCKS_PER_SEC and with HZ redefinition after that.
Branch lives in
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git #headers.param
individual patches in followups. Review and testing would be welcome...
next reply other threads:[~2024-12-02 4:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-02 4:02 Al Viro [this message]
2024-12-02 4:02 ` [PATCH 1/3] xtensa: get rid uapi/asm/param.h Al Viro
2025-06-20 15:34 ` Arnd Bergmann
2024-12-02 4:03 ` [PATCH 2/3] alpha: regularize the situation with asm/param.h Al Viro
2025-06-20 15:33 ` Arnd Bergmann
2024-12-02 4:04 ` [PATCH 3/3] loongarch, um, xtensa: get rid of generated arch/$ARCH/include/asm/param.h Al Viro
2025-06-20 15:34 ` Arnd Bergmann
2025-06-14 6:38 ` [RFC][PATCHES] untangling asm/param.h Al Viro
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=20241202040207.GM3387508@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=arnd@arndb.de \
--cc=linux-arch@vger.kernel.org \
--cc=torvalds@linux-foundation.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