stand: properly declare subdir deps or .WAIT, do parallel build

buildworld already runs the stand build in parallel[1], so make it easier to
identify ordering issues by properly establishing dependencies or adding
.WAIT where needed.

Everything in stand/ relies on libsa, either directly or indirectly, because
libsa build is where the stand headers get installed and it gets linked in
most places.

Interpreters depend on their libs, machine dirs usually depend on top-level
libs that are getting built and at least one of the interpreter flavors.

For i386, order btx/libi386/libfirewire before everything else using a
big-ol-.WAIT hammer. btx is the most common dependency, but the others are
used sporadically. This seems to be where the race reporting on the mailing
list is- AFAICT, the following sequence is happening:

1.) One of the loaders gets built based on stale btx/btxldr
2.) btx/btxldr gets rebuilt
3.) installworld triggers loader rebuild because btx was rebuilt after

This seems like the most plausible explanation, as they've verified system
time and timestamps.

While we're here, let's switch stand/ over to a completely parallel build so
we can work out these kinds of issues in isolation rather than in the middle
of a larger build.

Reviewed by:	bdragon, sjg, tsoome
Tested by:	bdragon (-j1024, no failures, significant speed improvement)
Differential Revision:	https://reviews.freebsd.org/D23411
This commit is contained in:
Kyle Evans 2020-12-31 11:15:45 -06:00
parent 202aea9c82
commit ac5f382a9d
5 changed files with 59 additions and 6 deletions

View File

@ -11,22 +11,44 @@ LIB32LIST=libsa ficl liblua
S.yes+= libsa S.yes+= libsa
S.${MK_LOADER_OFW}+= libofw
S.${MK_FDT}+= fdt
S.${MK_FORTH}+= ficl S.${MK_FORTH}+= ficl
S.${MK_FORTH}+= forth S.${MK_FORTH}+= forth
S.${MK_LOADER_LUA}+= liblua S.${MK_LOADER_LUA}+= liblua
S.${MK_LOADER_LUA}+= lua S.${MK_LOADER_LUA}+= lua
S.${MK_FDT}+= fdt
S.${MK_LOADER_OFW}+= libofw
S.yes+= defaults S.yes+= defaults
S.yes+= man S.yes+= man
.if ${MK_FORTH} != "no"
INTERP_DEPENDS+= forth
.endif
.if ${MK_LOADER_LUA} != "no"
INTERP_DEPENDS+= lua
.endif
.include <bsd.arch.inc.mk> .include <bsd.arch.inc.mk>
S.${MK_EFI}+= efi S.${MK_EFI}+= efi
S.${MK_LOADER_UBOOT}+= uboot S.${MK_LOADER_UBOOT}+= uboot
.if defined(LIB32LIST)
LIB32DEPENDS= ${LIB32LIST:S/$/32/}
.endif
.if exists(${.CURDIR}/${MACHINE}/.) .if exists(${.CURDIR}/${MACHINE}/.)
S.yes+= ${MACHINE} S.yes+= ${MACHINE}
SUBDIR_DEPEND_${MACHINE}+= ${INTERP_DEPENDS}
.if ${MK_FDT} != "no"
SUBDIR_DEPEND_${MACHINE}+= fdt
.endif
.if ${MK_LOADER_UBOOT} != "no"
SUBDIR_DEPEND_${MACHINE}+= uboot
.endif
.if ${MK_LOADER_OFW} != "no"
SUBDIR_DEPEND_${MACHINE}+= libofw
.endif
.endif .endif
# Build the actual subdir list from S.yes, adding in the 32-bit # Build the actual subdir list from S.yes, adding in the 32-bit
@ -36,6 +58,20 @@ SUBDIR+=${_x}
.if defined(LIB32LIST) && ${LIB32LIST:M${_x}} .if defined(LIB32LIST) && ${LIB32LIST:M${_x}}
SUBDIR+=${_x}32 SUBDIR+=${_x}32
.endif .endif
.if ${_x} != "libsa"
SUBDIR_DEPEND_${_x}+= libsa
SUBDIR_DEPEND_${_x}32+= libsa32
.endif
.endfor .endfor
# Remaining dependencies
SUBDIR_DEPEND_libsa32+= libsa
SUBDIR_DEPEND_forth+= ficl
SUBDIR_DEPEND_lua+= liblua
SUBDIR_DEPEND_efi+= fdt
SUBDIR_PARALLEL= yes
.include <bsd.subdir.mk> .include <bsd.subdir.mk>

View File

@ -2,3 +2,7 @@
S.yes+= userboot S.yes+= userboot
S.yes+= i386 S.yes+= i386
SUBDIR_DEPEND_userboot+= ${INTERP_DEPENDS}
# These won't get tacked on in an amd64 build
SUBDIR_DEPEND_i386+= ${LIB32DEPENDS} ${INTERP_DEPENDS}

View File

@ -1,3 +1,5 @@
# $FreeBSD$ # $FreeBSD$
SUBDIR_PARALLEL= yes
.include "defs.mk" .include "defs.mk"

View File

@ -4,8 +4,12 @@ NO_OBJ=t
.include <bsd.init.mk> .include <bsd.init.mk>
SUBDIR.yes+= libefi
SUBDIR.${MK_FDT}+= fdt SUBDIR.${MK_FDT}+= fdt
SUBDIR.yes+= libefi boot1 gptboot SUBDIR.yes+= .WAIT
SUBDIR.yes+= boot1 gptboot
SUBDIR.${MK_FORTH}+= loader_4th SUBDIR.${MK_FORTH}+= loader_4th
SUBDIR.${MK_LOADER_LUA}+= loader_lua SUBDIR.${MK_LOADER_LUA}+= loader_lua
SUBDIR.yes+= loader_simp SUBDIR.yes+= loader_simp

View File

@ -4,10 +4,15 @@ NO_OBJ=t
.include <bsd.init.mk> .include <bsd.init.mk>
SUBDIR.yes= mbr pmbr boot0 boot0sio btx boot2 cdboot gptboot \ # Almost everything else here relies on btxldr, so we must make sure it's built
isoboot libi386 # before everything else proceeds so we don't end up building against a stale
# btxldr and ending up with a build-during-install scenario.
SUBDIR.yes+= btx libi386
SUBDIR.${MK_LOADER_FIREWIRE}+= libfirewire SUBDIR.${MK_LOADER_FIREWIRE}+= libfirewire
SUBDIR.yes+= .WAIT
SUBDIR.yes+= mbr pmbr boot0 boot0sio boot2 cdboot gptboot \
isoboot
SUBDIR.${MK_FORTH}+= loader_4th SUBDIR.${MK_FORTH}+= loader_4th
SUBDIR.${MK_LOADER_LUA}+= loader_lua SUBDIR.${MK_LOADER_LUA}+= loader_lua
@ -18,4 +23,6 @@ SUBDIR.yes+= pxeldr
SUBDIR.${MK_LOADER_ZFS}+= zfsboot gptzfsboot SUBDIR.${MK_LOADER_ZFS}+= zfsboot gptzfsboot
SUBDIR_DEPEND_pxeldr+= loader_${LOADER_DEFAULT_INTERP}
.include <bsd.subdir.mk> .include <bsd.subdir.mk>