From owner-svn-src-all@FreeBSD.ORG Mon Mar 19 00:55:44 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 38C111065670; Mon, 19 Mar 2012 00:55:44 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) by mx1.freebsd.org (Postfix) with ESMTP id 04E438FC12; Mon, 19 Mar 2012 00:55:43 +0000 (UTC) Received: from julian-mac.elischer.org (c-67-180-24-15.hsd1.ca.comcast.net [67.180.24.15]) (authenticated bits=0) by vps1.elischer.org (8.14.5/8.14.5) with ESMTP id q2J0td00009279 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 18 Mar 2012 17:55:42 -0700 (PDT) (envelope-from julian@freebsd.org) Message-ID: <4F668422.1000308@freebsd.org> Date: Sun, 18 Mar 2012 17:56:02 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.2.28) Gecko/20120306 Thunderbird/3.1.20 MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <201202271338.q1RDcqEQ020033@svn.freebsd.org> <20120318185014.GK1340@garage.freebsd.pl> In-Reply-To: <20120318185014.GK1340@garage.freebsd.pl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, David Xu Subject: Re: svn commit: r232209 - in head: lib/libthr/thread sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 00:55:44 -0000 On 3/18/12 11:50 AM, Pawel Jakub Dawidek wrote: > On Mon, Feb 27, 2012 at 01:38:52PM +0000, David Xu wrote: >> Author: davidxu >> Date: Mon Feb 27 13:38:52 2012 >> New Revision: 232209 >> URL: http://svn.freebsd.org/changeset/base/232209 >> >> Log: >> Follow changes made in revision 232144, pass absolute timeout to kernel, >> this eliminates a clock_gettime() syscall. > This or some other change has broken CLOCK_MONOTONIC usage with > condition variables. > > You should be able to reproduce this by something like this: > > pthread_cond_t cv; > pthread_condattr_t attr; > pthread_mutex_t lock; > struct timespec ts; > int error; > > (void)pthread_mutex_init(&lock, NULL); > > (void)pthread_condattr_init(&attr); > (void)pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); > > (void)pthread_cond_init(&cv,&attr); > (void)pthread_condattr_destroy(&attr); > > (void)clock_gettime(CLOCK_MONOTONIC,&ts); > ts.tv_sec += 10; > (void)pthread_mutex_lock(&lock); > (void)pthread_cond_timedwait(&cv,&lock,&ts); > (void)pthread_mutex_unlock(&lock); > > This should timeout after 10 seconds, but pthread_cond_timedwait(3) > returns immediately with ETIMEDOUT. CLOCK_REALTIME works properly. > Bascially pthread_condattr_setclock(&attr, CLOCK_MONOTONIC) is no-op. > If you change CLOCK_MONOTONIC to CLOCK_REALTIME in clock_gettime(2) > call, it will timeout after 10 seconds. this has been broken for a while for me in fact fixing this was, I thought, one of the reasons for this work.. glad I'm not the omnly person seeing it though. for me it broke sysutils/fio from ports