summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* initramfs: Remove redundant dependency of RD_ZSTD on BLK_DEV_INITRDGeert Uytterhoeven2021-02-241-1/+0
| | | | | | | | | | Commit be1859bdc660 ("initramfs: remove redundant dependency on BLK_DEV_INITRD") removed all redundant dependencies on BLK_DEV_INITRD, but the recent addition of zstd support introduced a new one. Fixes: a30d8a39f057 ("usr: Add support for zstd compressed initramfs") Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kbuild: remove deprecated 'always' and 'hostprogs-y/m'Masahiro Yamada2021-02-243-16/+0
| | | | | | | These have no more user in the upstream code. The use of them has been warned for a while for external modules. The migration is finished. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kbuild: parse C= and M= before changing the working directoryMasahiro Yamada2021-02-241-30/+31
| | | | | | | | | | If Kbuild recurses to the top Makefile (for example, 'make deb-pkg'), C= and M= are parsed over again, needlessly. Parse them before changing the working directory. After that, sub_make_done is set to 1, so they are parsed just once. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kbuild: reuse this-makefile to define abs_srctreeMasahiro Yamada2021-02-241-3/+2
| | | | | | Move this-makefile up, and reuse it to define abs_srctree. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: unify rule of config, menuconfig, nconfig, gconfig, xconfigMasahiro Yamada2021-02-241-22/+14
| | | | | | | | | Unify the similar build rules. This supports 'make build_config', which builds scripts/kconfig/conf but does not invoke it. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: omit --oldaskconfig option for 'make config'Masahiro Yamada2021-02-242-1/+2
| | | | | | | | | | | scripts/kconfig/conf.c line 39 defines the default of input_mode as oldaskconfig. Hence, 'make config' works in the same way even without the --oldaskconfig option given. Note this in the help message. This will be helpful to unify build rules in Makefile in the next commit. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: fix 'invalid option' for help optionMasahiro Yamada2021-02-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | scripts/kconfig/conf supports -? option to show the help message. This is not wired up to Makefile, so nobody would notice this, but it also shows 'invalid option' message. $ ./scripts/kconfig/conf -? ./scripts/kconfig/conf: invalid option -- '?' Usage: ./scripts/kconfig/conf [-s] [option] <kconfig-file> [option] is _one_ of the following: --listnewconfig List new options --helpnewconfig List new options and help text --oldaskconfig Start a new configuration using a line-oriented program ... The reason is the '?' is missing in the short option list passed to getopt_long(). While I fixed this issue, I also changed the option '?' to 'h'. I prefer -h (or --help, if a long option is also desired). Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: remove dead code in conf_askvalue()Masahiro Yamada2021-02-241-15/+1
| | | | | | | | | | | conf_askvalue() is only called for oldconfig, syncconfig, and oldaskconfig. If it is called for other cases, it is a bug. So, the code after the switch statement is unreachable. Remove the dead code, and clean up the switch statement. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: clean up nested if-conditionals in check_conf()Masahiro Yamada2021-02-241-26/+29
| | | | | | | | | | | | | | | | | | | Unify the outer two if-conditionals into one. This decreases the indent level by one. Also, change the if-else blocks: if (input_mode == listnewconfig) { ... } else if (input_mode == helpnewconfig) { ... } else { ... } into the switch statement. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: Remove duplicate call to sym_get_string_value()Mickaël Salaün2021-02-241-1/+1
| | | | | | | | | Use the saved returned value of sym_get_string_value() instead of calling it twice. Signed-off-by: Mickaël Salaün <mic@linux.microsoft.com> Link: https://lore.kernel.org/r/20210215181511.2840674-2-mic@digikod.net Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* Makefile: Remove # characters from compiler stringNathan Chancellor2021-02-241-1/+1
| | | | | | | | | | | | | | | | | | | | When using AMD's Optimizing C/C++ Compiler (AOCC), the build fails due to a # character in the version string, which is interpreted as a comment: $ make CC=clang defconfig init/main.o include/config/auto.conf.cmd:1374: *** invalid syntax in conditional. Stop. $ sed -n 1374p include/config/auto.conf.cmd ifneq "$(CC_VERSION_TEXT)" "AMD clang version 11.0.0 (CLANG: AOCC_2.3.0-Build#85 2020_11_10) (based on LLVM Mirror.Version.11.0.0)" Remove all # characters in the version string so that the build does not fail unexpectedly. Link: https://github.com/ClangBuiltLinux/linux/issues/1298 Reported-by: Michael Fuckner <michael@fuckner.net> Signed-off-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* Makefile: reuse CC_VERSION_TEXTNick Desaulniers2021-02-241-7/+7
| | | | | | | | | | | | | I noticed we're invoking $(CC) via $(shell) more than once to check the version. Let's reuse the first string captured in $CC_VERSION_TEXT. Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> [masahiro.yamada: CC_VERSION_TEXT is assigned by = instead of :=, so this $(shell ) is evaluated multiple times anyway. The number of $(CC) invocations will be still the same. Replacing 'grep' with the built-in $(findstring ) will give real performance benefit.] Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kbuild: check the minimum linker version in KconfigMasahiro Yamada2021-02-225-41/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unify the two scripts/ld-version.sh and scripts/lld-version.sh, and check the minimum linker version like scripts/cc-version.sh did. I tested this script for some corner cases reported in the past: - GNU ld version 2.25-15.fc23 as reported by commit 8083013fc320 ("ld-version: Fix it on Fedora") - GNU ld (GNU Binutils) 2.20.1.20100303 as reported by commit 0d61ed17dd30 ("ld-version: Drop the 4th and 5th version components") This script show an error message if the linker is too old: $ make LD=ld.lld-9 SYNC include/config/auto.conf *** *** Linker is too old. *** Your LLD version: 9.0.1 *** Minimum LLD version: 10.0.1 *** scripts/Kconfig.include:50: Sorry, this linker is not supported. make[2]: *** [scripts/kconfig/Makefile:71: syncconfig] Error 1 make[1]: *** [Makefile:600: syncconfig] Error 2 make: *** [Makefile:708: include/config/auto.conf] Error 2 I also moved the check for gold to this script, so gold is still rejected: $ make LD=gold SYNC include/config/auto.conf gold linker is not supported as it is not capable of linking the kernel proper. scripts/Kconfig.include:50: Sorry, this linker is not supported. make[2]: *** [scripts/kconfig/Makefile:71: syncconfig] Error 1 make[1]: *** [Makefile:600: syncconfig] Error 2 make: *** [Makefile:708: include/config/auto.conf] Error 2 Thanks to David Laight for suggesting shell script improvements. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Acked-by: Nick Desaulniers <ndesaulniers@google.com> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Tested-by: Nathan Chancellor <nathan@kernel.org>
* kbuild: remove ld-version macroMasahiro Yamada2021-02-221-5/+1
| | | | | | | | There is no direct user of ld-version; you can use CONFIG_LD_VERSION if needed. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org>
* scripts: add generic syscallhdr.shMasahiro Yamada2021-02-221-0/+98
| | | | | | | | | | | | | | | | | | | | | | | | | Most of architectures generate syscall headers at the compile time in a similar way. As of v5.11-rc1, 12 architectures duplicate similar shell scripts: $ find arch -name syscallhdr.sh | sort arch/alpha/kernel/syscalls/syscallhdr.sh arch/arm/tools/syscallhdr.sh arch/ia64/kernel/syscalls/syscallhdr.sh arch/m68k/kernel/syscalls/syscallhdr.sh arch/microblaze/kernel/syscalls/syscallhdr.sh arch/mips/kernel/syscalls/syscallhdr.sh arch/parisc/kernel/syscalls/syscallhdr.sh arch/powerpc/kernel/syscalls/syscallhdr.sh arch/sh/kernel/syscalls/syscallhdr.sh arch/sparc/kernel/syscalls/syscallhdr.sh arch/x86/entry/syscalls/syscallhdr.sh arch/xtensa/kernel/syscalls/syscallhdr.sh My goal is to unify them into scripts/syscallhdr.sh. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* scripts: add generic syscalltbl.shMasahiro Yamada2021-02-221-0/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most of architectures generate syscall headers at the compile time in a similar way. The syscall table has the same format for all architectures. Each line has up to 5 fields; syscall number, ABI, syscall name, native entry point, and compat entry point. The syscall table is processed by syscalltbl.sh script into header files. Despite the same pattern, scripts are maintained per architecture, which results in code duplication and bad maintainability. As of v5.11-rc1, 12 architectures duplicate similar shell scripts: $ find arch -name syscalltbl.sh | sort arch/alpha/kernel/syscalls/syscalltbl.sh arch/arm/tools/syscalltbl.sh arch/ia64/kernel/syscalls/syscalltbl.sh arch/m68k/kernel/syscalls/syscalltbl.sh arch/microblaze/kernel/syscalls/syscalltbl.sh arch/mips/kernel/syscalls/syscalltbl.sh arch/parisc/kernel/syscalls/syscalltbl.sh arch/powerpc/kernel/syscalls/syscalltbl.sh arch/sh/kernel/syscalls/syscalltbl.sh arch/sparc/kernel/syscalls/syscalltbl.sh arch/x86/entry/syscalls/syscalltbl.sh arch/xtensa/kernel/syscalls/syscalltbl.sh My goal is to unify them into scripts/syscalltbl.sh. __SYSCALL_WITH_COMPAT should be defined as follows: 32-bit kernel: #define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, native) 64-bit kernel: #define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, compat) Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* arch: syscalls: remove $(srctree)/ prefix from syscall tablesMasahiro Yamada2021-02-2212-15/+15
| | | | | | | The 'syscall' variables are not directly used in the commands. Remove the $(srctree)/ prefix because we can rely on VPATH. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* arch: syscalls: add missing FORCE and fix 'targets' to make if_changed workMasahiro Yamada2021-02-2211-80/+91
| | | | | | | | | | | | | | The rules in these Makefiles cannot detect the command line change because the prerequisite 'FORCE' is missing. Adding 'FORCE' will result in the headers being rebuilt every time because the 'targets' additions are also wrong; the file paths in 'targets' must be relative to the current Makefile. Fix all of them so the if_changed rules work correctly. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
* gen_compile_commands: prune some directoriesMasahiro Yamada2021-02-161-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If directories are passed to gen_compile_commands.py, os.walk() traverses all the subdirectories to search for .cmd files, but we know some of them are not worth traversing. Use the 'topdown' parameter of os.walk to prune them. Documentation about the 'topdown' option of os.walk: When topdown is True, the caller can modify the dirnames list in-place (perhaps using del or slice assignment), and walk() will only recurse into the subdirectories whose names remain in dirnames; this can be used to prune the search, impose a specific order of visiting, or even to inform walk() about directories the caller creates or renames before it resumes walk() again. Modifying dirnames when topdown is False has no effect on the behavior of the walk, because in bottom-up mode the directories in dirnames are generated before dirpath itself is generated. This commit prunes four directories, .git, Documentation, include, and tools. The first three do not contain any C files, so skipping them makes this script work slightly faster. My main motivation is the last one, tools/ directory. Commit 6ca4c6d25949 ("gen_compile_commands: do not support .cmd files under tools/ directory") stopped supporting the tools/ directory. The current code no longer picks up .cmd files from the tools/ directory. If you run: ./scripts/clang-tools/gen_compile_commands.py --log_level=INFO then, you will see several "File ... not found" log messages. This is expected, and I do not want to support the tools/ directory. However, without an explicit comment "do not support tools/", somebody might try to get it back. Clarify this. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Acked-by: Nathan Chancellor <nathan@kernel.org>
* kbuild: simplify access to the kernel's versionSasha Levin2021-02-166-10/+13
| | | | | | | | | | | | | Instead of storing the version in a single integer and having various kernel (and userspace) code how it's constructed, export individual (major, patchlevel, sublevel) components and simplify kernel code that uses it. This should also make it easier on userspace. Signed-off-by: Sasha Levin <sashal@kernel.org> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kbuild: clamp SUBLEVEL to 255Sasha Levin2021-02-161-3/+9
| | | | | | | | | | | | | | | | | Right now if SUBLEVEL becomes larger than 255 it will overflow into the territory of PATCHLEVEL, causing havoc in userspace that tests for specific kernel version. While userspace code tests for MAJOR and PATCHLEVEL, it doesn't test SUBLEVEL at any point as ABI changes don't happen in the context of stable tree. Thus, to avoid overflows, simply clamp SUBLEVEL to it's maximum value in the context of LINUX_VERSION_CODE. This does not affect "make kernelversion" and such. Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* Kconfig: allow explicit opt in to DWARF v5Nick Desaulniers2021-02-163-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DWARF v5 is the latest standard of the DWARF debug info format. GCC 11 will change the implicit default DWARF version, if left unspecified, to DWARF v5. Allow users of Clang and older versions of GCC that have not changed the implicit default DWARF version to DWARF v5 to opt in. This can help testing consumers of DWARF debug info in preparation of v5 becoming more widespread, as well as result in significant binary size savings of the pre-stripped vmlinux image. DWARF5 wins significantly in terms of size when mixed with compression (CONFIG_DEBUG_INFO_COMPRESSED). 363M vmlinux.clang12.dwarf5.compressed 434M vmlinux.clang12.dwarf4.compressed 439M vmlinux.clang12.dwarf2.compressed 457M vmlinux.clang12.dwarf5 536M vmlinux.clang12.dwarf4 548M vmlinux.clang12.dwarf2 515M vmlinux.gcc10.2.dwarf5.compressed 599M vmlinux.gcc10.2.dwarf4.compressed 624M vmlinux.gcc10.2.dwarf2.compressed 630M vmlinux.gcc10.2.dwarf5 765M vmlinux.gcc10.2.dwarf4 809M vmlinux.gcc10.2.dwarf2 Though the quality of debug info is harder to quantify; size is not a proxy for quality. Jakub notes: One thing is GCC DWARF-5 support, that is whether the compiler will support -gdwarf-5 flag, and that support should be there from GCC 7 onwards. All [GCC] 5.1 - 6.x did was start accepting -gdwarf-5 as experimental option that enabled some small DWARF subset (initially only a few DW_LANG_* codes newly added to DWARF5 drafts). Only GCC 7 (released after DWARF 5 has been finalized) started emitting DWARF5 section headers and got most of the DWARF5 changes in... Another separate thing is whether the assembler does support the -gdwarf-5 option (i.e. if you can compile assembler files with -Wa,-gdwarf-5) ... That option is about whether the assembler will emit DWARF5 or DWARF2 .debug_line. It is fine to compile C sources with -gdwarf-5 and use DWARF2 .debug_line for assembler files if as doesn't support it. Version check GCC so that we don't need to worry about the difference in command line args between GNU readelf and llvm-readelf/llvm-dwarfdump to validate the DWARF Version in the assembler feature detection script. Most issues with clang produced assembler were fixed in binutils 2.35.1, but 2.35.2 fixed issues related to requiring the flag -Wa,-gdwarf-5 explicitly. The added shell script test checks for the latter, and is only required when using clang without its integrated assembler, though we use for clang regardless as we do not yet have a way to query the assembler from Kconfig. Disabled for now if CONFIG_DEBUG_INFO_BTF is set; pahole doesn't yet recognize the new additions to the DWARF debug info. This only modifies the DWARF version emitted by the compiler, not the assembler. The DWARF version of a binary can be validated with: $ llvm-dwarfdump <object file> | head -n 4 | grep version or $ readelf --debug-dump=info <object file> 2>/dev/null | grep Version Parts of the tree don't reuse DEBUG_CFLAGS as they should; such cleanup is left as a follow up. Link: http://www.dwarfstd.org/doc/DWARF5.pdf Link: https://bugzilla.redhat.com/show_bug.cgi?id=1922707 Reported-by: Sedat Dilek <sedat.dilek@gmail.com> Suggested-by: Arvind Sankar <nivedita@alum.mit.edu> Suggested-by: Caroline Tice <cmtice@google.com> Suggested-by: Fangrui Song <maskray@google.com> Suggested-by: Jakub Jelinek <jakub@redhat.com> Suggested-by: Masahiro Yamada <masahiroy@kernel.org> Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # LLVM/Clang v12.0.0-rc1 x86-64 Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* Kbuild: make DWARF version a choiceNick Desaulniers2021-02-162-7/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a default CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT which allows the implicit default version of DWARF emitted by the toolchain to progress over time. Modifies CONFIG_DEBUG_INFO_DWARF4 to be a member of a choice, making it mutually exclusive with CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT. Users may want to select this if they are using a newer toolchain, but have consumers of the DWARF debug info that aren't yet ready for newer DWARF versions' debug info. Does so in a way that's forward compatible with existing configs, and makes adding future versions more straightforward. This patch does not change the current behavior or selection of DWARF version for users upgrading to kernels with this patch. GCC since ~4.8 has defaulted to DWARF v4 implicitly, and GCC 11 has bumped this to v5. Remove the Kconfig help text about DWARF v4 being larger. It's empirically false for the latest toolchains for x86_64 defconfig, has no point of reference (I suspect it was DWARF v2 but that's stil empirically false), and debug info size is not a qualatative measure. Suggested-by: Arvind Sankar <nivedita@alum.mit.edu> Suggested-by: Fangrui Song <maskray@google.com> Suggested-by: Jakub Jelinek <jakub@redhat.com> Suggested-by: Mark Wielaard <mark@klomp.org> Suggested-by: Masahiro Yamada <masahiroy@kernel.org> Suggested-by: Nathan Chancellor <nathan@kernel.org> Tested-by: Sedat Dilek <sedat.dilek@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* vmlinux.lds.h: add DWARF v5 sectionsNick Desaulniers2021-02-161-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | We expect toolchains to produce these new debug info sections as part of DWARF v5. Add explicit placements to prevent the linker warnings from --orphan-section=warn. Compilers may produce such sections with explicit -gdwarf-5, or based on the implicit default version of DWARF when -g is used via DEBUG_INFO. This implicit default changes over time, and has changed to DWARF v5 with GCC 11. .debug_sup was mentioned in review, but without compilers producing it today, let's wait to add it until it becomes necessary. Cc: stable@vger.kernel.org Link: https://bugzilla.redhat.com/show_bug.cgi?id=1922707 Reported-by: Chris Murphy <lists@colorremedies.com> Suggested-by: Fangrui Song <maskray@google.com> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Mark Wielaard <mark@klomp.org> Tested-by: Sedat Dilek <sedat.dilek@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* Kbuild: Make composite object searching more genericElliot Berman2021-02-161-4/+8
| | | | | | | Reduce repeated logic around expanding composite objects. Signed-off-by: Elliot Berman <eberman@codeaurora.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kbuild: use always-y instead of extra-yMasahiro Yamada2021-02-164-12/+12
| | | | | | | | | | | As commit d0e628cd817f ("kbuild: doc: clarify the difference between extra-y and always-y") explained, extra-y should be used for listing the prerequisites of vmlinux. These targets are not related to vmlinux. always-y is a better fix. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Rob Herring <robh@kernel.org>
* kbuild: stop removing stale <linux/version.h> fileMasahiro Yamada2021-02-161-2/+0
| | | | | | | | | | Revert commit 223c24a7dba9 ("kbuild: Automatically remove stale <linux/version.h> file"). It was more than 6 years ago. I do not expect anybody to start git-bisect for such a big window. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kbuild: doc: remove "Objects which export symbols" sectionMasahiro Yamada2021-02-161-7/+1
| | | | | | EXPORT_SYMBOL is unrelated to makefiles. No need to mention it. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* genksyms: remove useless case DOTSMasahiro Yamada2021-02-161-1/+0
| | | | | | | This switch statement does not list out all the cases. Since the 'default' covers all the rest, the 'DOTS' case is unneeded. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* genksyms: remove dead code for ST_TABLE_*Masahiro Yamada2021-02-161-54/+0
| | | | | | | No one sets lexstate to ST_TABLE_*. It is is very old code, and I do not know what was the plan at that time. Let's remove the dead code. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* genksyms: make source_file a local variable in lexerMasahiro Yamada2021-02-163-2/+3
| | | | | | This is only used in yylex() in lex.l Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kbuild: check the minimum compiler version in KconfigMasahiro Yamada2021-02-168-65/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Paul Gortmaker reported a regression in the GCC version check. [1] If you use GCC 4.8, the build breaks before showing the error message "error Sorry, your version of GCC is too old - please use 4.9 or newer." I do not want to apply his fix-up since it implies we would not be able to remove any cc-option test. Anyway, I admit checking the GCC version in <linux/compiler-gcc.h> is too late. Almost at the same time, Linus also suggested to move the compiler version error to Kconfig time. [2] I unified the two similar scripts, gcc-version.sh and clang-version.sh into cc-version.sh. The old scripts invoked the compiler multiple times (3 times for gcc-version.sh, 4 times for clang-version.sh). I refactored the code so the new one invokes the compiler just once, and also tried my best to use shell-builtin commands where possible. The new script runs faster. $ time ./scripts/clang-version.sh clang 120000 real 0m0.029s user 0m0.012s sys 0m0.021s $ time ./scripts/cc-version.sh clang Clang 120000 real 0m0.009s user 0m0.006s sys 0m0.004s cc-version.sh also shows an error message if the compiler is too old: $ make defconfig CC=clang-9 *** Default configuration is based on 'x86_64_defconfig' *** *** Compiler is too old. *** Your Clang version: 9.0.1 *** Minimum Clang version: 10.0.1 *** scripts/Kconfig.include:46: Sorry, this compiler is not supported. make[1]: *** [scripts/kconfig/Makefile:81: defconfig] Error 1 make: *** [Makefile:602: defconfig] Error 2 The new script takes care of ICC because we have <linux/compiler-intel.h> although I am not sure if building the kernel with ICC is well-supported. [1]: https://lore.kernel.org/r/20210110190807.134996-1-paul.gortmaker@windriver.com [2]: https://lore.kernel.org/r/CAHk-=wh-+TMHPTFo1qs-MYyK7tZh-OQovA=pP3=e06aCVp6_kA@mail.gmail.com Fixes: 87de84c9140e ("kbuild: remove cc-option test of -Werror=date-time") Reported-by: Paul Gortmaker <paul.gortmaker@windriver.com> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Tested-by: Nick Desaulniers <ndesaulniers@google.com> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com> Tested-by: Nathan Chancellor <natechancellor@gmail.com> Reviewed-by: Miguel Ojeda <ojeda@kernel.org> Tested-by: Miguel Ojeda <ojeda@kernel.org> Tested-by: Sedat Dilek <sedat.dilek@gmail.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kbuild: LD_VERSION redenominationMasahiro Yamada2021-02-126-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit ccbef1674a15 ("Kbuild, lto: add ld-version and ld-ifversion macros") introduced scripts/ld-version.sh for GCC LTO. At that time, this script handled 5 version fields because GCC LTO needed the downstream binutils. (https://lkml.org/lkml/2014/4/8/272) The code snippet from the submitted patch was as follows: # We need HJ Lu's Linux binutils because mainline binutils does not # support mixing assembler and LTO code in the same ld -r object. # XXX check if the gcc plugin ld is the expected one too # XXX some Fedora binutils should also support it. How to check for that? ifeq ($(call ld-ifversion,-ge,22710001,y),y) ... However, GCC LTO was not merged into the mainline after all. (https://lkml.org/lkml/2014/4/8/272) So, the 4th and 5th fields were never used, and finally removed by commit 0d61ed17dd30 ("ld-version: Drop the 4th and 5th version components"). Since then, the last 4-digits returned by this script is always zeros. Remove the meaningless last 4-digits. This makes the version format consistent with GCC_VERSION, CLANG_VERSION, LLD_VERSION. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Acked-by: Will Deacon <will@kernel.org> Acked-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
* kbuild: Remove $(cc-option,-gdwarf-4) dependency from DEBUG_INFO_DWARF4Masahiro Yamada2021-02-121-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The -gdwarf-4 flag is supported by GCC 4.5+, and also by Clang. You can see it at https://godbolt.org/z/6ed1oW For gcc 4.5.3 pane, line 37: .value 0x4 For clang 10.0.1 pane, line 117: .short 4 Given Documentation/process/changes.rst stating GCC 4.9 is the minimal version, this cc-option is unneeded. Note ---- CONFIG_DEBUG_INFO_DWARF4 controls the DWARF version only for C files. As you can see in the top Makefile, -gdwarf-4 is only passed to CFLAGS. ifdef CONFIG_DEBUG_INFO_DWARF4 DEBUG_CFLAGS += -gdwarf-4 endif This flag is used when compiling *.c files. On the other hand, the assembler is always given -gdwarf-2. KBUILD_AFLAGS += -Wa,-gdwarf-2 Hence, the debug info that comes from *.S files is always DWARF v2. This is simply because GAS supported only -gdwarf-2 for a long time. Recently, GAS gained the support for --gdwarf-[345] options. [1] And, also we have Clang integrated assembler. So, the debug info for *.S files might be improved in the future. In my understanding, the current code is intentional, not a bug. [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=31bf18645d98b4d3d7357353be840e320649a67d Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
* Makefile: use smaller dictionary size for xz module compressionTor Vic2021-02-121-1/+1
| | | | | | | | | | | | | | By default, xz without parameters uses a dictionary size of 8 MB. However, most modules are much smaller than that. The xz manpage states that 'increasing dictionary size usually improves compression ratio, but a dictionary bigger than the uncompressed file is waste of memory'. Use a dictionary size of 2 MB for module compression, resulting in slightly higher compression speed while still maintaining a good compression ratio. Signed-off-by: Tor Vic <torvic9@mailbox.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* ia64: remove generated/nr-irqs.h generation to fix build warningMasahiro Yamada2021-02-124-34/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Randy reports the following warning when building ARCH=ia64 with CONFIG_IA64_PALINFO=m: ../scripts/Makefile.build:68: 'arch/ia64/kernel/palinfo.ko' will not be built even though obj-m is specified. ../scripts/Makefile.build:69: You cannot use subdir-y/m to visit a module Makefile. Use obj-y/m instead. This message is actually false-positive, and you can get palinfo.ko correctly built. It is emitted in the archprepare stage, where Kbuild descends into arch/ia64/kernel to generate include/generated/nr-irqs.h instead of any kind of kernel objects. arch/ia64/kernel/nr-irqs.c was introduced by commit 213060a4d699 ("[IA64] pvops: paravirtualize NR_IRQS") to pre-calculate: NR_IRQS = max(IA64_NATIVE_NR_IRQS, XEN_NR_IRQS, FOO_NR_IRQS...) Since commit d52eefb47d4e ("ia64/xen: Remove Xen support for ia64"), this union contains just one field, making NR_IRQS and IA64_NATIVE_NR_IRQS always match. So, the following hard-coding now works: #define NR_IRQS IA64_NATIVE_NR_IRQS If you need to re-introduce NR_IRQS = max(...) gimmick in the future, please try to implement it in asm-offsets.c instead of a separate file. It will be possible because the header inclusion has been consolidated to make asm-offsets.c independent of <asm/irqs.h>. Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org>
* ia64: remove unneeded header includes from <asm/mca.h>Masahiro Yamada2021-02-124-6/+6
| | | | | | | | | | | | | | | | | | | | | | <asm/mca.h> includes too many unneeded headers. This commit cuts off a lot of header includes. What we need to include are: - <linux/percpu.h> for DECLARE_PER_CPU(u64, ia64_mca_pal_base) - <linux/threads.h> for NR_CPUS - <linux/types.h> for u8, u64, size_t, etc. - <asm/ptrace.h> for KERNEL_STACK_SIZE The other header includes are actually unneeded. <asm/mca.h> previously included 436 headers, and now it includes only 138. I confirmed <asm/mca.h> is still self-contained. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Randy Dunlap <rdunlap@infradead.org> Acked-by: Ard Biesheuvel <ardb@kernel.org>
* ia64: do not typedef struct pal_min_state_area_sMasahiro Yamada2021-02-126-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Documentation/process/coding-style.rst says: Please don't use things like ``vps_t``. It's a **mistake** to use typedef for structures and pointers. This commit converts as follows: struct pal_min_state_area_s -> struct pal_min_state_area pal_min_state_area_t -> struct pal_min_state_area My main motivation for this is to slim down the include directives of <asm/mca.h> in the next commit. Currently, <asm/mca.h> is required to include <asm/pal.h> directly or indirectly due to (pal_min_state_area_t *). Otherwise, it would have no idea what pal_min_state_area_t is. Replacing it with (struct pal_min_state_area *) will relax the header dependency since it is enough to tell it is a pointer to a structure, and to resolve the size of struct pal_min_state_area. It will make <asm/mca.h> independent of <asm/pal.h>. <asm/pal.h> typedef's a lot of structures, but it is trivial to convert the others in the same way. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
* Linux 5.11-rc7v5.11-rc7Linus Torvalds2021-02-071-1/+1
|
* Merge tag 'libnvdimm-fixes-5.11-rc7' of ↵Linus Torvalds2021-02-078-58/+1293
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm Pull libnvdimm fixes from Dan Williams: "A fix for a crash scenario that has been present since the initial merge, a minor regression in sysfs attribute visibility, and a fix for some flexible array warnings. The bulk of this pull is an update to the libnvdimm unit test infrastructure to test non-ACPI platforms. Given there is zero regression risk for test updates, and the tests enable validation of bits headed towards the next merge window, I saw no reason to hold the new tests back. Santosh originally submitted this before the v5.11 window opened. Summary: - Fix a crash when sysfs accesses race 'dimm' driver probe/remove. - Fix a regression in 'resource' attribute visibility necessary for mapping badblocks and other physical address interrogations. - Fix some flexible array warnings - Expand the unit test infrastructure for non-ACPI platforms" * tag 'libnvdimm-fixes-5.11-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: libnvdimm/dimm: Avoid race between probe and available_slots_show() ndtest: Add papr health related flags ndtest: Add nvdimm control functions ndtest: Add regions and mappings to the test buses ndtest: Add dimm attributes ndtest: Add dimms to the two buses ndtest: Add compatability string to treat it as PAPR family testing/nvdimm: Add test module for non-nfit platforms libnvdimm/namespace: Fix visibility of namespace resource attribute libnvdimm/pmem: Remove unused header ACPI: NFIT: Fix flexible_array.cocci warnings
| * libnvdimm/dimm: Avoid race between probe and available_slots_show()Dan Williams2021-02-011-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Richard reports that the following test: (while true; do cat /sys/bus/nd/devices/nmem*/available_slots 2>&1 > /dev/null done) & while true; do for i in $(seq 0 4); do echo nmem$i > /sys/bus/nd/drivers/nvdimm/bind done for i in $(seq 0 4); do echo nmem$i > /sys/bus/nd/drivers/nvdimm/unbind done done ...fails with a crash signature like: divide error: 0000 [#1] SMP KASAN PTI RIP: 0010:nd_label_nfree+0x134/0x1a0 [libnvdimm] [..] Call Trace: available_slots_show+0x4e/0x120 [libnvdimm] dev_attr_show+0x42/0x80 ? memset+0x20/0x40 sysfs_kf_seq_show+0x218/0x410 The root cause is that available_slots_show() consults driver-data, but fails to synchronize against device-unbind setting up a TOCTOU race to access uninitialized memory. Validate driver-data under the device-lock. Fixes: 4d88a97aa9e8 ("libnvdimm, nvdimm: dimm driver and base libnvdimm device-driver infrastructure") Cc: <stable@vger.kernel.org> Cc: Vishal Verma <vishal.l.verma@intel.com> Cc: Dave Jiang <dave.jiang@intel.com> Cc: Ira Weiny <ira.weiny@intel.com> Cc: Coly Li <colyli@suse.com> Reported-by: Richard Palethorpe <rpalethorpe@suse.com> Acked-by: Richard Palethorpe <rpalethorpe@suse.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * ndtest: Add papr health related flagsSantosh Sivaraj2021-01-282-0/+72
| | | | | | | | | | | | | | | | sysfs attibutes to show health related flags are added. Signed-off-by: Santosh Sivaraj <santosh@fossix.org> Link: https://lore.kernel.org/r/20201222042240.2983755-8-santosh@fossix.org Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * ndtest: Add nvdimm control functionsSantosh Sivaraj2021-01-281-0/+51
| | | | | | | | | | | | | | | | | | Add functions to support ND_CMD_GET_CONFIG_SIZE, ND_CMD_SET_CONFIG_DATA and ND_CMD_GET_CONFIG_DATA. Signed-off-by: Santosh Sivaraj <santosh@fossix.org> Link: https://lore.kernel.org/r/20201222042240.2983755-7-santosh@fossix.org Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * ndtest: Add regions and mappings to the test busesSantosh Sivaraj2021-01-282-0/+378
| | | | | | | | | | | | | | | | | | | | The bus config array is used to hold the regions and the respective mappings. This config based interface enables to change the dimm/region/namespace layouts easily. Signed-off-by: Santosh Sivaraj <santosh@fossix.org> Link: https://lore.kernel.org/r/20201222042240.2983755-6-santosh@fossix.org Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * ndtest: Add dimm attributesSantosh Sivaraj2021-01-281-2/+200
| | | | | | | | | | | | | | | | This patch adds sysfs attributes for nvdimm and the dimm device. Signed-off-by: Santosh Sivaraj <santosh@fossix.org> Link: https://lore.kernel.org/r/20201222042240.2983755-5-santosh@fossix.org Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * ndtest: Add dimms to the two busesSantosh Sivaraj2021-01-282-0/+294
| | | | | | | | | | | | | | | | | | A config array is used to hold the dimms for each bus. These dimms are registered with nvdimm, and new nvdimms are created on the buses. Signed-off-by: Santosh Sivaraj <santosh@fossix.org> Link: https://lore.kernel.org/r/20201222042240.2983755-4-santosh@fossix.org Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * ndtest: Add compatability string to treat it as PAPR familySantosh Sivaraj2021-01-281-0/+23
| | | | | | | | | | | | | | | | | | | | Since this module is written to be platform agnostic, the module is made part of the PAPR_FAMILY. ndctl identifies the family using the compatible string inside of_node dir-entry. Signed-off-by: Santosh Sivaraj <santosh@fossix.org> Link: https://lore.kernel.org/r/20201222042240.2983755-3-santosh@fossix.org Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * testing/nvdimm: Add test module for non-nfit platformsSantosh Sivaraj2021-01-284-2/+229
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current test module cannot be used for testing platforms (make check) that do not have support for NFIT. In order to get the ndctl tests working, we need a module which can emulate NVDIMM devices without relying on ACPI/NFIT. The aim of this proposed module is to implement a similar functionality to the existing module but without the ACPI dependencies. This RFC series is split into reviewable and compilable chunks. This patch adds a new driver and registers two nvdimm bus needed for ndctl make check. Signed-off-by: Santosh Sivaraj <santosh@fossix.org> Link: https://lore.kernel.org/r/20201222042240.2983755-2-santosh@fossix.org Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * libnvdimm/namespace: Fix visibility of namespace resource attributeDan Williams2021-01-281-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Legacy pmem namespaces lost support for the "resource" attribute when the code was cleaned up to put the permission visibility in the declaration. Restore this by listing 'resource' in the default attributes. A new ndctl regression test for pfn_to_online_page() corner cases builds on this fix. Fixes: bfd2e9140656 ("libnvdimm: Simplify root read-only definition for the 'resource' attribute") Cc: Vishal Verma <vishal.l.verma@intel.com> Cc: Dave Jiang <dave.jiang@intel.com> Cc: Ira Weiny <ira.weiny@intel.com> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/161052334995.1805594.12054873528154362921.stgit@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * libnvdimm/pmem: Remove unused headerJianpeng Ma2021-01-111-1/+0
| | | | | | | | | | | | | | | | | | | | 'commit a8b456d01cd6 ("bdi: remove BDI_CAP_SYNCHRONOUS_IO")' forgot remove the related header file. Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com> Reviewed-by: Ira Weiny <ira.weiny@intel.com> Link: https://lore.kernel.org/r/20201229002635.42555-1-jianpeng.ma@intel.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>