From: Masahiro Yamada <masahiroy@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: Michal Marek <michal.lkml@markovi.net>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: kbuild: Ctrl-C of parallel kernel build sometimes corrupts .o.cmd files permanently
Date: Thu, 3 Jun 2021 03:20:20 +0900 [thread overview]
Message-ID: <CAK7LNAR54mOqEcUTUmEUfVAwA6XrGLr2J_3+v6fdys9tBLe28w@mail.gmail.com> (raw)
In-Reply-To: <YLeot94yAaM4xbMY@gmail.com>
On Thu, Jun 3, 2021 at 12:50 AM Ingo Molnar <mingo@kernel.org> wrote:
>
>
> There's a sporadic kbuild bug that's been happening for years, maybe you
> guys can think of where it comes from.
>
> Sometimes when I Ctrl-C a kernel build job, the .o.cmd file becomes
> corrupted and this breaks the build:
>
>
> kernel/.panic.o.cmd:5: *** unterminated call to function 'wildcard': missing ')'. Stop.
>
> ...
>
> drivers/gpu/drm/.drm_blend.o.cmd:5: *** unterminated call to function 'wildcard': missing ')'. Stop.
>
> The file was just partially created and didn't get cleaned up:
>
> kepler:~/tip> ls -l drivers/gpu/drm/.drm_blend.o.cmd.corrupted drivers/gpu/drm/.drm_blend.o.cmd.good
> -rw-rw-r-- 1 mingo mingo 28672 Jun 2 17:46 drivers/gpu/drm/.drm_blend.o.cmd.corrupted
> -rw-rw-r-- 1 mingo mingo 51331 Jun 2 17:46 drivers/gpu/drm/.drm_blend.o.cmd.good
>
> The file just got cut in half due to the Ctrl-C:
>
> --- drivers/gpu/drm/.drm_blend.o.cmd.corrupted 2021-06-02 17:46:16.951428326 +0200
> +++ drivers/gpu/drm/.drm_blend.o.cmd.good 2021-06-02 17:46:34.391111668 +0200
> @@ -646,4 +646,578 @@ deps_drivers/gpu/drm/drm_blend.o := \
> $(wildcard include/config/OF_OVERLAY) \
> include/linux/kobject.h \
> $(wildcard include/config/UEVENT_HELPER) \
> - $(wildcard include
> \ No newline at end of file
> + $(wildcard include/config/DEBUG_KOBJECT_RELEASE) \
> + include/linux/sysfs.h \
> + include/linux/kernfs.h \
> + $(wildcard include/config/KERNFS) \
>
>
> ... but once in this state it can only be fixed by 'make clean' (which
> loses all build progress), or by removing the stale file manually.
>
> It happens more frequently on systems with a lot of CPUs.
>
> Thanks,
>
> Ingo
Hmm, I have not observed this.
My expectation is, it should work like this:
When scripts/basic/fixdep is interrupted (or fail due to any reason),
partially written *.o.cmd is left over. So, having incomplete *.o.cmd
files is expectation.
When .DELETE_ON_ERROR is specified, GNU Make is supposed to
automatically delete the target on any error.
(If it is interrupted, it should exit with code 130)
On the next invocation of Make, Kbuild will not include .*.o.cmd files
whose corresponding *.o files do not exist.
When you got the corrupted drivers/gpu/drm/.drm_blend.o.cmd,
didn't you see the log
Deleting file 'drivers/gpu/drm/drm_blend.o' ?
If it works as I expect, the log should look like follows:
(I marked the lines with '<---- Deleting')
CC security/keys/keyctl_pkey.o
CC kernel/sys.o
CC arch/x86/power/hibernate_64.o
^Cmake[5]: *** Deleting file 'drivers/video/fbdev/core/fbcmap.o' <---- Deleting
make[5]: *** [scripts/Makefile.build:272:
drivers/video/fbdev/core/fbmon.o] Interrupt
make[3]: *** [scripts/Makefile.build:272: security/selinux/nlmsgtab.o] Interrupt
make[2]: *** [scripts/Makefile.build:272: arch/x86/power/cpu.o] Interrupt
make[2]: *** [scripts/Makefile.build:272:
arch/x86/power/hibernate_64.o] Interrupt
make[2]: *** [scripts/Makefile.build:272: arch/x86/pci/legacy.o] Interrupt
make[3]: *** [scripts/Makefile.build:272: arch/x86/mm/srat.o] Interrupt
make[3]: *** [scripts/Makefile.build:272: drivers/pnp/resource.o] Interrupt
make[3]: *** [scripts/Makefile.build:272: drivers/pnp/manager.o] Interrupt
make[3]: *** [scripts/Makefile.build:272: sound/core/ctljack.o] Interrupt
make[3]: *** [scripts/Makefile.build:272: net/core/skbuff.o] Interrupt
make[2]: *** [scripts/Makefile.build:515: arch/x86/mm] Interrupt
make[2]: *** [scripts/Makefile.build:272: kernel/signal.o] Interrupt
make[3]: *** [scripts/Makefile.build:272: drivers/acpi/device_sysfs.o] Interrupt
make[3]: *** [scripts/Makefile.build:272: drivers/pci/pci.o] Interrupt
make[2]: *** [scripts/Makefile.build:272: kernel/sys.o] Interrupt
make[2]: *** [scripts/Makefile.build:515: net/core] Interrupt
make[2]: *** [scripts/Makefile.build:272: block/blk-ioc.o] Interrupt
make[4]: *** [scripts/Makefile.build:272: arch/x86/events/intel/pt.o] Interrupt
make[2]: *** [scripts/Makefile.build:272: crypto/skcipher.o] Interrupt
make[3]: *** [scripts/Makefile.build:272: security/keys/keyctl_pkey.o] Interrupt
make[2]: *** [scripts/Makefile.build:272: fs/namei.o] Interrupt
make[3]: *** [scripts/Makefile.build:515: arch/x86/events/intel] Interrupt
make[5]: *** [scripts/Makefile.build:272:
drivers/video/fbdev/core/fbcmap.o] Interrupt
make[2]: *** [scripts/Makefile.build:515: arch/x86/events] Interrupt
make[2]: *** [scripts/Makefile.build:515: security/selinux] Interrupt
make[2]: *** [scripts/Makefile.build:272: ipc/mq_sysctl.o] Interrupt
make[2]: *** [scripts/Makefile.build:272: mm/percpu.o] Interrupt
make[2]: *** [scripts/Makefile.build:515: security/keys] Interrupt
make[2]: *** [scripts/Makefile.build:515: sound/core] Interrupt
make[4]: *** [scripts/Makefile.build:515: drivers/video/fbdev/core] Interrupt
make[3]: *** Deleting file 'arch/x86/kernel/nmi.o' <---- Deleting
make[1]: *** [Makefile:1849: arch/x86/pci] Interrupt
make[2]: *** [scripts/Makefile.build:515: drivers/pnp] Interrupt
make[1]: *** [Makefile:1849: kernel] Interrupt
make[1]: *** [Makefile:1849: fs] Interrupt
make[2]: *** [scripts/Makefile.build:515: drivers/pci] Interrupt
make[1]: *** [Makefile:1849: ipc] Interrupt
make[2]: *** [scripts/Makefile.build:515: drivers/acpi] Interrupt
make[1]: *** [Makefile:1849: security] Interrupt
make[1]: *** [Makefile:1849: crypto] Interrupt
make[1]: *** [Makefile:1849: block] Interrupt
make[1]: *** [Makefile:1849: sound] Interrupt
make[3]: *** [scripts/Makefile.build:272: arch/x86/kernel/ldt.o] Interrupt
make[1]: *** [Makefile:1849: net] Interrupt
make[3]: *** [scripts/Makefile.build:272: arch/x86/kernel/nmi.o] Interrupt
make[1]: *** [Makefile:1849: arch/x86/power] Interrupt
make[3]: *** [scripts/Makefile.build:515: drivers/video/fbdev] Interrupt
make[1]: *** [Makefile:1849: mm] Interrupt
make[2]: *** [scripts/Makefile.build:515: drivers/video] Interrupt
make[1]: *** [Makefile:1849: drivers] Interrupt
make[2]: *** [scripts/Makefile.build:515: arch/x86/kernel] Interrupt
make[1]: *** [Makefile:1849: arch/x86] Interrupt
make: *** [Makefile:351: __build_one_by_one] Interrupt
--
Best Regards
Masahiro Yamada
next prev parent reply other threads:[~2021-06-02 18:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-02 15:50 kbuild: Ctrl-C of parallel kernel build sometimes corrupts .o.cmd files permanently Ingo Molnar
2021-06-02 18:20 ` Masahiro Yamada [this message]
2021-06-03 12:39 ` Ingo Molnar
2021-06-03 12:43 ` Ingo Molnar
2021-06-04 3:22 ` Masahiro Yamada
2021-06-09 13:59 ` Masahiro Yamada
2021-06-12 13:25 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAK7LNAR54mOqEcUTUmEUfVAwA6XrGLr2J_3+v6fdys9tBLe28w@mail.gmail.com \
--to=masahiroy@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.lkml@markovi.net \
--cc=mingo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).