RE: [tip: x86/core] x86/cpufeatures: Generate the <asm/cpufeaturemasks.h> header based on build config
From: Michael Kelley
Date: Sun Mar 23 2025 - 14:06:16 EST
From: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> Sent: Thursday, March 20, 2025 9:56 AM
>
> On Thu, 20 Mar 2025 at 09:23, Michael Kelley <mhklinux@xxxxxxxxxxx> wrote:
> >
> > With this commit, changing the modified time on .config causes cpufeaturemasks.h
> > to be rebuilt, and then all dependencies on cpufeaturemasks.h are also rebuilt. It
> > doesn't figure out that nothing has changed in .config. A fair amount of
> > unnecessary rebuilding is done.
>
> Hmm. Normally it is the tools that *create* the config file that
> should notice that it hasn't changed, and not write a new one.
>
> See conf_write() in scripts/kconfig/confdata.c for the particular case
> of the regular "make *config*'
>
> > I'm seeing this changed behavior specifically with the make-kpkg script on
> > Ubuntu 20.04. It's not clear why make-kpkg is updating the modified time
> > on .config, but prior to this commit, that update had no negative effect.
>
> It sounds like the make-kpkg script should probably be fixed to not
> overwrite the config file unconditionally, and do that "make
> oldconfig" and friends do, which is to notice when it hasn't changed
> and leave it alone.
>
For the record, the problem with make-kpkg is that it does "make syncconfig"
multiple times in prepping to build, sometimes passing environment
variable ARCH=x86 and sometimes ARCH=x86_64. scripts/kconfig/conf uses
that environment variable to decorate the header of the generated .config
file, and to force a rebuild in include/config/auto.conf.cmd if the value changes.
So flipping between two different values causes a "new" .config to be
generated even though nothing of substance has changed.
I hacked the make-kpkg scripts to consistently use ARCH=x86 and that
solves the problem. But this is a private hack as make-kpkg hasn't been
updated in years and is no longer supported. In Ubuntu releases, it is
deprecated after 20.04.
Michael