summaryrefslogtreecommitdiff
path: root/scripts/git.orderFile
diff options
context:
space:
mode:
authorPetr Pavlu <petr.pavlu@suse.com>2026-04-10 15:13:29 +0200
committerNathan Chancellor <nathan@kernel.org>2026-04-29 18:03:49 -0700
commit7abef41afad05be1a4b2a3303b9ecf62403463a1 (patch)
tree8b090ce9008a0fae726d0486a84f08d78fb4e269 /scripts/git.orderFile
parenta0d7be4ab3ece46919418c57d0de4b6fd4ce7590 (diff)
kbuild/btf: Remove broken module relinking exclusion
Commit 5f9ae91f7c0d ("kbuild: Build kernel module BTFs if BTF is enabled and pahole supports it") in 2020 introduced CONFIG_DEBUG_INFO_BTF_MODULES to enable generation of split BTF for kernel modules. This change required the %.ko Makefile rule to additionally depend on vmlinux, which is used as a base for deduplication. The regular ld_ko_o command executed by the rule was then modified to be skipped if only vmlinux changes. This was done by introducing a new if_changed_except command and updating the original call to '+$(call if_changed_except,ld_ko_o,vmlinux)'. Later, commit 214c0eea43b2 ("kbuild: add $(objtree)/ prefix to some in-kernel build artifacts") in 2024 updated the rule's reference to vmlinux from 'vmlinux' to '$(objtree)/vmlinux'. This accidentally broke the previous logic to skip relinking modules if only vmlinux changes. The issue is that '$(objtree)' is typically '.' and GNU Make normalizes the resulting prerequisite './vmlinux' to just 'vmlinux', while the exclusion logic retains the raw './vmlinux'. As a result, if_changed_except doesn't correctly filter out vmlinux. Consequently, with CONFIG_DEBUG_INFO_BTF_MODULES=y, modules are relinked even if only vmlinux changes. It is possible to fix this Makefile issue. However, having the %.ko rule update the resulting file in place without starting from the original inputs is rather fragile. The logic is harder to debug if something breaks during a subsequent .ko update because the old input is lost due to the overwrite. Additionally, it requires that the BTF processing is idempotent. For example, sorting id+flags BTF_SET8 pairs in .BTF_ids by resolve_btfids currently doesn't have this property. One option is to split the %.ko target into two rules: the first for partial linking and the second one for generating the BTF data. However, this approach runs into an issue with requiring additional intermediate files, which increases the size of the build directory. On my system, when using a large distribution config with ~5500 modules, the size of the build directory with debuginfo enabled is already ~25 GB, with .ko files occupying ~8 GB. Duplicating these .ko files doesn't seem practical. Measuring the speed of the %.ko processing shows that the link step is actually relatively fast. It takes about 20% of the overall rule time, while the BTF processing accounts for 80%. Moreover, skipping the link part becomes relevant only during local development. In such cases, developers typically use configs that enable a limited number of modules, so having the %.ko rule slightly slower doesn't significantly impact the total rebuild time. This is supported by the fact that no one has complained about this optimization being broken for the past two years. Therefore, remove the logic that prevents module relinking when only vmlinux changes and simplify Makefile.modfinal. Signed-off-by: Petr Pavlu <petr.pavlu@suse.com> Reviewed-by: Alan Maguire <alan.maguire@oracle.com> Tested-by: Alan Maguire <alan.maguire@oracle.com> Acked-by: Ihor Solodrai <ihor.solodrai@linux.dev> Link: https://patch.msgid.link/20260410131343.2519532-1-petr.pavlu@suse.com Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Diffstat (limited to 'scripts/git.orderFile')
0 files changed, 0 insertions, 0 deletions