diff mbox series

kbuild: fix parallel build race caused by u-boot.cfg regeneration

Message ID 1547019140-23634-1-git-send-email-yamada.masahiro@socionext.com
State Superseded
Headers show
Series kbuild: fix parallel build race caused by u-boot.cfg regeneration | expand

Commit Message

Masahiro Yamada Jan. 9, 2019, 7:32 a.m. UTC
Multiple people have reported intermittent build failure in parallel
building.

Kever Yang reported this issue some time ago [1], but I could not
get enough clue at that time.

This time, Richard Purdie provided a complete build log [2], which
was very helpful for me to root-cause it.

The cause of the problem is commit 0d982c585330 ("Makefile: add
dependencies to regenerate u-boot.cfg when lost").

That commit added the 'cfg' as the prerequisite of the 'all' target,
so the parallel build tries to run it simultaneously, then regenerates
a symlink while building objects.

When u-boot.cfg is accidentally lost, lets' rebuild it before
descending into any subdirectories.

Also, what is annoying is u-boot.cfg is currently regenerated every
time since it depends on FORCE. We can get rid of all the prerequisites
of u-boot.cfg because u-boot.cfg is rebuilt anyway as the byproduct of
auto.conf when a user updates the .config file.

[1] https://lists.denx.de/pipermail/u-boot/2018-June/330341.html
[2] https://autobuilder.yoctoproject.org/typhoon/#/builders/65/builds/160/steps/7/logs/step1b

Fixes: 0d982c585330 ("Makefile: add dependencies to regenerate u-boot.cfg when lost")
Reported-by: Kever Yang <kever.yang@rock-chips.com>
Reported-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Simon Glass Jan. 10, 2019, 12:57 p.m. UTC | #1
On Wed, 9 Jan 2019 at 00:32, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> Multiple people have reported intermittent build failure in parallel
> building.
>
> Kever Yang reported this issue some time ago [1], but I could not
> get enough clue at that time.
>
> This time, Richard Purdie provided a complete build log [2], which
> was very helpful for me to root-cause it.
>
> The cause of the problem is commit 0d982c585330 ("Makefile: add
> dependencies to regenerate u-boot.cfg when lost").
>
> That commit added the 'cfg' as the prerequisite of the 'all' target,
> so the parallel build tries to run it simultaneously, then regenerates
> a symlink while building objects.
>
> When u-boot.cfg is accidentally lost, lets' rebuild it before
> descending into any subdirectories.
>
> Also, what is annoying is u-boot.cfg is currently regenerated every
> time since it depends on FORCE. We can get rid of all the prerequisites
> of u-boot.cfg because u-boot.cfg is rebuilt anyway as the byproduct of
> auto.conf when a user updates the .config file.
>
> [1] https://lists.denx.de/pipermail/u-boot/2018-June/330341.html
> [2] https://autobuilder.yoctoproject.org/typhoon/#/builders/65/builds/160/steps/7/logs/step1b
>
> Fixes: 0d982c585330 ("Makefile: add dependencies to regenerate u-boot.cfg when lost")
> Reported-by: Kever Yang <kever.yang@rock-chips.com>
> Reported-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  Makefile | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Masahiro Yamada Jan. 10, 2019, 2:08 p.m. UTC | #2
On Wed, Jan 9, 2019 at 4:33 PM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> Multiple people have reported intermittent build failure in parallel
> building.
>
> Kever Yang reported this issue some time ago [1], but I could not
> get enough clue at that time.
>
> This time, Richard Purdie provided a complete build log [2], which
> was very helpful for me to root-cause it.
>
> The cause of the problem is commit 0d982c585330 ("Makefile: add
> dependencies to regenerate u-boot.cfg when lost").
>
> That commit added the 'cfg' as the prerequisite of the 'all' target,
> so the parallel build tries to run it simultaneously, then regenerates
> a symlink while building objects.
>
> When u-boot.cfg is accidentally lost, lets' rebuild it before
> descending into any subdirectories.
>
> Also, what is annoying is u-boot.cfg is currently regenerated every
> time since it depends on FORCE. We can get rid of all the prerequisites
> of u-boot.cfg because u-boot.cfg is rebuilt anyway as the byproduct of
> auto.conf when a user updates the .config file.
>
> [1] https://lists.denx.de/pipermail/u-boot/2018-June/330341.html
> [2] https://autobuilder.yoctoproject.org/typhoon/#/builders/65/builds/160/steps/7/logs/step1b
>
> Fixes: 0d982c585330 ("Makefile: add dependencies to regenerate u-boot.cfg when lost")
> Reported-by: Kever Yang <kever.yang@rock-chips.com>
> Reported-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  Makefile | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index eeb299f..363ebc8 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -534,7 +534,7 @@ include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
>         @# Otherwise, 'make silentoldconfig' would be invoked twice.
>         $(Q)touch include/config/auto.conf
>
> -u-boot.cfg spl/u-boot.cfg tpl/u-boot.cfg: include/config.h FORCE
> +u-boot.cfg spl/u-boot.cfg tpl/u-boot.cfg:
>         $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.autoconf $(@)
>
>  -include include/autoconf.mk
> @@ -910,7 +910,7 @@ quiet_cmd_cfgcheck = CFGCHK  $2
>  cmd_cfgcheck = $(srctree)/scripts/check-config.sh $2 \
>                 $(srctree)/scripts/config_whitelist.txt $(srctree)
>
> -all:           $(ALL-y) cfg
> +all:           $(ALL-y)
>  ifeq ($(CONFIG_DM_I2C_COMPAT)$(CONFIG_SANDBOX),y)
>         @echo >&2 "===================== WARNING ======================"
>         @echo >&2 "This board uses CONFIG_DM_I2C_COMPAT. Please remove"
> @@ -1549,7 +1549,7 @@ prepare0: archprepare FORCE
>         $(Q)$(MAKE) $(build)=.
>
>  # All the preparing..
> -prepare: prepare0
> +prepare: prepare0 cfg


I noticed this is still unsafe
because prepare0 descends into ./Kbuild
and generates asm-offset things.

I will send v2.


>
>  # Generate some files
>  # ---------------------------------------------------------------------------
> --
> 2.7.4
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index eeb299f..363ebc8 100644
--- a/Makefile
+++ b/Makefile
@@ -534,7 +534,7 @@  include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
 	@# Otherwise, 'make silentoldconfig' would be invoked twice.
 	$(Q)touch include/config/auto.conf
 
-u-boot.cfg spl/u-boot.cfg tpl/u-boot.cfg: include/config.h FORCE
+u-boot.cfg spl/u-boot.cfg tpl/u-boot.cfg:
 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.autoconf $(@)
 
 -include include/autoconf.mk
@@ -910,7 +910,7 @@  quiet_cmd_cfgcheck = CFGCHK  $2
 cmd_cfgcheck = $(srctree)/scripts/check-config.sh $2 \
 		$(srctree)/scripts/config_whitelist.txt $(srctree)
 
-all:		$(ALL-y) cfg
+all:		$(ALL-y)
 ifeq ($(CONFIG_DM_I2C_COMPAT)$(CONFIG_SANDBOX),y)
 	@echo >&2 "===================== WARNING ======================"
 	@echo >&2 "This board uses CONFIG_DM_I2C_COMPAT. Please remove"
@@ -1549,7 +1549,7 @@  prepare0: archprepare FORCE
 	$(Q)$(MAKE) $(build)=.
 
 # All the preparing..
-prepare: prepare0
+prepare: prepare0 cfg
 
 # Generate some files
 # ---------------------------------------------------------------------------