From owner-freebsd-arch@FreeBSD.ORG Thu Dec 8 14:57:13 2005 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 973EB16A41F for ; Thu, 8 Dec 2005 14:57:13 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from speedfactory.net (mail6.speedfactory.net [66.23.216.219]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4855643D68 for ; Thu, 8 Dec 2005 14:57:01 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (unverified [66.23.211.162]) by speedfactory.net (SurgeMail 3.5b3) with ESMTP id 3386563 for multiple; Thu, 08 Dec 2005 09:58:56 -0500 Received: from zion.baldwin.cx (zion.baldwin.cx [192.168.0.7]) (authenticated bits=0) by server.baldwin.cx (8.13.1/8.13.1) with ESMTP id jB8EugW1071318; Thu, 8 Dec 2005 09:56:48 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Craig Rodrigues Date: Thu, 8 Dec 2005 09:56:35 -0500 User-Agent: KMail/1.8.3 References: <20051207224359.GA4320@crodrigues.org> In-Reply-To: <20051207224359.GA4320@crodrigues.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200512080956.36425.jhb@freebsd.org> X-Spam-Status: No, score=-2.8 required=4.2 tests=ALL_TRUSTED autolearn=failed version=3.0.2 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on server.baldwin.cx X-Server: High Performance Mail Server - http://surgemail.com r=1653887525 Cc: freebsd-arch@freebsd.org Subject: Re: [RFC] Implement cv_wait_nolock(), for emulation of SGI's sv_wait() X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2005 14:57:13 -0000 On Wednesday 07 December 2005 05:43 pm, Craig Rodrigues wrote: > Hi, > > As part of the XFS for FreeBSD project, Alexander Kabaev > implemented a cv_wait_nolock() function for compatibility > with SGI's sv_wait() call: > http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=3D0650&db=3Dm= an&fna >me=3D/usr/share/catman/p_man/catD/SV_WAIT.z > > sv_wait() waits on a synchronization variable, the lock must be held > before the call is entered, but the lock is not held when sv_wait() is > exited. > > Is this patch OK to go into FreeBSD? > Comments? As I said on IRC, I'm not a big fan of this or PDROP, but PDROP is in the=20 tree. Note that you could implement sv_wait() using the existing primitive= s=20 via: sv_wait() { cv_wait() mtx_unlock() } If you do stick with cv_wait_nolock(), _please_ don't duplicate a whole bun= ch=20 of code by implement cv_wait() like so: cv_wait() { cv_wait_nolock() mtx_lock() } Note that currently you have a bug in the cold || panicstr case in that the= =20 function doesn't drop the lock. =2D-=20 John Baldwin =A0<>< =A0http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" =A0=3D =A0http://www.FreeBSD.org