Re: [PATCH] kbuild: remove the target in signal traps when interrupted

From: Ingo Molnar
Date: Sun Aug 07 2022 - 05:40:55 EST




* Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:

> Reported-by: Ingo Molnar <mingo@xxxxxxxxxx>
> Reported-by: Rob Herring <robh@xxxxxxxxxx>
> Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
> ---
>
> If you are happy to help test this patch, that will be appreciated.
>
> Without applying this patch,
>
> $ make -j<nr-proc> 2>&1 | tee log
>
> Then, you will see an error reported in [1].
> You may need to repeat it dozen of times to reproduce it.
> The more CPU cores you have, the easier you will get the error.
>
> Apply this patch, and repeat the same.
> You will no longer see that error (hopefully).
>
>
> scripts/Kbuild.include | 23 ++++++++++++++++++++++-
> 1 file changed, 22 insertions(+), 1 deletion(-)

I've tested your patch on a system with 64 CPUs on the latest upstream
kernel, and without your patch I was able to quickly reproduce the
corrupted .cmd files within 4-5 interrupted kernel builds:

fs/xfs/libxfs/.xfs_alloc.o.cmd:5: *** unterminated call to function 'wildcard': missing ')'. Stop.

or:

kernel/time/.tick-broadcast.o.cmd:5: *** unterminated call to function 'wildcard': missing ')'. Stop.

or:

lib/.is_single_threaded.o.cmd:5: *** unterminated call to function 'wildcard': missing ')'. Stop.

These corrupted .cmd files blocked subsequent additive builds perpetually,
until I manually removed the corrupted .o.cmd file or did an explicit 'make clean'.

With your patch I've yet to see a single failure, after dozens of attempts.

Tested-by: Ingo Molnar <mingo@xxxxxxxxxx>

Thanks a lot for taking care of this problem!

Ingo