[Bug 242835] concurrency issue when building kernel with 'make -j8': make[5]: make[5]: don't know how to make opt_global.h. Stop

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 30 May 2026 19:29:28 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=242835

--- Comment #8 from John Hein <jcfyecrayz@liamekaens.com> ---
(In reply to Martin Birgmeier from comment #7)
In my testing, the failure can occur if opt_global.h is not removed or touched
at all.  See my comment on conditions in comment 6:

" opt_global.h exists in obj/.../GENERIC/opt_global.h and existed before the
build"

I have had object trees that have an opt_global.h that is a year+ old and had
the failure occur.  The output snippet from comment 6 had was such a case:

-rw-r--r--  1 jhein  wheel  598 Dec 19  2022
obj/usr/src/amd64.amd64/sys/GENERIC/opt_global.h

It may be there is a race scenario like you describe.  But it may also be a
race in .depends files contents.

For instance, in a parallel build some .depends files are created (in process
A) at the same time a consumer (B) in another parallel process tries to read
the .depends file.  When B reads the .depends file it finds a target with
opt_global.h as a dependency, but never finds a make target for opt_global.h so
make(1) does not know what to do and gives up.

I don't know any details to back that up yet.  But something like that could be
a possibility.

It could be issues with make(1) file locking (or just lack of locking where it
is needed).  I would think maybe people would see this in the non-NFS case
occasionally, however (though maybe with less frequency). So maybe it could be
a bug in NFS or NFS lockd.

By the way, I am trying to zero in on a way to reproduce this.  I ran 'make
buildkernel -j4' (with the conditions described in comment 6) 40 times and each
time before running make I did 'touch src/sys/x86/include/_stdint.h' (because
that is a recent change in the source tree and it would be something that a lot
of source files would depend on).

It died on #36 out of the 40 iterations.

If I can consistently get a failure this quickly, I can start adding
instrumentation to look more closely at file states or run make with a
-d<something> or maybe ktrace.

This time, it died in ip_mroute_mod:

========
bmake[4]: bmake[4]: don't know how to make opt_global.h. Stop

bmake[4]: stopped in /usr/src/sys/modules/ip_mroute_mod
.ERROR_TARGET='opt_global.h'
.ERROR_META_FILE=''
.MAKE.LEVEL='4'
MAKEFILE=''
.MAKE.MODE='meta missing-filemon=yes missing-meta=yes silent=yes'
_ERROR_CMD='.PHONY'
.CURDIR='/usr/src/sys/modules/ip_mroute_mod'
.MAKE='/usr/obj/usr/src/make.amd64/bmake'
.OBJDIR='/usr/obj/usr/src/amd64.amd64/sys/GENERIC/modules/usr/src/sys/modules/ip_mroute_mod'
.TARGETS='all'
DESTDIR=''
LD_LIBRARY_PATH=''
MACHINE='amd64'
MACHINE_ARCH='amd64'
MAKEOBJDIRPREFIX='/usr/obj/usr/src/amd64.amd64/sys/GENERIC/modules'
MAKESYSPATH='/usr/src/share/mk'
MAKE_VERSION='20220208'
PATH='/usr/obj/usr/src/amd64.amd64/tmp/bin:/usr/obj/usr/src/amd64.amd64/tmp/usr/sbin:/usr/obj/usr/src/amd64.amd64/tmp/usr/bin:/usr/obj/us
r/src/amd64.amd64/tmp/legacy/usr/sbin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/bin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/bin:/usr/ob
j/usr/src/amd64.amd64/tmp/legacy/usr/libexec:/sbin:/bin:/usr/sbin:/usr/bin'
SRCTOP='/usr/src'
OBJTOP='/usr/obj/usr/src/amd64.amd64/sys/GENERIC/modules/usr/src'
.MAKE.MAKEFILES='/usr/src/share/mk/sys.mk /usr/src/share/mk/local.sys.env.mk
/usr/src/share/mk/src.sys.env.mk /etc/src-env.conf /usr/src/
share/mk/bsd.mkopt.mk /usr/src/share/mk/src.sys.obj.mk
/usr/src/share/mk/auto.obj.mk /usr/src/share/mk/bsd.suffixes.mk /etc/make.conf
/us
r/src/share/mk/local.sys.mk /usr/src/share/mk/src.sys.mk
/usr/src/sys/modules/ip_mroute_mod/Makefile /usr/src/share/mk/bsd.kmod.mk
/usr/src/share/mk/bsd.sysdir.mk /usr/src/sys/conf/kmod.mk
/usr/src/sys/conf/kmod.opts.mk /usr/src/share/mk/bsd.init.mk
/usr/src/share/mk/bsd.opts.mk /usr/src/share/mk/bsd.cpu.mk
/usr/src/share/mk/local.init.mk /usr/src/share/mk/src.init.mk
/usr/src/sys/modules/ip_mroute_mod/../Makefile.inc /usr/src/share/mk/bsd.own.mk
/usr/src/share/mk/bsd.compiler.mk /usr/src/share/mk/bsd.linker.mk
/usr/src/sys/conf/kern.opts.mk /usr/src/sys/conf/config.mk
/usr/src/share/mk/bsd.links.mk /usr/src/share/mk/bsd.dep.mk
/usr/src/share/mk/bsd.clang-analyze.mk /usr/src/share/mk/bsd.obj.mk
/usr/src/share/mk/bsd.subdir.mk /usr/src/sys/conf/kern.mk /dev/null'
.PATH='. /usr/src/sys/modules/ip_mroute_mod /usr/src/sys/netinet
/usr/src/sys/netinet6 /usr/obj/usr/src/amd64.amd64/sys/GENERIC'
--- buildkernel ---

bmake[1]: stopped in /usr/src
--- buildkernel ---
========

-- 
You are receiving this mail because:
You are the assignee for the bug.