Re: [tip: x86/core] x86/cpufeatures: Generate the <asm/cpufeaturemasks.h> header based on build config
From: Linus Torvalds
Date: Fri Mar 28 2025 - 20:14:53 EST
On Fri, 28 Mar 2025 at 16:23, Jakub Kicinski <kuba@xxxxxxxxxx> wrote:
>
> FWIW this also makes netdev CI melt down. Combination of allmodconfig
> insisting on WERROR, us insisting on W=1, and this change insisting on
> full kernel rebuild every time .config is touched :( IOW we do:
>
> make allmodconfig
> ./scripts/config -d werror
> make -j W=1
>
> Could a hack like this fly? I don't see an easy way out ..
Ok, clearly we need something like this.
That said, your patch makes my skin crawl a bit. Not because it's
wrong, but because it really makes me think "why don't we have this as
part of our normal "cmd_gen_" infrastructure?
In fact, we *do* have something like that for our infrastructure: it's
the 'filechk' macro.
So I think the real fix is something like this ENTIRELY UNTESTED
patch. Whitespace-damaged again to make sure people don't apply this
mindlessly, it needs more thought:
arch/x86/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 0fc7e8fd1a2e..769b29bf26ba 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -278,11 +278,11 @@ cpufeaturemasks.awk :=
$(srctree)/arch/x86/tools/cpufeaturemasks.awk
cpufeatures_hdr := $(srctree)/arch/x86/include/asm/cpufeatures.h
targets += $(cpufeaturemasks.hdr)
quiet_cmd_gen_featuremasks = GEN $@
- cmd_gen_featuremasks = $(AWK) -f $(cpufeaturemasks.awk)
$(cpufeatures_hdr) $(KCONFIG_CONFIG) > $@
+ filechk_featuremasks = $(AWK) -f $(cpufeaturemasks.awk)
$(cpufeatures_hdr) $(KCONFIG_CONFIG)
$(cpufeaturemasks.hdr): $(cpufeaturemasks.awk) $(cpufeatures_hdr)
$(KCONFIG_CONFIG) FORCE
$(shell mkdir -p $(dir $@))
- $(call if_changed,gen_featuremasks)
+ $(call filechk,featuremasks)
archprepare: $(cpufeaturemasks.hdr)
###
does something like that work? (And really: note the "something like
that" part, this may be *entirely* broken)
Linus