Re: [PATCH 4/5] kbuild: unify vdso_install rules
On Mon 09 Oct 2023 21:42:09 GMT, Masahiro Yamada wrote: > Currently, there is no standard implementation for vdso_install, > leading to various issues: > > 1. Code duplication > > Many architectures duplicate similar code just for copying files > to the install destination. > > Some architectures (arm, sparc, x86) create build-id symlinks, > introducing more code duplication. > > 2. Accidental updates of in-tree build artifacts > > The vdso_install rule depends on the vdso files to install. > It may update in-tree build artifacts. This can be problematic, > as explained in commit 19514fc665ff ("arm, kbuild: make > "make install" not depend on vmlinux"). > > 3. Broken code in some architectures > > Makefile code is often copied from one architecture to another > without proper adaptation or testing. > > The previous commits removed broken code from csky, UML, and parisc. > > Another issue is that 'make vdso_install' for ARCH=s390 installs > vdso64, but not vdso32. > > To address these problems, this commit introduces the generic vdso_install. > > Architectures that support vdso_install need to define vdso-install-y > in arch/*/Makefile. > > vdso-install-y lists the files to install. For example, arch/x86/Makefile > looks like this: > > vdso-install-$(CONFIG_X86_64) += arch/x86/entry/vdso/vdso64.so.dbg > vdso-install-$(CONFIG_X86_X32_ABI) += > arch/x86/entry/vdso/vdsox32.so.dbg > vdso-install-$(CONFIG_X86_32) += arch/x86/entry/vdso/vdso32.so.dbg > vdso-install-$(CONFIG_IA32_EMULATION) += arch/x86/entry/vdso/vdso32.so.dbg > > These files will be installed to $(MODLIB)/vdso/ with the .dbg suffix, > if exists, stripped away. > > vdso-install-y can optionally take the second field after the colon > separator. This is needed because some architectures install vdso > files as a different base name. > > The following is a snippet from arch/arm64/Makefile. > > vdso-install-$(CONFIG_COMPAT_VDSO) += > arch/arm64/kernel/vdso32/vdso.so.dbg:vdso32.so > > This will rename vdso.so.dbg to vdso32.so during installation. If such > architectures change their implementation so that the file names match, > this workaround will go away. > > Signed-off-by: Masahiro Yamada > --- Thanks for cleaning this up! Reviewed-by: Nicolas Schier
Re: [PATCH v2 2/2] kbuild: unify no-compiler-targets and no-sync-config-targets
On Sat, Oct 14, 2023 at 07:54:36PM +0900, Masahiro Yamada wrote: > Now that vdso_install does not depend on any in-tree build artifact, > it no longer needs a compiler, making no-compiler-targets the same > as no-sync-config-targets. > > Signed-off-by: Masahiro Yamada > --- > > Changes in v2: > - Revive need-compiler flag > Reviewed-by: Nicolas Schier
Re: [PATCH] Use CRC32 and a 1MiB dictionary for XZ compressed modules
In linux-modules@v.k.o probably some more experts can comment on this: On Fri, Sep 15, 2023 at 12:15:39PM +0200, Martin Nybo Andersen wrote: > Kmod is now using the kernel decompressor which doesn't handle CRC64 > and dictionaries larger than 1MiB. > > Fixes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1050582 > Signed-off-by: Martin Nybo Andersen > --- > scripts/Makefile.modinst | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst > index c59cc57286ba..ffbafbd3aeea 100644 > --- a/scripts/Makefile.modinst > +++ b/scripts/Makefile.modinst > @@ -144,7 +144,7 @@ endif > quiet_cmd_gzip = GZIP$@ >cmd_gzip = $(KGZIP) -n -f $< > quiet_cmd_xz = XZ $@ > - cmd_xz = $(XZ) --lzma2=dict=2MiB -f $< > + cmd_xz = $(XZ) --check=crc32 --lzma2=dict=1MiB -f $< > quiet_cmd_zstd = ZSTD$@ >cmd_zstd = $(ZSTD) -T0 --rm -f -q $< > > -- > 2.40.1
[PATCH v2] ovl: fix typo in MODULE_PARM_DESC
From: Nicolas Schier Change first argument of MODULE_PARM_DESC() calls, such that each of them matches the actual module parameter name. The patch results in changing (the 'parm' section from) the output of `modinfo overlay`: parm: ovl_check_copy_up:Obsolete; does nothing parm: redirect_max:ushort parm: ovl_redirect_max:Maximum length of absolute redirect xattr value parm: redirect_dir:bool parm: ovl_redirect_dir_def:Default to on or off for the redirect_ [...] parm: redirect_always_follow:bool parm: ovl_redirect_always_follow:Follow redirects even if [...] parm: index:bool parm: ovl_index_def:Default to on or off for the inodes index [...] parm: nfs_export:bool parm: ovl_nfs_export_def:Default to on or off for the NFS export [...] parm: xino_auto:bool parm: ovl_xino_auto_def:Auto enable xino feature parm: metacopy:bool parm: ovl_metacopy_def:Default to on or off for the metadata only [...] into: parm: check_copy_up:Obsolete; does nothing parm: redirect_max:Maximum length of absolute redirect xattr [...] parm: redirect_dir:Default to on or off for the redirect_dir [...] parm: redirect_always_follow:Follow redirects even if [...] parm: index:Default to on or off for the inodes index feature [...] parm: nfs_export:Default to on or off for the NFS export feature [...] parm: xino_auto:Auto enable xino feature (bool) parm: metacopy:Default to on or off for the metadata only copy up [...] Signed-off-by: Nicolas Schier --- Changes since v1: - update/fix commit message wording (now completely checkpatch compliant) fs/overlayfs/copy_up.c | 2 +- fs/overlayfs/dir.c | 2 +- fs/overlayfs/super.c | 12 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c index 9e62dcf06fc4..e9cdc453f247 100644 --- a/fs/overlayfs/copy_up.c +++ b/fs/overlayfs/copy_up.c @@ -37,7 +37,7 @@ static int ovl_ccup_get(char *buf, const struct kernel_param *param) } module_param_call(check_copy_up, ovl_ccup_set, ovl_ccup_get, NULL, 0644); -MODULE_PARM_DESC(ovl_check_copy_up, "Obsolete; does nothing"); +MODULE_PARM_DESC(check_copy_up, "Obsolete; does nothing"); int ovl_copy_xattr(struct dentry *old, struct dentry *new) { diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c index 82c129bfe58d..dbcb3ff588aa 100644 --- a/fs/overlayfs/dir.c +++ b/fs/overlayfs/dir.c @@ -21,7 +21,7 @@ static unsigned short ovl_redirect_max = 256; module_param_named(redirect_max, ovl_redirect_max, ushort, 0644); -MODULE_PARM_DESC(ovl_redirect_max, +MODULE_PARM_DESC(redirect_max, "Maximum length of absolute redirect xattr value"); static int ovl_set_redirect(struct dentry *dentry, bool samedir); diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 0116735cc321..eb32e68f1a83 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -31,29 +31,29 @@ struct ovl_dir_cache; static bool ovl_redirect_dir_def = IS_ENABLED(CONFIG_OVERLAY_FS_REDIRECT_DIR); module_param_named(redirect_dir, ovl_redirect_dir_def, bool, 0644); -MODULE_PARM_DESC(ovl_redirect_dir_def, +MODULE_PARM_DESC(redirect_dir, "Default to on or off for the redirect_dir feature"); static bool ovl_redirect_always_follow = IS_ENABLED(CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW); module_param_named(redirect_always_follow, ovl_redirect_always_follow, bool, 0644); -MODULE_PARM_DESC(ovl_redirect_always_follow, +MODULE_PARM_DESC(redirect_always_follow, "Follow redirects even if redirect_dir feature is turned off"); static bool ovl_index_def = IS_ENABLED(CONFIG_OVERLAY_FS_INDEX); module_param_named(index, ovl_index_def, bool, 0644); -MODULE_PARM_DESC(ovl_index_def, +MODULE_PARM_DESC(index, "Default to on or off for the inodes index feature"); static bool ovl_nfs_export_def = IS_ENABLED(CONFIG_OVERLAY_FS_NFS_EXPORT); module_param_named(nfs_export, ovl_nfs_export_def, bool, 0644); -MODULE_PARM_DESC(ovl_nfs_export_def, +MODULE_PARM_DESC(nfs_export, "Default to on or off for the NFS export feature"); static bool ovl_xino_auto_def = IS_ENABLED(CONFIG_OVERLAY_FS_XINO_AUTO); module_param_named(xino_auto, ovl_xino_auto_def, bool, 0644); -MODULE_PARM_DESC(ovl_xino_auto_def, +MODULE_PARM_DESC(xino_auto, "Auto enable xino feature"); static void ovl_entry_stack_free(struct ovl_entry *oe) @@ -66,7 +66,7 @@ static void ovl_entry_stack_free(struct ovl_entry *oe) static bool ovl_metacopy_def = IS_ENABLED(CONFIG_OVERLAY_FS_METACOPY); module_param_named(metacopy, ovl_metacopy_def, bool, 0644); -MODULE_PARM_DESC(ovl_metacopy_def, +MODULE_PARM_DESC(metacopy, "Default to on or off for the metadata only copy up feature"); static void ovl_dentry_release(struct dentry *dentry) -- 2.20.1
[PATCH] ovl: fix typo in MODULE_PARM_DESC
Change first argument to MODULE_PARM_DESC() calls, that each of them matched the actual module parameter name. The matching results in changing (the 'parm' section from) the output of `modinfo overlay` from: parm: ovl_check_copy_up:Obsolete; does nothing parm: redirect_max:ushort parm: ovl_redirect_max:Maximum length of absolute redirect xattr value parm: redirect_dir:bool parm: ovl_redirect_dir_def:Default to on or off for the redirect_dir feature parm: redirect_always_follow:bool parm: ovl_redirect_always_follow:Follow redirects even if redirect_dir feature is turned off parm: index:bool parm: ovl_index_def:Default to on or off for the inodes index feature parm: nfs_export:bool parm: ovl_nfs_export_def:Default to on or off for the NFS export feature parm: xino_auto:bool parm: ovl_xino_auto_def:Auto enable xino feature parm: metacopy:bool parm: ovl_metacopy_def:Default to on or off for the metadata only copy up feature into: parm: check_copy_up:Obsolete; does nothing parm: redirect_max:Maximum length of absolute redirect xattr value (ushort) parm: redirect_dir:Default to on or off for the redirect_dir feature (bool) parm: redirect_always_follow:Follow redirects even if redirect_dir feature is turned off (bool) parm: index:Default to on or off for the inodes index feature (bool) parm: nfs_export:Default to on or off for the NFS export feature (bool) parm: xino_auto:Auto enable xino feature (bool) parm: metacopy:Default to on or off for the metadata only copy up feature (bool) Signed-off-by: Nicolas Schier --- fs/overlayfs/copy_up.c | 2 +- fs/overlayfs/dir.c | 2 +- fs/overlayfs/super.c | 12 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c index 9e62dcf06fc4..e9cdc453f247 100644 --- a/fs/overlayfs/copy_up.c +++ b/fs/overlayfs/copy_up.c @@ -37,7 +37,7 @@ static int ovl_ccup_get(char *buf, const struct kernel_param *param) } module_param_call(check_copy_up, ovl_ccup_set, ovl_ccup_get, NULL, 0644); -MODULE_PARM_DESC(ovl_check_copy_up, "Obsolete; does nothing"); +MODULE_PARM_DESC(check_copy_up, "Obsolete; does nothing"); int ovl_copy_xattr(struct dentry *old, struct dentry *new) { diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c index 82c129bfe58d..dbcb3ff588aa 100644 --- a/fs/overlayfs/dir.c +++ b/fs/overlayfs/dir.c @@ -21,7 +21,7 @@ static unsigned short ovl_redirect_max = 256; module_param_named(redirect_max, ovl_redirect_max, ushort, 0644); -MODULE_PARM_DESC(ovl_redirect_max, +MODULE_PARM_DESC(redirect_max, "Maximum length of absolute redirect xattr value"); static int ovl_set_redirect(struct dentry *dentry, bool samedir); diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 0116735cc321..eb32e68f1a83 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -31,29 +31,29 @@ struct ovl_dir_cache; static bool ovl_redirect_dir_def = IS_ENABLED(CONFIG_OVERLAY_FS_REDIRECT_DIR); module_param_named(redirect_dir, ovl_redirect_dir_def, bool, 0644); -MODULE_PARM_DESC(ovl_redirect_dir_def, +MODULE_PARM_DESC(redirect_dir, "Default to on or off for the redirect_dir feature"); static bool ovl_redirect_always_follow = IS_ENABLED(CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW); module_param_named(redirect_always_follow, ovl_redirect_always_follow, bool, 0644); -MODULE_PARM_DESC(ovl_redirect_always_follow, +MODULE_PARM_DESC(redirect_always_follow, "Follow redirects even if redirect_dir feature is turned off"); static bool ovl_index_def = IS_ENABLED(CONFIG_OVERLAY_FS_INDEX); module_param_named(index, ovl_index_def, bool, 0644); -MODULE_PARM_DESC(ovl_index_def, +MODULE_PARM_DESC(index, "Default to on or off for the inodes index feature"); static bool ovl_nfs_export_def = IS_ENABLED(CONFIG_OVERLAY_FS_NFS_EXPORT); module_param_named(nfs_export, ovl_nfs_export_def, bool, 0644); -MODULE_PARM_DESC(ovl_nfs_export_def, +MODULE_PARM_DESC(nfs_export, "Default to on or off for the NFS export feature"); static bool ovl_xino_auto_def = IS_ENABLED(CONFIG_OVERLAY_FS_XINO_AUTO); module_param_named(xino_auto, ovl_xino_auto_def, bool, 0644); -MODULE_PARM_DESC(ovl_xino_auto_def, +MODULE_PARM_DESC(xino_auto, "Auto enable xino feature"); static void ovl_entry_stack_free(struct ovl_entry *oe) @@ -66,7 +66,7 @@ static void ovl_entry_stack_free(struct ovl_entry *oe) static bool ovl_metacopy_def = IS_ENABLED(CONFIG_OVERLAY_FS_METACOPY); module_param_named(metacopy, ovl_metacopy_def, bool, 0644); -MODULE_PARM_DESC(ovl_metacopy_def, +MODULE_PARM_DESC(metacopy, "Default to on or off for the metadata only copy up feature"); static void ovl_dentry_release(struct dentry *dentry) -- 2.20.1
Re: [PATCH v1] kbuild: Allow building of samples with UML
On Tue, Feb 11, 2025 at 06:44:30PM +0900, Masahiro Yamada wrote: > On Wed, Dec 18, 2024 at 8:51 PM Mickaël Salaün wrote: > > > > It's useful to build samples/* with UML and the only blocker is the > > artificial incompatibility with CONFIG_HEADERS_INSTALL. > > > > Allow the headers_install target with ARCH=um, which then allow building > > samples (and tests using them) with UML too: > > > > printf > > 'CONFIG_SAMPLES=y\nCONFIG_HEADERS_INSTALL=y\nCONFIG_SAMPLE_LANDLOCK=y\n' > > >.config > > make ARCH=um olddefconfig headers_install > > make ARCH=um samples/landlock/ > > > > Cc: Anton Ivanov > > Cc: Johannes Berg > > Cc: Masahiro Yamada > > Cc: Nathan Chancellor > > Cc: Nicolas Schier > > Cc: Richard Weinberger > > Fixes: 1b620d539ccc ("kbuild: disable header exports for UML in a > > straightforward way") > > Signed-off-by: Mickaël Salaün > > --- > > Makefile | 1 - > > lib/Kconfig.debug | 1 - > > 2 files changed, 2 deletions(-) > > > > diff --git a/Makefile b/Makefile > > index e5b8a8832c0c..6e2cce16a2a3 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -1355,7 +1355,6 @@ hdr-inst := -f > > $(srctree)/scripts/Makefile.headersinst obj > > > > PHONY += headers > > headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders > > archscripts > > - $(if $(filter um, $(SRCARCH)), $(error Headers not exportable for > > UML)) > > $(Q)$(MAKE) $(hdr-inst)=include/uapi > > $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi > > > > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug > > index f3d723705879..fac1208f48e4 100644 > > --- a/lib/Kconfig.debug > > +++ b/lib/Kconfig.debug > > @@ -473,7 +473,6 @@ config READABLE_ASM > > > > config HEADERS_INSTALL > > bool "Install uapi headers to usr/include" > > - depends on !UML > > help > > This option will install uapi headers (headers exported to > > user-space) > > into the usr/include directory for use during the kernel build. > > -- > > 2.47.1 > > > > This patch was not even compile-tested. > > Apply this patch. > Enable CONFIG_HEADERS_INSTALL and CONFIG_UAPI_HEADERS_TEST. > "make ARCH=um" and see the errors. > > The reason is obvious, UML is a kernel. No such userspace. oh, I sorry. I should have seen that when reviewing, but confused myself as I missed the UAPI_HEADERS_TEST and just looked at a "successful" run of 'make headers_install'. Kind regards, Nicolas
Re: [PATCH v1] kbuild: Allow building of samples with UML
On Wed, Dec 18, 2024 at 12:51:23PM +0100, Mickaël Salaün wrote: > It's useful to build samples/* with UML and the only blocker is the > artificial incompatibility with CONFIG_HEADERS_INSTALL. > > Allow the headers_install target with ARCH=um, which then allow building > samples (and tests using them) with UML too: > > printf > 'CONFIG_SAMPLES=y\nCONFIG_HEADERS_INSTALL=y\nCONFIG_SAMPLE_LANDLOCK=y\n' > >.config > make ARCH=um olddefconfig headers_install > make ARCH=um samples/landlock/ > > Cc: Anton Ivanov > Cc: Johannes Berg > Cc: Masahiro Yamada > Cc: Nathan Chancellor > Cc: Nicolas Schier > Cc: Richard Weinberger > Fixes: 1b620d539ccc ("kbuild: disable header exports for UML in a > straightforward way") > Signed-off-by: Mickaël Salaün > --- > Makefile | 1 - > lib/Kconfig.debug | 1 - > 2 files changed, 2 deletions(-) > Thanks, looks good to me. Reviewed-by: Nicolas Schier
Re: [PATCH] kbuild: use ARCH from compile.h in unclean source tree msg
On Fri, 02 May 2025, Shuah Khan wrote: > When make finds the source tree unclean, it prints a message to run > "make ARCH=x86_64 mrproper" message using the ARCH from the command > line. The ARCH specified in the command line could be different from > the ARCH of the existing build in the source tree. > > This could cause problems in regular kernel build and kunit workflows. > > Regular workflow: > > - Build x86_64 kernel > $ make ARCH=x86_64 > - Try building another arch kernel out of tree with O= > $ make ARCH=um O=/linux/build > - kbuild detects source tree is unclean > > *** > *** The source tree is not clean, please run 'make ARCH=um mrproper' > *** in /linux/linux_srcdir > *** > > - Clean source tree as suggested by kbuild > $ make ARCH=um mrproper > - Source clean appears to be clean, but it leaves behind generated header > files under arch/x86 > arch/x86/realmode/rm/pasyms.h > > A subsequent x86_64e build fails with > "undefined symbol sev_es_trampoline_start referenced ..." > > kunit workflow runs into this issue: > > - Build x86_64 kernel > - Run kunit tests: it tries to build for user specified ARCH or uml > as default: > $ ./tools/testing/kunit/kunit.py run > > - kbuild detects unclean source tree > > *** > *** The source tree is not clean, please run 'make ARCH=um mrproper' > *** in /linux/linux_6.15 > *** > > - Clean source tree as suggested by kbuild > $ make ARCH=um mrproper > - Source clean appears to be clean, but it leaves behind generated header > files under arch/x86 > > The problem shows when user tries to run tests on ARCH=x86_64: > > $ ./tools/testing/kunit/kunit.py run ARCH=x86_64 > > "undefined symbol sev_es_trampoline_start referenced ..." > > Build trips on arch/x86/realmode/rm/pasyms.h left behind by a prior > x86_64 build. > > Problems related to partially cleaned source tree are hard to debug. > Change Makefile to unclean source logic to use ARCH from compile.h > UTS_MACHINE string. With this change kbuild prints: > > $ ./tools/testing/kunit/kunit.py run > > *** > *** The source tree is not clean, please run 'make ARCH=x86_64 mrproper' > *** in /linux/linux_6.15 > *** > > Signed-off-by: Shuah Khan > --- > Makefile | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/Makefile b/Makefile > index 5aa9ee52a765..7ee29136b4da 100644 > --- a/Makefile > +++ b/Makefile > @@ -674,7 +674,7 @@ ifeq ($(KBUILD_EXTMOD),) >-d $(srctree)/include/config -o \ >-d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \ > echo >&2 "***"; \ > - echo >&2 "*** The source tree is not clean, please run > 'make$(if $(findstring command line, $(origin ARCH)), ARCH=$(ARCH)) > mrproper'"; \ > + echo >&2 "*** The source tree is not clean, please run 'make > ARCH=$(shell grep UTS_MACHINE $(srctree)/include/generated/compile.h | cut -d > '"' -f 2) mrproper'"; \ Please 'grep' option '-s'. There are some (rare) occassions, when there is no include/generated/compile.h but still the source tree will be considered to be dirty: grep: ../include/generated/compile.h: No such file or directory *** *** The source tree is not clean, please run 'make ARCH= mrproper' ... Kind regards, Nicolas