Bug #2279

make -j 3 buildkernel fails on UP

Added by thomas.nikolajsen over 2 years ago. Updated about 2 years ago.

Status:ClosedStart date:01/17/2012
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

Using fresh master (January 17th 2012)
make -j 3 buildkernel
fails on UP system.

(quickkernel succeds here)

Make -j 10 buildkernel
succeeds on 8 core system.

-
===> dev/disk/aic7xxx/ahc/ahc_pci
( cd ... ; make aic7xxx_reg.h )
make: don't know how to make aic7xxx_reg.h. Stop

History

#1 Updated by phma over 2 years ago

make -j 2 buildkernel fails on 2 cpu system (one core hyperthreaded). It may be a race condition or depend on the number j.

CCVER=gcc44 BINUTILSVER=binutils221 OBJFORMAT_PATH=/
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/pkg/bin cc -O -pipe -nostdinc -
I/usr/include -I. -I/usr/src/sys/dev/disk/aic7xxx/aicasm -std=gnu99 -Wsystem-
headers -Werror -Wall -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-
prototypes -Wpointer-arith -Wold-style-definition -Wreturn-type -Wcast-qual -
Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wchar-
subscripts -Winline -Wnested-externs -Wredundant-decls -static -o aicasm.nx
aicasm.no aicasm_symbol.no aicasm_gram.no aicasm_macro_gram.no
aicasm_scan.no aicasm_macro_scan.no -ll
===> dev/disk/aic7xxx/ahc
===> dev/disk/aic7xxx/ahc/ahc_pci
( cd .. ; make aic7xxx_reg.h )
make: don't know how to make aic7xxx_reg.h. Stop
*** Error code 2
1 error
*** Error code 2
1 error
*** Error code 2
1 error
*** Error code 2
1 error
*** Error code 2
1 error
*** Error code 2
1 error
*** Error code 2
make -V SFILES -V SYSTEM_SFILES | xargs env MKDEP_CPP="cc -E" mkdep -a -f
.newdep -x assembler-with-cpp -DLOCORE -O -pipe -Wall -Wredundant-decls -
Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -
Winline -Wcast-qual -Wold-style-definition -std=c99 -Wold-style-declaration -g
-nostdinc -I. -Iinclude -I/usr/src/sys -I/usr/src/sys/../include -
I/usr/obj/usr/src/sys/GENERIC -I"/usr/src/sys/dev/acpica5" -
I"/usr/src/sys/contrib/dev/acpica-unix/include" -
I/usr/src/sys/dev/netif/ath/hal -I/usr/src/sys/dev/netif/ath/hal/ath_hal -
D_KERNEL -include opt_global.h -finline-limit=8000 --param inline-unit-
growth=100 --param large-function-growth=1000 -fno-common -ffreestanding -
mpreferred-stack-boundary=2 -fno-stack-protector -mno-mmx -mno-3dnow -
mno-sse -mno-sse2 -mno-sse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -mno-sse4
-mno-sse4a -mno-sse5 -mno-abm -mno-aes -mno-avx -mno-pclmul -mno-popcnt
-msoft-float
rm -f .depend
mv -f .newdep .depend
1 error
*** Error code 2
1 error
*** Error code 2
1 error
#

#2 Updated by y0n3t4n1 over 2 years ago

On Tue, Jan 17, 2012 at 01:19:31PM -0800, Thomas Nikolajsen via Redmine wrote:
>
> Issue #2279 has been reported by Thomas Nikolajsen.
>
> ----------------------------------------
> Bug #2279: make -j 3 buildkernel fails on UP
> http://bugs.dragonflybsd.org/issues/2279
>
> Author: Thomas Nikolajsen
> Status: New
> Priority: Normal
> Assignee:
> Category:
> Target version:
>
>
> Using fresh master (January 17th 2012)
> make -j 3 buildkernel
> fails on UP system.
>
> (quickkernel succeds here)
>
> Make -j 10 buildkernel
> succeeds on 8 core system.
>
> -
> ===> dev/disk/aic7xxx/ahc/ahc_pci
> ( cd ... ; make aic7xxx_reg.h )
> make: don't know how to make aic7xxx_reg.h. Stop

In the failure case, the above command invokes the make command
inside ${.OBJDIR}, which contains no Makefile. ${.CURDIR} should
always point to the current directory in the source tree.
I think this should work:

diff --git a/sys/dev/disk/aic7xxx/ahc/ahc_pci/Makefile b/sys/dev/disk/aic7xxx/ahc/ahc_pci/Makefile
index 1973ce1..7b1f3f2 100644
--- a/sys/dev/disk/aic7xxx/ahc/ahc_pci/Makefile
+++ b/sys/dev/disk/aic7xxx/ahc/ahc_pci/Makefile
@@ -6,7 +6,7 @@
KMOD= ahc_pci

../aic7xxx_reg.h:
- ( cd .. ; ${MAKE} aic7xxx_reg.h )
+ ${MAKE} -C ${.CURDIR}/.. aic7xxx_reg.h

SRCS= ahc_pci.c aic7xxx_pci.c ../aic7xxx_reg.h
SRCS+= device_if.h bus_if.h pci_if.h

> --
> You have received this notification because you have either subscribed to it, or are involved in it.
> To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account

#3 Updated by y0n3t4n1 over 2 years ago

Hmm, my previous post doesn't explain why it won't break without -JN.
I can reproduce it easier:

$ cd /sys/dev/disk/aic7xxx
$ make cleandir; make cleandir # make sure to clean up ${.OBJDIR}
$ make obj
$ make -j2 depend

Without -j, aic7xxx_reg.h is built before recursing into ahc_pci from ahc
directory; with -j flag however, building ahc_pci can preceed it, and when
that happens, the build rule for `../aic7xxx_reg.h' in ahc_pci/Makefile is
applied.
Looking at <bsd.subdir.mk>, each ${SUBDIR} target produces a pseudo
target named _SUBDIR_${__target}_${SUBDIR}, and in this case __target=depend,
so adding the following line in /sys/dev/disk/aic7xxx/ahc/Makefile

_SUBDIR_depend_ahc_pci: ${BEFORE_DEPEND}

should resolve this ordering issue. I don't know where this dependency
should go, though. The patch in my previous post does solve the error
for me, but I guess that it can still try to create the aic7xxx_reg.h
file from multiple processes.

On Wed, Jan 18, 2012 at 08:31:29AM -0800, YONETANI Tomokazu via Redmine wrote:
>
> Issue #2279 has been updated by YONETANI Tomokazu.
>
>
> On Tue, Jan 17, 2012 at 01:19:31PM -0800, Thomas Nikolajsen via Redmine wrote:
> >
> > Issue #2279 has been reported by Thomas Nikolajsen.
> >
> > ----------------------------------------
> > Bug #2279: make -j 3 buildkernel fails on UP
> > http://bugs.dragonflybsd.org/issues/2279
> >
> > Author: Thomas Nikolajsen
> > Status: New
> > Priority: Normal
> > Assignee:
> > Category:
> > Target version:
> >
> >
> > Using fresh master (January 17th 2012)
> > make -j 3 buildkernel
> > fails on UP system.
> >
> > (quickkernel succeds here)
> >
> > Make -j 10 buildkernel
> > succeeds on 8 core system.
> >
> > -
> > ===> dev/disk/aic7xxx/ahc/ahc_pci
> > ( cd ... ; make aic7xxx_reg.h )
> > make: don't know how to make aic7xxx_reg.h. Stop
>
> In the failure case, the above command invokes the make command
> inside ${.OBJDIR}, which contains no Makefile. ${.CURDIR} should
> always point to the current directory in the source tree.
> I think this should work:
>
> diff --git a/sys/dev/disk/aic7xxx/ahc/ahc_pci/Makefile b/sys/dev/disk/aic7xxx/ahc/ahc_pci/Makefile
> index 1973ce1..7b1f3f2 100644
> --- a/sys/dev/disk/aic7xxx/ahc/ahc_pci/Makefile
> +++ b/sys/dev/disk/aic7xxx/ahc/ahc_pci/Makefile
> @@ -6,7 +6,7 @@
> KMOD= ahc_pci
>
> ../aic7xxx_reg.h:
> - ( cd .. ; ${MAKE} aic7xxx_reg.h )
> + ${MAKE} -C ${.CURDIR}/.. aic7xxx_reg.h
>
> SRCS= ahc_pci.c aic7xxx_pci.c ../aic7xxx_reg.h
> SRCS+= device_if.h bus_if.h pci_if.h
>
> > --
> > You have received this notification because you have either subscribed to it, or are involved in it.
> > To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
> ----------------------------------------
> Bug #2279: make -j 3 buildkernel fails on UP
> http://bugs.dragonflybsd.org/issues/2279
>
> Author: Thomas Nikolajsen
> Status: New
> Priority: Normal
> Assignee:
> Category:
> Target version:
>
>
> Using fresh master (January 17th 2012)
> make -j 3 buildkernel
> fails on UP system.
>
> (quickkernel succeds here)
>
> Make -j 10 buildkernel
> succeeds on 8 core system.
>
> -
> ===> dev/disk/aic7xxx/ahc/ahc_pci
> ( cd ... ; make aic7xxx_reg.h )
> make: don't know how to make aic7xxx_reg.h. Stop
>
>
> --
> You have received this notification because you have either subscribed to it, or are involved in it.
> To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account

#4 Updated by justin about 2 years ago

Could this be related to commit d2e9c9d8664f753a0d599eceed1dd98ffa7ef479 ?

http://leaf.dragonflybsd.org/mailarchive/users/2011-11/msg00109.html for example.

#5 Updated by justin about 2 years ago

  • Status changed from New to Closed

Fixed in f1c957b2612529a64e35c5d2500dc7a9555c844a

#6 Updated by thomas.nikolajsen about 2 years ago

YONETANI,

Thank you for your insight on this issue,
I have committed your first patch, which is correct and fixes problem I have seen.

Also thanks for your further notes on why the problem occurs,
this was indeed my immediate question when I read your first note :)
Please feel free to commit further changes if you think we need it.

#7 Updated by y0n3t4n1 about 2 years ago

(Sorry for the late reply)
> Could this be related to commit d2e9c9d8664f753a0d599eceed1dd98ffa7ef479 ?

I don't know, but apparently buildkernel hasn't passed the -j flag
until recently? I usually build the kernel using old style, i.e.
$ cd /sys/config
$ s=`git rev-parse --short HEAD`
$ config -rd /usr/obj/KERNEL.$s MYCFG
$ cd /usr/obj/KERNEL.$s
$ make -s depend && make -sj4

so I always had to avoid -j on `make depend', like above.

#8 Updated by y0n3t4n1 about 2 years ago

(Sorry for late reply)

Hi, thanks for the commit!

On Sun, Jan 22, 2012 at 12:59:31AM -0800, Thomas Nikolajsen via Redmine wrote:
> Please feel free to commit further changes if you think we need it.

No, I haven't figured out how best to add the dependency yet.

Also available in: Atom PDF