From owner-freebsd-current@FreeBSD.ORG Mon Oct 3 21:53:55 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20D9F1065670; Mon, 3 Oct 2011 21:53:55 +0000 (UTC) (envelope-from mhenrion@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id B3BA88FC27; Mon, 3 Oct 2011 21:53:54 +0000 (UTC) Received: by qadz30 with SMTP id z30so2593379qad.13 for ; Mon, 03 Oct 2011 14:53:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=dbozJ8o1QeGIQ7zgY5QD5ZGlu55nETTEQwp/sy6K7ZU=; b=WPCDTLMcotso6fHnoVlYiZ3D3ArEkTJ/MMMq6YMIWBd6TXT0hxyR3TjzZJsptgKVAA sd1zP7dQptrj70vEL5GbKNX1recxzvnYCZuss1r5dWrlxa3VHnezStb6hcGkOeCLZwaN jH0yvCY/VR7+EqtXRyz4Ct9RC9RgG0wn6cTjg= MIME-Version: 1.0 Received: by 10.68.7.166 with SMTP id k6mr890432pba.128.1317678833486; Mon, 03 Oct 2011 14:53:53 -0700 (PDT) Sender: mhenrion@gmail.com Received: by 10.142.201.10 with HTTP; Mon, 3 Oct 2011 14:53:53 -0700 (PDT) In-Reply-To: <20111003213024.GA42715@stack.nl> References: <20110908221356.Horde.MFEsZ6Qd9PdOaSIEaid2X_A@avocado.salatschuessel.net> <4E692F87.5010708@sentex.net> <20110909073305.Horde.oi-EGaQd9PdOaaURAsTRVJk@avocado.salatschuessel.net> <4E6A076D.7040309@wintek.com> <20111003213024.GA42715@stack.nl> Date: Mon, 3 Oct 2011 23:53:53 +0200 X-Google-Sender-Auth: _k0_svc1NTs54qlwmiHAaw7qYTE Message-ID: From: Maxime Henrion To: Jilles Tjoelker Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Adrian Chadd , freebsd-current@freebsd.org, Alexander Zagrebin Subject: Re: cvsup broken on amd64? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Oct 2011 21:53:55 -0000 On Mon, Oct 3, 2011 at 11:30 PM, Jilles Tjoelker wrote: > On Mon, Oct 03, 2011 at 06:15:41PM +0200, Maxime Henrion wrote: >> Knowing all that, what's happening seems quite clear. If >> fixups_close() is called while there was still fixup requests pending, >> those should be processed by the detailer thread before it returns. >> Subsequent fixups_get() call should continue returning pending items, >> until there are no more entries in the queue _and_ the queue is >> closed. > >> So, line 144 in fixups.c (in fixups_get()): > >> =A0 =A0 =A0 =A0 if (f->closed) { > >> should actually be: > >> =A0 =A0 =A0 =A0 if (f->closed && f->size =3D=3D 0) { > > That looks sensible. > >> The fact that this could even happen smells a bit weird to me though; >> it means the detailer thread didn't get a chance to run between some >> item was added to the queue (fixups_put() signals the detailer thread >> via pthread_cond_signal()), and that it only runs now that the updater >> queue has been closed. I wouldn't go as far as saying this is a bug, >> but is it even valid for the pthread library to "coalesce" two >> pthread_cond_signal() calls into one when the thread didn't get to run >> since the first call was made? If so, then the above fix is perfectly >> valid. If not, there is a deeper bug in the threading library, or in >> the CVS mode code which I didn't write (but that seems far-fetched). > > The pthread library is free to "coalesce" pthread_cond_signal() calls > like that. This is because a thread awakened by pthread_cond_signal() > (or any other event) is not guaranteed to start running immediately and > pthread_cond_signal() does nothing if there is no thread to wake up. Great, that's a relief. I knew the pthread library was free to wake a thread up even if it hadn't been signaled, which is why one always has to call pthread_cond_wait() inside of a while() loop checking for the condition, but wasn't sure about that particular scenario, so I'm glad to hear a confirmation. Thanks! Cheers, Maxime