From owner-freebsd-stable@FreeBSD.ORG Fri May 23 12:37:39 2014 Return-Path: Delivered-To: stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 03A02F6D; Fri, 23 May 2014 12:37:39 +0000 (UTC) Received: from mail-oa0-x22f.google.com (mail-oa0-x22f.google.com [IPv6:2607:f8b0:4003:c02::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A8F08280E; Fri, 23 May 2014 12:37:38 +0000 (UTC) Received: by mail-oa0-f47.google.com with SMTP id i7so5553929oag.6 for ; Fri, 23 May 2014 05:37:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=jH5ghLF5WY4PN4zP7FcBHATJJN0ZjDDzGWtCeB6bo0M=; b=GqV/dL3lJoZFbvGmFeNGZHRMneyl0hOweo+bz7CiVqzdAzEfa2dSp0UTmufa4zQ2dF 0bm8QRXebc4dFk4EZu8B4Kt14dpRiPaLiF8DC+8mKs/j1euNsWQReXLFHkbYh6NxN+NX B3QxAwXYulcB+87f/9wkCAGtTSkVaI0e+pco11d0maeWsTRkNDCAo4gMTenZhtetNf9y 6ng+uGtQY8+7ZWLHcrkfZck6wqIHMI0xpVVV5PnHZAGaEJ0Go0HhBAwvUxwH5GDRravJ ECjONfRHVMnFnZ1/PSP656AOT8i1dlwGSWtmnr6OoxGYDmZcmivPWZsmKknYB3iKgUPj gMug== MIME-Version: 1.0 X-Received: by 10.60.74.163 with SMTP id u3mr4769275oev.2.1400848658021; Fri, 23 May 2014 05:37:38 -0700 (PDT) Received: by 10.76.170.39 with HTTP; Fri, 23 May 2014 05:37:37 -0700 (PDT) In-Reply-To: <1400848012.1152.311.camel@revolution.hippie.lan> References: <20140523065653.GA86035@onelab2.iet.unipi.it> <1400848012.1152.311.camel@revolution.hippie.lan> Date: Fri, 23 May 2014 14:37:37 +0200 Message-ID: Subject: Re: build order race after SUBDIR_PARALLEL (264303) From: Andreas Nilsson To: Ian Lepore Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18 Cc: Dimitry Andric , stable@freebsd.org, Luigi Rizzo X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 May 2014 12:37:39 -0000 On Fri, May 23, 2014 at 2:26 PM, Ian Lepore wrote: > On Fri, 2014-05-23 at 08:56 +0200, Luigi Rizzo wrote: > > Hi, > > I have recently hit a problem when building stable/10 with > > "make -j 8" which i tracked down to svn 264303, the > > MFC of the SUBDIR_PARALLEL build feature. > > > > With a large number of parallel tasks (and GCC; > > it is a race condition so timing matters), the build fails > > during the toolchain target with this: > > > > --- sig_party.o --- > > cc -O2 -pipe > -I/usr/home/luigi/FreeBSD/R10/lib/libngatm/../../sys/contrib/ngatm > -I/usr/home/luigi/FreeBSD/R10/../usr/obj-pico-amd64/usr/home/luigi/FreeBSD/R10/lib/libngatm > > -I/usr/home/luigi/FreeBSD/R10/lib/libngatm/../../contrib/ngatm/libngatm > -std=gnu99 -fstack-protector -Wsystem-headers -Werror -Wall > -Wno-format-y2k -W -Wno-unused-parameter - > > Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type > -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter > -Wcast-align -Wchar-subscripts -Winline > > -Wnested-externs -Wredundant-decls -Wold-style-definition > -Wno-pointer-sign -c > /usr/home/luigi/FreeBSD/R10/lib/libngatm/../../sys/contrib/ngatm/netnatm/sig/sig_party.c > -o sig_ > > party.o > > --- all_subdir_libproc --- > > > /usr/home/luigi/FreeBSD/R10/../usr/obj-pico-amd64/usr/home/luigi/FreeBSD/R10/tmp/usr/bin/ld: > cannot find -lsupc++ > > *** [libproc.so.2] Error code 1 > > > > make[5]: stopped in /usr/home/luigi/FreeBSD/R10/lib/libproc > > 1 error > > ... > > > > > > Turns out that before SUBDIR_PARALLEL, libsupc++ was built > > before libproc thus satisfying the dependency; but with > > -j XXX we cannot guarantee the ordering and there is no > > explicit constraint or .ORDER in the makefiles to build > > things in the correct order. > > > > This is a race condition so you may or may not see the problem > > depending on what you are building and where. > > > > I am seeing the problem consistently on stable/10 after 264303 > > when building toolchain with GCC (not clang) on an 8-core machine > > and make -j 8 > > > > Building the above with -j 4 seem to work fine, > > as it works building HEAD with -j 8 > > > > cheers > > luigi > > Aha. I asked for exactly this info on the commit list (so you can > ignore that request). Warner & I kicked around some ideas on how to > solve this a while back, I'll see if I can make some progress towards > better dependency controls for SUBDIR_PARALLEL this weekend. > > -- Ian > > > Sorry for a perhaps a cheeky question, but is this not all due to not telling make the dependencies, and/or due to "recursive" make? When is decided to learn make (although that was mainly gnu make ) I found the following http://aegis.sourceforge.net/auug97.pdf very enlightening. I do realise that such a redesign is a tremendous effort. Best regards Andreas