Re: [PATCHv2] locking/atomics: build atomic headers as required
From: Ingo Molnar
Date: Thu Dec 06 2018 - 11:13:52 EST
* Mark Rutland <mark.rutland@xxxxxxx> wrote:
> Andrew and Ingo report that the check-atomics.sh script is simply too
> slow to run for every kernel build, and it's impractical to make it
> faster without rewriting it in something other than shell.
>
> Rather than committing the generated headers, let's regenerate these
> as-required, if we change the data or scripts used to generate the
> atomic headers, or when building from a pristine tree.
>
> That ensures they're always up-to-date, allows them to be built in
> parallel, and avoid redundant rebuilds, which is a 2-8s saving per
> incremental build. Since the results are not committed, it's very
> obvious that they should not be modified directly. If we need to
> generate more headers in future, it's easy to extend Makefile.genheader
> to permit this.
>
> I've verified that this works in the cases we previously had issues with
> (out-of-tree builds and where scripts have no execute permissions), and
> have tested these cases for both x86_64 and arm64.
>
> The diffstat looks nice, at least...
>
> Signed-off-by: Mark Rutland <mark.rutland@xxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: Boqun Feng <boqun.feng@xxxxxxxxx>
> Cc: Borislav Petkov <bp@xxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Cc: Will Deacon <will.deacon@xxxxxxx>
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> ---
> Kbuild | 18 +-
> Makefile | 8 +-
> arch/arm64/include/asm/atomic.h | 2 +-
> arch/x86/include/asm/atomic.h | 2 +-
> include/asm-generic/atomic-instrumented.h | 1787 ----------------------
> include/asm-generic/atomic-long.h | 1012 -------------
> include/linux/atomic-fallback.h | 2294 -----------------------------
> include/linux/atomic.h | 4 +-
> scripts/Makefile.genheader | 26 +
> scripts/atomic/check-atomics.sh | 19 -
> 10 files changed, 38 insertions(+), 5134 deletions(-)
> delete mode 100644 include/asm-generic/atomic-instrumented.h
> delete mode 100644 include/asm-generic/atomic-long.h
> delete mode 100644 include/linux/atomic-fallback.h
> create mode 100644 scripts/Makefile.genheader
> delete mode 100755 scripts/atomic/check-atomics.sh
So these 'automatically generated' headers are actual and important code,
and I think it's bad practice to remove these from the git grep search
space and history as well.
Really, this whole notion of auto-generating the headers should be
implemented correctly, instead of working around deficiencies in a
short-term fashion that introduces other deficiencies.
I never got any replies to my previous comments about this:
<20181128083057.GA7879@xxxxxxxxx>
Did I miss some mails of yours perhaps?
Thanks,
Ingo