summaryrefslogtreecommitdiff
path: root/scripts
AgeCommit message (Collapse)Author
2023-08-20kbuild: consolidate warning flags in scripts/Makefile.extrawarnArnd Bergmann
Warning options are enabled and disabled in inconsistent ways and inconsistent locations. Start rearranging those by moving all options into Makefile.extrawarn. This should not change any behavior, but makes sure we can group them in a way that ensures that each warning that got temporarily disabled is turned back on at an appropriate W=1 level later on. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2023-08-18scripts/gdb: fix 'lx-lsmod' show the wrong sizeKuan-Ying Lee
'lsmod' shows total core layout size, so we need to sum up all the sections in core layout in gdb scripts. / # lsmod kasan_test 200704 0 - Live 0xffff80007f640000 Before patch: (gdb) lx-lsmod Address Module Size Used by 0xffff80007f640000 kasan_test 36864 0 After patch: (gdb) lx-lsmod Address Module Size Used by 0xffff80007f640000 kasan_test 200704 0 Link: https://lkml.kernel.org/r/20230710092852.31049-1-Kuan-Ying.Lee@mediatek.com Fixes: b4aff7513df3 ("scripts/gdb: use mem instead of core_layout to get the module address") Signed-off-by: Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com> Reviewed-by: Pankaj Raghav <p.raghav@samsung.com> Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Cc: Chinwen Chang <chinwen.chang@mediatek.com> Cc: Jan Kiszka <jan.kiszka@siemens.com> Cc: Kieran Bingham <kbingham@kernel.org> Cc: Luis Chamberlain <mcgrof@kernel.org> Cc: Matthias Brugger <matthias.bgg@gmail.com> Cc: Qun-Wei Lin <qun-wei.lin@mediatek.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2023-08-18scripts/gdb: fix lx-symbols command for arm64 LLVMKoudai Iwahori
lx-symbols assumes that module's .text sections is located at `module->mem[MOD_TEXT].base` and passes it to add-symbol-file command. However, .text section follows after .plt section in modules built by LLVM toolchain for arm64 target. Symbol addresses are skewed in GDB. Fix this issue by using the address of .text section stored in `module->sect_attrs`. Link: https://lkml.kernel.org/r/20230801121052.2475183-1-koudai@google.com Signed-off-by: Koudai Iwahori <koudai@google.com> Cc: Jan Kiszka <jan.kiszka@siemens.com> Cc: Kieran Bingham <kbingham@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2023-08-18arch/ia64/include: remove CONFIG_IA64_DEBUG_CMPXCHG from uapi headerThomas Huth
CONFIG_* switches should not be exposed in uapi headers. The macros that are defined here are also only useful for the kernel code, so let's move them to asm/cmpxchg.h instead. The only two files that are using these macros are the headers arch/ia64/include/asm/bitops.h and arch/ia64/include/asm/atomic.h and these include asm/cmpxchg.h via asm/intrinsics.h, so this movement should not cause any trouble. Link: https://lkml.kernel.org/r/20230426065032.517693-1-thuth@redhat.com Signed-off-by: Thomas Huth <thuth@redhat.com> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2023-08-18scripts: kernel-doc: fix macro handling in enumsPavan Kumar Linga
drivers/net/ethernet/intel/idpf/idpf.h uses offsetof to initialize the enum enumerators: enum idpf_cap_field { IDPF_BASE_CAPS = -1, IDPF_CSUM_CAPS = offsetof(struct virtchnl2_get_capabilities, csum_caps), IDPF_SEG_CAPS = offsetof(struct virtchnl2_get_capabilities, seg_caps), IDPF_RSS_CAPS = offsetof(struct virtchnl2_get_capabilities, rss_caps), IDPF_HSPLIT_CAPS = offsetof(struct virtchnl2_get_capabilities, hsplit_caps), IDPF_RSC_CAPS = offsetof(struct virtchnl2_get_capabilities, rsc_caps), IDPF_OTHER_CAPS = offsetof(struct virtchnl2_get_capabilities, other_caps), }; kernel-doc parses the above enumerator with a ',' inside the macro and treats 'csum_caps', 'seg_caps' etc. also as enumerators resulting in the warnings: drivers/net/ethernet/intel/idpf/idpf.h:130: warning: Enum value 'csum_caps' not described in enum 'idpf_cap_field' drivers/net/ethernet/intel/idpf/idpf.h:130: warning: Enum value 'seg_caps' not described in enum 'idpf_cap_field' drivers/net/ethernet/intel/idpf/idpf.h:130: warning: Enum value 'rss_caps' not described in enum 'idpf_cap_field' drivers/net/ethernet/intel/idpf/idpf.h:130: warning: Enum value 'hsplit_caps' not described in enum 'idpf_cap_field' drivers/net/ethernet/intel/idpf/idpf.h:130: warning: Enum value 'rsc_caps' not described in enum 'idpf_cap_field' drivers/net/ethernet/intel/idpf/idpf.h:130: warning: Enum value 'other_caps' not described in enum 'idpf_cap_field' Fix it by removing the macro arguments within the parentheses. Cc: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Pavan Kumar Linga <pavan.kumar.linga@intel.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Link: https://lore.kernel.org/r/20230815210417.98749-3-pavan.kumar.linga@intel.com
2023-08-18scripts: kernel-doc: parse DEFINE_DMA_UNMAP_[ADDR|LEN]Pavan Kumar Linga
At present, if the macros DEFINE_DMA_UNMAP_ADDR() and DEFINE_DMA_UNMAP_LEN() are used in the structures as shown below, instead of parsing the parameter in the parentheses, kernel-doc parses 'DEFINE_DMA_UNMAP_ADDR(' and 'DEFINE_DMA_UNMAP_LEN(' which results in the following warnings: drivers/net/ethernet/intel/idpf/idpf_txrx.h:201: warning: Function parameter or member 'DEFINE_DMA_UNMAP_ADDR(dma' not described in 'idpf_tx_buf' drivers/net/ethernet/intel/idpf/idpf_txrx.h:201: warning: Function parameter or member 'DEFINE_DMA_UNMAP_LEN(len' not described in 'idpf_tx_buf' struct idpf_tx_buf { DEFINE_DMA_UNMAP_ADDR(dma); DEFINE_DMA_UNMAP_LEN(len); }; Fix the warnings by parsing DEFINE_DMA_UNMAP_ADDR() and DEFINE_DMA_UNMAP_LEN(). Cc: Jonathan Corbet <corbet@lwn.net> Acked-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Pavan Kumar Linga <pavan.kumar.linga@intel.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Link: https://lore.kernel.org/r/20230815210417.98749-2-pavan.kumar.linga@intel.com
2023-08-17dt: dt-check-compatible: Find struct of_device_id instances with compiler ↵Rob Herring
annotations The regex search for declarations of struct of_device_id was missing cases that had a compiler annotation such as "__maybe_unused". Improve the regex to allow for these. Use '\S' instead of specific characters to shorten the regex. That also finds some more compatibles using '.' characters. Unfortunately, these changes add ~400 more compatibles without a schema. Reviewed-by: Conor Dooley <conor.dooley@microchip.com> Link: https://lore.kernel.org/r/20230804190130.1936566-1-robh@kernel.org Signed-off-by: Rob Herring <robh@kernel.org>
2023-08-16kconfig: port qconf to work with Qt6 in addition to Qt5Boris Kolpackov
Tested with Qt5 5.15 and Qt6 6.4. Note that earlier versions of Qt5 are no longer guaranteed to work. Signed-off-by: Boris Kolpackov <boris@codesynthesis.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2023-08-15rust: bindgen: upgrade to 0.65.1Aakash Sen Sharma
In LLVM 16, anonymous items may return names like `(unnamed union at ..)` rather than empty names [1], which breaks Rust-enabled builds because bindgen assumed an empty name instead of detecting them via `clang_Cursor_isAnonymous` [2]: $ make rustdoc LLVM=1 CLIPPY=1 -j$(nproc) RUSTC L rust/core.o BINDGEN rust/bindings/bindings_generated.rs BINDGEN rust/bindings/bindings_helpers_generated.rs BINDGEN rust/uapi/uapi_generated.rs thread 'main' panicked at '"ftrace_branch_data_union_(anonymous_at__/_/include/linux/compiler_types_h_146_2)" is not a valid Ident', .../proc-macro2-1.0.24/src/fallback.rs:693:9 ... thread 'main' panicked at '"ftrace_branch_data_union_(anonymous_at__/_/include/linux/compiler_types_h_146_2)" is not a valid Ident', .../proc-macro2-1.0.24/src/fallback.rs:693:9 ... This was fixed in bindgen 0.62.0. Therefore, upgrade bindgen to a more recent version, 0.65.1, to support LLVM 16. Since bindgen 0.58.0 changed the `--{white,black}list-*` flags to `--{allow,block}list-*` [3], update them on our side too. In addition, bindgen 0.61.0 moved its CLI utility into a binary crate called `bindgen-cli` [4]. Thus update the installation command in the Quick Start guide. Moreover, bindgen 0.61.0 changed the default functionality to bind `size_t` to `usize` [5] and added the `--no-size_t-is-usize` flag to not bind `size_t` as `usize`. Then bindgen 0.65.0 removed the `--size_t-is-usize` flag [6]. Thus stop passing the flag to bindgen. Finally, bindgen 0.61.0 added support for the `noreturn` attribute (in its different forms) [7]. Thus remove the infinite loop in our Rust panic handler after calling `BUG()`, since bindgen now correctly generates a `BUG()` binding that returns `!` instead of `()`. Link: https://github.com/llvm/llvm-project/commit/19e984ef8f49bc3ccced15621989fa9703b2cd5b [1] Link: https://github.com/rust-lang/rust-bindgen/pull/2319 [2] Link: https://github.com/rust-lang/rust-bindgen/pull/1990 [3] Link: https://github.com/rust-lang/rust-bindgen/pull/2284 [4] Link: https://github.com/rust-lang/rust-bindgen/commit/cc78b6fdb6e829e5fb8fa1639f2182cb49333569 [5] Link: https://github.com/rust-lang/rust-bindgen/pull/2408 [6] Link: https://github.com/rust-lang/rust-bindgen/issues/2094 [7] Signed-off-by: Aakash Sen Sharma <aakashsensharma@gmail.com> Closes: https://github.com/Rust-for-Linux/linux/issues/1013 Tested-by: Ariel Miculas <amiculas@cisco.com> Reviewed-by: Gary Guo <gary@garyguo.net> Link: https://lore.kernel.org/r/20230612194311.24826-1-aakashsensharma@gmail.com [ Reworded commit message. Mentioned the `bindgen-cli` binary crate change, linked to it and updated the Quick Start guide. Re-added a deleted "as" word in a code comment and reflowed comment to respect the maximum length. ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-08-14rust: upgrade to Rust 1.71.1Miguel Ojeda
This is the second upgrade to the Rust toolchain, from 1.68.2 to 1.71.1 (i.e. the latest). See the upgrade policy [1] and the comments on the first upgrade in commit 3ed03f4da06e ("rust: upgrade to Rust 1.68.2"). # Unstable features No unstable features (that we use) were stabilized. Therefore, the only unstable feature allowed to be used outside the `kernel` crate is still `new_uninit`, though other code to be upstreamed may increase the list. Please see [2] for details. # Required changes For the upgrade, this patch requires the following changes: - Removal of the `__rust_*` allocator functions, together with the addition of the `__rust_no_alloc_shim_is_unstable` static. See [3] for details. - Some more compiler builtins added due to `<f{32,64}>::midpoint()` that got added in Rust 1.71 [4]. # `alloc` upgrade and reviewing The vast majority of changes are due to our `alloc` fork being upgraded at once. There are two kinds of changes to be aware of: the ones coming from upstream, which we should follow as closely as possible, and the updates needed in our added fallible APIs to keep them matching the newer infallible APIs coming from upstream. Instead of taking a look at the diff of this patch, an alternative approach is reviewing a diff of the changes between upstream `alloc` and the kernel's. This allows to easily inspect the kernel additions only, especially to check if the fallible methods we already have still match the infallible ones in the new version coming from upstream. Another approach is reviewing the changes introduced in the additions in the kernel fork between the two versions. This is useful to spot potentially unintended changes to our additions. To apply these approaches, one may follow steps similar to the following to generate a pair of patches that show the differences between upstream Rust and the kernel (for the subset of `alloc` we use) before and after applying this patch: # Get the difference with respect to the old version. git -C rust checkout $(linux/scripts/min-tool-version.sh rustc) git -C linux ls-tree -r --name-only HEAD -- rust/alloc | cut -d/ -f3- | grep -Fv README.md | xargs -IPATH cp rust/library/alloc/src/PATH linux/rust/alloc/PATH git -C linux diff --patch-with-stat --summary -R > old.patch git -C linux restore rust/alloc # Apply this patch. git -C linux am rust-upgrade.patch # Get the difference with respect to the new version. git -C rust checkout $(linux/scripts/min-tool-version.sh rustc) git -C linux ls-tree -r --name-only HEAD -- rust/alloc | cut -d/ -f3- | grep -Fv README.md | xargs -IPATH cp rust/library/alloc/src/PATH linux/rust/alloc/PATH git -C linux diff --patch-with-stat --summary -R > new.patch git -C linux restore rust/alloc Now one may check the `new.patch` to take a look at the additions (first approach) or at the difference between those two patches (second approach). For the latter, a side-by-side tool is recommended. Link: https://rust-for-linux.com/rust-version-policy [1] Link: https://github.com/Rust-for-Linux/linux/issues/2 [2] Link: https://github.com/rust-lang/rust/pull/86844 [3] Link: https://github.com/rust-lang/rust/pull/92048 [4] Closes: https://github.com/Rust-for-Linux/linux/issues/68 Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Reviewed-by: Trevor Gross <tmgross@umich.edu> Link: https://lore.kernel.org/r/20230729220317.416771-1-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-08-13Merge tag 'kbuild-fixes-v6.5-2' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild Pull Kbuild fixes from Masahiro Yamada: - Clear errno before calling getline() - Fix a modpost warning for ARCH=alpha * tag 'kbuild-fixes-v6.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: alpha: remove __init annotation from exported page_is_ram() scripts/kallsyms: Fix build failure by setting errno before calling getline()
2023-08-13kconfig: nconf: Add search jump featureJesse Taube
Menuconfig has a feature where you can "press the key in the (#) prefix to jump directly to that location. You will be returned to the current search results after exiting this new menu." This commit adds this feature to nconfig, with almost identical code. Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2023-08-10gcc-plugins: Rename last_stmt() for GCC 14+Kees Cook
In GCC 14, last_stmt() was renamed to last_nondebug_stmt(). Add a helper macro to handle the renaming. Cc: linux-hardening@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org>
2023-08-10btf, scripts: rust: drop is_rust_module.shAndrea Righi
With commit c1177979af9c ("btf, scripts: Exclude Rust CUs with pahole") we are now able to use pahole directly to identify Rust compilation units (CUs) and exclude them from generating BTF debugging information (when DEBUG_INFO_BTF is enabled). And if pahole doesn't support the --lang-exclude flag, we can't enable both RUST and DEBUG_INFO_BTF at the same time. So, in any case, the script is_rust_module.sh is just redundant and we can drop it. NOTE: we may also be able to drop the "Rust loadable module" mark inside Rust modules, but it seems safer to keep it for now to make sure we are not breaking any external tool that may potentially rely on it. Signed-off-by: Andrea Righi <andrea.righi@canonical.com> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Tested-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Neal Gompa <neal@gompa.dev> Reviewed-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Acked-by: Daniel Xu <dxu@dxuuu.xyz> Link: https://lore.kernel.org/r/20230704052136.155445-1-andrea.righi@canonical.com [ Picked the `Reviewed-by`s from the old patch too. ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-08-10kbuild: rust_is_available: add test suiteMiguel Ojeda
The `rust_is_available.sh` script runs for everybody compiling the kernel, even if not using Rust. Therefore, it is important to ensure that the script is correct to avoid breaking people's compilation. In addition, the script needs to be able to handle a set of subtle cases, including parsing version strings of different tools. Therefore, maintenance of this script can be greatly eased with a set of tests. Thus add a test suite to cover hopefully most of the setups that the script may encounter in the wild. Extra setups can be easily added later on if missing. The script currently covers all the branches of the shell script, including several ways in which they may be entered. Python is used for this script, since the script under test does not depend on Rust, thus hopefully making it easier for others to use if the need arises. Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Link: https://lore.kernel.org/r/20230616001631.463536-12-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-08-10kbuild: rust_is_available: check that output looks as expectedMiguel Ojeda
The script already checks for `$RUSTC` and `$BINDGEN` existing and exiting without failure. However, one may still pass an unexpected binary that does not output what the later parsing expects. The script still successfully reports a failure as expected, but the error is confusing. For instance: $ RUSTC=true BINDGEN=bindgen CC=clang scripts/rust_is_available.sh scripts/rust_is_available.sh: 19: arithmetic expression: expecting primary: "100000 * + 100 * + " *** *** Please see Documentation/rust/quick-start.rst for details *** on how to set up the Rust support. *** Thus add an explicit check and a proper message for unexpected output from the called command. Similarly, do so for the `libclang` version parsing, too. Link: https://lore.kernel.org/rust-for-linux/CAK7LNAQYk6s11MASRHW6oxtkqF00EJVqhHOP=5rynWt-QDUsXw@mail.gmail.com/ Reviewed-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Link: https://lore.kernel.org/r/20230616001631.463536-11-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-08-10kbuild: rust_is_available: handle failures calling `$RUSTC`/`$BINDGEN`Miguel Ojeda
The script already checks if `$RUSTC` and `$BINDGEN` exists via `command`, but the environment variables may point to a non-executable file, or the programs may fail for some other reason. While the script successfully exits with a failure as it should, the error given can be quite confusing depending on the shell and the behavior of its `command`. For instance, with `dash`: $ RUSTC=./mm BINDGEN=bindgen CC=clang scripts/rust_is_available.sh scripts/rust_is_available.sh: 19: arithmetic expression: expecting primary: "100000 * + 100 * + " Thus detect failure exit codes when calling `$RUSTC` and `$BINDGEN` and print a better message, in a similar way to what we do when extracting the `libclang` version found by `bindgen`. Link: https://lore.kernel.org/rust-for-linux/CAK7LNAQYk6s11MASRHW6oxtkqF00EJVqhHOP=5rynWt-QDUsXw@mail.gmail.com/ Reviewed-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Link: https://lore.kernel.org/r/20230616001631.463536-10-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-08-10kbuild: rust_is_available: normalize version matchingMiguel Ojeda
In order to match the version string, `sed` is used in a couple cases, and `grep` and `head` in a couple others. Make the script more consistent and easier to understand by using the same method, `sed`, for all of them. This makes the version matching also a bit more strict for the changed cases, since the strings `rustc ` and `bindgen ` will now be required, which should be fine since `rustc` complains if one attempts to call it with another program name, and `bindgen` uses a hardcoded string. In addition, clarify why one of the existing `sed` commands does not provide an address like the others. Reviewed-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Link: https://lore.kernel.org/r/20230616001631.463536-9-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-08-10kbuild: rust_is_available: fix confusion when a version appears in the pathMiguel Ojeda
`bindgen`'s output for `libclang`'s version check contains paths, which in turn may contain strings that look like version numbers [1][2]: .../6.1.0-dev/.../rust_is_available_bindgen_libclang.h:2:9: warning: clang version 11.1.0 [-W#pragma-messages], err: false which the script will pick up as the version instead of the latter. It is also the case that versions may appear after the actual version (e.g. distribution's version text), which was the reason behind `head` [3]: .../rust-is-available-bindgen-libclang.h:2:9: warning: clang version 13.0.0 (Fedora 13.0.0-3.fc35) [-W#pragma-messages], err: false Thus instead ask for a match after the `clang version` string. Reported-by: Jordan Isaacs <mail@jdisaacs.com> Closes: https://github.com/Rust-for-Linux/linux/issues/942 [1] Reported-by: "Ethan D. Twardy" <ethan.twardy@gmail.com> Closes: https://lore.kernel.org/rust-for-linux/20230528131802.6390-2-ethan.twardy@gmail.com/ [2] Reported-by: Tiago Lam <tiagolam@gmail.com> Closes: https://github.com/Rust-for-Linux/linux/pull/789 [3] Fixes: 78521f3399ab ("scripts: add `rust_is_available.sh`") Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Reviewed-by: Ethan Twardy <ethan.twardy@gmail.com> Tested-by: Ethan Twardy <ethan.twardy@gmail.com> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/r/20230616001631.463536-8-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-08-09kbuild: rust_is_available: check that environment variables are setMiguel Ojeda
Sometimes [1] users may attempt to setup the Rust support by checking what Kbuild does and they end up finding out about `scripts/rust_is_available.sh`. Inevitably, they run the script directly, but unless they setup the required variables, the result of the script is not meaningful. We could add some defaults to the variables, but that could be confusing for those that may override the defaults (compared to their kernel builds), and `$CC` would not be a simple default in any case. Therefore, instead, explicitly check whether the expected variables are set (`$RUSTC`, `$BINDGEN` and `$CC`). If not, print an explanation about the fact that the script is meant to be called from Kbuild, since that is the most likely cause for the variables not being set. Link: https://lore.kernel.org/oe-kbuild-all/Y6r4mXz5NS0+HVXo@zn.tnic/ [1] Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/r/20230616001631.463536-7-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-08-09kbuild: rust_is_available: add check for `bindgen` invocationMiguel Ojeda
`scripts/rust_is_available.sh` calls `bindgen` with a special header in order to check whether the `libclang` version in use is suitable. However, the invocation itself may fail if, for instance, `bindgen` cannot locate `libclang`. This is fine for Kconfig (since the script will still fail and therefore disable Rust as it should), but it is pretty confusing for users of the `rustavailable` target given the error will be unrelated: ./scripts/rust_is_available.sh: 21: arithmetic expression: expecting primary: "100000 * + 100 * + " make: *** [Makefile:1816: rustavailable] Error 2 Instead, run the `bindgen` invocation independently in a previous step, saving its output and return code. If it fails, then show the user a proper error message. Otherwise, continue as usual with the saved output. Since the previous patch we show a reference to the docs, and the docs now explain how `bindgen` looks for `libclang`, thus the error message can leverage the documentation, avoiding duplication here (and making users aware of the setup guide in the documentation). Reported-by: Nick Desaulniers <ndesaulniers@google.com> Link: https://lore.kernel.org/rust-for-linux/CAKwvOdm5JT4wbdQQYuW+RT07rCi6whGBM2iUAyg8A1CmLXG6Nw@mail.gmail.com/ Reported-by: François Valenduc <francoisvalenduc@gmail.com> Closes: https://github.com/Rust-for-Linux/linux/issues/934 Reported-by: Alexandru Radovici <msg4alex@gmail.com> Closes: https://github.com/Rust-for-Linux/linux/pull/921 Reported-by: Matthew Leach <dev@mattleach.net> Closes: https://lore.kernel.org/rust-for-linux/20230507084116.1099067-1-dev@mattleach.net/ Fixes: 78521f3399ab ("scripts: add `rust_is_available.sh`") Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Reviewed-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/r/20230616001631.463536-6-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-08-09kbuild: rust_is_available: print docs referenceMiguel Ojeda
People trying out the Rust support in the kernel may get warnings and errors from `scripts/rust_is_available.sh` from the `rustavailable` target or the build step. Some of those users may be following the Quick Start guide, but others may not (likely those getting warnings from the build step instead of the target). While the messages are fairly clear on what the problem is, it may not be clear how to solve the particular issue, especially for those not aware of the documentation. We could add all sorts of details on the script for each one, but it is better to point users to the documentation instead, where it is easily readable in different formats. It also avoids duplication. Thus add a reference to the documentation whenever the script fails or there is at least a warning. Reviewed-by: Finn Behrens <fin@nyantec.com> Reviewed-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Link: https://lore.kernel.org/r/20230616001631.463536-5-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-08-09kbuild: rust_is_available: fix version check when CC has multiple argumentsRussell Currey
rust_is_available.sh uses cc-version.sh to identify which C compiler is in use, as scripts/Kconfig.include does. cc-version.sh isn't designed to be able to handle multiple arguments in one variable, i.e. "ccache clang". Its invocation in rust_is_available.sh quotes "$CC", which makes $1 == "ccache clang" instead of the intended $1 == ccache & $2 == clang. cc-version.sh could also be changed to handle having "ccache clang" as one argument, but it only has the one consumer upstream, making it simpler to fix the caller here. Signed-off-by: Russell Currey <ruscur@russell.cc> Fixes: 78521f3399ab ("scripts: add `rust_is_available.sh`") Link: https://github.com/Rust-for-Linux/linux/pull/873 [ Reworded title prefix and reflow line to 75 columns. ] Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/r/20230616001631.463536-3-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-08-09kbuild: rust_is_available: remove -v optionMasahiro Yamada
The -v option is passed when this script is invoked from Makefile, but not when invoked from Kconfig. As you can see in scripts/Kconfig.include, the 'success' macro suppresses stdout and stderr anyway, so this script does not need to be quiet. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Miguel Ojeda <ojeda@kernel.org> Tested-by: Miguel Ojeda <ojeda@kernel.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/r/20230109061436.3146442-1-masahiroy@kernel.org [ Reworded prefix to match the others in the patch series. ] Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Link: https://lore.kernel.org/r/20230616001631.463536-2-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-08-08scripts/setlocalversion: also consider annotated tags of the form ↵Rasmus Villemoes
vx.y.z-${file_localversion} Commit 6ab7e1f95e96 ("setlocalversion: use only the correct release tag for git-describe") was absolutely correct to limit which annotated tags would be used to compute the -01234-gabcdef suffix. Otherwise, if some random annotated tag exists closer to HEAD than the vX.Y.Z one, the commit count would be too low. However, since the version string always includes the ${file_localversion} part, now the problem is that the count can be too high. For example, building an 6.4.6-rt8 kernel with a few patches on top, I currently get $ make -s kernelrelease 6.4.6-rt8-00128-gd78b7f406397 But those 128 commits include the 100 commits that are in v6.4.6..v6.4.6-rt8, so this is somewhat misleading. Amend the logic so that, in addition to the linux-next consideration, the script also looks for a tag corresponding to the 6.4.6-rt8 part of what will become the `uname -r` string. With this patch (so 29 patches on top of v6.4.6-rt8), one instead gets $ make -s kernelrelease 6.4.6-rt8-00029-gd533209291a2 While there, note that the line git describe --exact-match --match=$tag $tag 2>/dev/null obviously asks if $tag is an annotated tag, but it does not actually tell if the commit pointed to has any relation to HEAD. So remove both uses of --exact-match, and instead just ask if the description generated is identical to the tag we provided. Since we then already have the result of git describe --match=$tag we also end up reducing the number of times we invoke "git describe". Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2023-08-08scripts/setlocalversion: clean up stale commentRasmus Villemoes
Nobody has complained since 2a73cce2dad3 ("scripts/setlocalversion: remove mercurial, svn and git-svn supports"), so let's also clean up the header comment accordingly. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2023-08-08kbuild: deb-pkg: split debian/rulesMasahiro Yamada
debian/rules is generated by shell, but the escape sequence (\$) is unreadable. debian/rules embeds only two variables (ARCH and KERNELRELEASE). Split them out to debian/rules.vars, and check-in the rest of Makefile code to scripts/package/debian/rules. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Tested-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
2023-08-08kbuild: deb-pkg: use Debian compliant shebang for debian/rulesMasahiro Yamada
Debian Policy "4.9. Main building script: debian/rules" requires "debian/rules must start with the line #!/usr/bin/make -f". [1] Currently, Kbuild does not follow this policy. When Kbuild generates debian/rules, "#!$(command -v $MAKE) -f" is expanded by shell. The resuling string may not be "#!/usr/bin/make -f". There was a reason to opt out the Debian policy. If you run '/path/to/my/custom/make deb-pkg', debian/rules must also be invoked by the same Make program. If #!/usr/bin/make were hard-coded in debian/rules, the sub-make would be executed by a possibly different Make version. This is problematic due to the MAKEFLAGS incompatibility, especially the job server flag. Old Make versions used --jobserver-fds to propagate job server file descriptors, but Make >= 4.2 uses --jobserver-auth. The flag disagreement between the parent/child Makes would result in a process fork explosion. However, having a non-standard path in the shebang causes another issue; the generated source package is not portable as such a path does not exist in other build environments. This commit solves those conflicting demands. Hard-code '#!/usr/bin/make -f' in debian/rules to create a portable and Debian-compliant source package. Pass '--rules-file=$(MAKE) -f debian/rules' when dpkg-buildpackage is invoked from Makefile so that debian/rules is executed by the same Make program as used to start Kbuild. [1] https://www.debian.org/doc/debian-policy/ch-source.html#main-building-script-debian-rules Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Tested-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
2023-08-07scripts: `make rust-analyzer` for out-of-tree modulesVinay Varma
Adds support for out-of-tree rust modules to use the `rust-analyzer` make target to generate the rust-project.json file. The change involves adding an optional parameter `external_src` to the `generate_rust_analyzer.py` which expects the path to the out-of-tree module's source directory. When this parameter is passed, I have chosen not to add the non-core modules (samples and drivers) into the result since these are not expected to be used in third party modules. Related changes are also made to the Makefile and rust/Makefile allowing the `rust-analyzer` target to be used for out-of-tree modules as well. Link: https://github.com/Rust-for-Linux/linux/pull/914 Link: https://github.com/Rust-for-Linux/rust-out-of-tree-module/pull/2 Signed-off-by: Vinay Varma <varmavinaym@gmail.com> Link: https://lore.kernel.org/r/20230411091714.130525-1-varmavinaym@gmail.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-07-31modpost: remove ElF_Rela variables from for-loop in section_rel(a)Masahiro Yamada
Remove the Elf_Rela variables used in the for-loop in section_rel(). This makes the code consistent; section_rel() only uses Elf_Rel, section_rela() only uses Elf_Rela. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2023-07-31modpost: clean up MIPS64 little endian relocation codeMasahiro Yamada
MIPS64 little endian target has an odd encoding of r_info. This commit makes the special handling less ugly. It is still ugly, but #if conditionals will go away, at least. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2023-07-31modpost: pass r_type to addend_*_rel()Masahiro Yamada
All of addend_*_rel() need the Elf_Rela pointer just for calculating ELF_R_TYPE(r->r_info). You can do it on the caller to de-duplicate the code. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2023-07-31modpost: change return type of addend_*_rel()Masahiro Yamada
Now that none of addend_*_rel() returns a meaningful value (the return value is always 0), change all of them to return the value of r_addend. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2023-07-30Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvmLinus Torvalds
Pull kvm fixes from Paolo Bonzini: "x86: - Do not register IRQ bypass consumer if posted interrupts not supported - Fix missed device interrupt due to non-atomic update of IRR - Use GFP_KERNEL_ACCOUNT for pid_table in ipiv - Make VMREAD error path play nice with noinstr - x86: Acquire SRCU read lock when handling fastpath MSR writes - Support linking rseq tests statically against glibc 2.35+ - Fix reference count for stats file descriptors - Detect userspace setting invalid CR0 Non-KVM: - Remove coccinelle script that has caused multiple confusion ("debugfs, coccinelle: check for obsolete DEFINE_SIMPLE_ATTRIBUTE() usage", acked by Greg)" * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (21 commits) KVM: selftests: Expand x86's sregs test to cover illegal CR0 values KVM: VMX: Don't fudge CR0 and CR4 for restricted L2 guest KVM: x86: Disallow KVM_SET_SREGS{2} if incoming CR0 is invalid Revert "debugfs, coccinelle: check for obsolete DEFINE_SIMPLE_ATTRIBUTE() usage" KVM: selftests: Verify stats fd is usable after VM fd has been closed KVM: selftests: Verify stats fd can be dup()'d and read KVM: selftests: Verify userspace can create "redundant" binary stats files KVM: selftests: Explicitly free vcpus array in binary stats test KVM: selftests: Clean up stats fd in common stats_test() helper KVM: selftests: Use pread() to read binary stats header KVM: Grab a reference to KVM for VM and vCPU stats file descriptors selftests/rseq: Play nice with binaries statically linked against glibc 2.35+ Revert "KVM: SVM: Skip WRMSR fastpath on VM-Exit if next RIP isn't valid" KVM: x86: Acquire SRCU read lock when handling fastpath MSR writes KVM: VMX: Use vmread_error() to report VM-Fail in "goto" path KVM: VMX: Make VMREAD error path play nice with noinstr KVM: x86/irq: Conditionally register IRQ bypass consumer again KVM: X86: Use GFP_KERNEL_ACCOUNT for pid_table in ipiv KVM: x86: check the kvm_cpu_get_interrupt result before using it KVM: x86: VMX: set irr_pending in kvm_apic_update_irr ...
2023-07-29Revert "debugfs, coccinelle: check for obsolete DEFINE_SIMPLE_ATTRIBUTE() usage"Sean Christopherson
Remove coccinelle's recommendation to use DEFINE_DEBUGFS_ATTRIBUTE() instead of DEFINE_SIMPLE_ATTRIBUTE(). Regardless of whether or not the "significant overhead" incurred by debugfs_create_file() is actually meaningful, warnings from the script have led to a rash of low-quality patches that have sowed confusion and consumed maintainer time for little to no benefit. There have been no less than four attempts to "fix" KVM, and a quick search on lore shows that KVM is not alone. This reverts commit 5103068eaca290f890a30aae70085fac44cecaf6. Link: https://lore.kernel.org/all/87tu2nbnz3.fsf@mpe.ellerman.id.au Link: https://lore.kernel.org/all/c0b98151-16b6-6d8f-1765-0f7d46682d60@redhat.com Link: https://lkml.kernel.org/r/20230706072954.4881-1-duminjie%40vivo.com Link: https://lore.kernel.org/all/Y2FsbufV00jbyF0B@google.com Link: https://lore.kernel.org/all/Y2ENJJ1YiSg5oHiy@orome Link: https://lore.kernel.org/all/7560b350e7b23786ce712118a9a504356ff1cca4.camel@kernel.org Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sean Christopherson <seanjc@google.com> Message-Id: <20230726202920.507756-1-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2023-07-29scripts/kallsyms: Fix build failure by setting errno before calling getline()James Clark
getline() returns -1 at EOF as well as on error. It also doesn't set errno to 0 on success, so initialize it to 0 before using errno to check for an error condition. See the paragraph here [1]: For some system calls and library functions (e.g., getpriority(2)), -1 is a valid return on success. In such cases, a successful return can be distinguished from an error return by setting errno to zero before the call, and then, if the call returns a status that indicates that an error may have occurred, checking to see if errno has a nonzero value. Bear has a bug [2] that launches processes with errno set and causes the following build failure: $ bear -- make LLVM=1 ... LD .tmp_vmlinux.kallsyms1 NM .tmp_vmlinux.kallsyms1.syms KSYMS .tmp_vmlinux.kallsyms1.S read_symbol: Invalid argument [1]: https://linux.die.net/man/3/errno [2]: https://github.com/rizsotto/Bear/issues/469 Fixes: 1c975da56a6f ("scripts/kallsyms: remove KSYM_NAME_LEN_BUFFER") Reviewed-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: James Clark <james.clark@arm.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2023-07-27scripts/spelling.txt: remove 'thead' as a typoDrew Fustini
T-Head is a vendor of processor core IP, and they have recently introduced the RISC-V TH1520 SoC. Remove 'thead' as a typo of 'thread' to avoid checkpatch incorrectly warning that 'thead' is typo in patches that add support for T-Head designs in the kernel. Link: https://lkml.kernel.org/r/20230723010329.674186-1-dfustini@baylibre.com Link: https://www.t-head.cn/ Signed-off-by: Drew Fustini <dfustini@baylibre.com> Acked-by: Guo Ren <guoren@kernel.org> Cc: Conor Dooley <conor@kernel.org> Cc: Jisheng Zhang <jszhang@kernel.org> Cc: Colin Ian King <colin.i.king@gmail.com> Cc: Diederik de Haas <didi.debian@cknow.org> Cc: Ian Rogers <irogers@google.com> Cc: Luca Ceresoli <luca.ceresoli@bootlin.com> # versaclock5 Cc: Randy Dunlap <rdunlap@infradead.org> Cc: SeongJae Park <sj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2023-07-24checkpatch: Complain about unexpected uses of RCU Tasks TracePaul E. McKenney
RCU Tasks Trace is quite specialized, having been created specifically for sleepable BPF programs. Because it allows general blocking within readers, any new use of RCU Tasks Trace must take current use cases into account. Therefore, update checkpatch.pl to complain about use of any of the RCU Tasks Trace API members outside of BPF and outside of RCU itself. [ paulmck: Apply Joe Perches feedback. ] Cc: Andy Whitcroft <apw@canonical.com> (maintainer:CHECKPATCH) Cc: Joe Perches <joe@perches.com> (maintainer:CHECKPATCH) Cc: Dwaipayan Ray <dwaipayanray1@gmail.com> (reviewer:CHECKPATCH) Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com> Cc: Alexei Starovoitov <ast@kernel.org> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: John Fastabend <john.fastabend@gmail.com> Cc: <bpf@vger.kernel.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2023-07-25kbuild: rpm-pkg: skip build dependency check on non-rpm systemsMasahiro Yamada
Commit 8818039f959b ("kbuild: add ability to make source rpm buildable using koji") added the BuildRequires: field. Checking the build dependency is fine, but one annoyance is that 'make (bin)rpm-pkg' fails on non-rpm systems [1]. For example, Debian provides rpmbuild via 'apt install rpm', but of course cannot meet the requirement listed in the BuildRequires: field. It is possible to pass RPMOPTS=--nodeps to work around it, but it is reasonable to do it automatically. If 'rpm -q rpm' fails, it is not an RPM-managed system. (The command 'rpm' is not installed at all, or was installed by other means.) In that case, pass --nodeps to skip the build dependency check. [1]: https://lore.kernel.org/linux-kbuild/Y6mkdYQYmjUz7bqV@li-4a3a4a4c-28e5-11b2-a85c-a8d192c6f089.ibm.com/ Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2023-07-25kbuild: rpm-pkg: refactor *rpm-pkg targetsMasahiro Yamada
Merge the similar build targets. Also, make the output location consistent. Previously, source packages were created in the build directory, while binary packages under ~/rpmbuild/RPMS/. Now, Kbuild creates the rpmbuild/ directory in the build directory, and saves all packages under it. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2023-07-25kbuild: rpm-pkg: build the kernel in-place for rpm-pkgMasahiro Yamada
Currently, 'make rpm-pkg' always builds the kernel from the pristine source tree in the ~/rpmbuild/BUILD/ directory. Build the kernel incrementally just like 'make binrpm-pkg'. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2023-07-25kbuild: rpm-pkg: rename binkernel.spec to kernel.specMasahiro Yamada
Now kernel.spec and binkernel.spec have the exactly same contents. Use kernel.spec for binrpm-pkg as well. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2023-07-25kbuild: rpm-pkg: split out the body of spec fileMasahiro Yamada
Most of the lines in the spec file are independent of any build condition. Split the body of the spec file into scripts/package/kernel.spec. scripts/package/mkspec will prepend some env-dependent variables. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2023-07-25kbuild: rpm-pkg: introduce %{with_devel} switch to select devel packageMasahiro Yamada
scripts/package/mkspec preprocesses the spec file by sed, but it is unreadable. This commit removes the last portion of the sed scripting. Remove the $S$M prefixes from the conditionally generated lines. Instead, surround the code with %if %{with_devel} ... %endif. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2023-07-25kbuild: rpm-pkg: run modules_install for non-modular kernelMasahiro Yamada
For the same reason as commit 4243afdb9326 ("kbuild: builddeb: always make modules_install, to install modules.builtin*"), run modules_install even when CONFIG_MODULES=n to install modules.builtin*. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2023-07-25kbuild: rpm-pkg: invoke the kernel build from rpmbuild for binrpm-pkgMasahiro Yamada
To reduce the preprocess of the spec file, invoke the kernel build from rpmbuild. Run init/build-version to increment the release number not only for binrpm-pkg but also for srcrpm-pkg and rpm-pkg. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2023-07-25kbuild: rpm-pkg: use a dummy string for _arch when undefinedMasahiro Yamada
If this affects only %{buildroot}, it should be enough to use a fixed string for _arch when it is undefined. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2023-07-25kbuild: rpm-pkg: derive the Version from %{KERNELRELEASE}Masahiro Yamada
Avoid hard-coding the Version field in the generated spec file. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2023-07-25kbuild: refactor kernel-devel RPM package and linux-headers Deb packageMasahiro Yamada
The kernel-devel RPM package and the linux-headers Debian package provide headers and scripts needed for building external modules. They copy the necessary files in slightly different ways - the RPM copies almost everything except some exclude patterns, while the Debian copies less number of files. There is no need to maintain different code to do the same thing. Split the Debian code out to scripts/package/install-extmod-build, which is called from both of the packages. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2023-07-25kbuild: add a phony target to run a command with Kbuild env varsMasahiro Yamada
There are some cases where we want to run a command with the same environment variables as Kbuild uses. For example, 'make coccicheck' invokes scripts/coccicheck from the top Makefile so that the script can reference to ${LINUXINCLUDE}, ${KBUILD_EXTMOD}, etc. The top Makefile defines several phony targets that run a script. We do it also for an internally used script, which results in a somewhat complex call graph. One example: debian/rules binary-arch -> make intdeb-pkg -> scripts/package/builddeb It is also tedious to add a dedicated target like 'intdeb-pkg' for each use case. Add a generic target 'run-command' to run an arbitrary command in an environment with all Kbuild variables set. The usage is: $ make run-command KBUILD_RUN_COMMAND=<command> The concept is similar to: $ dpkg-architecture -c <command> This executes <command> in an environment which has all DEB_* variables defined. Convert the existing 'make intdeb-pkg'. Another possible usage is to interrogate a Make variable. $ make run-command KBUILD_RUN_COMMAND='echo $(KBUILD_CFLAGS)' might be useful to see KBUILD_CFLAGS set by the top Makefile. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>