Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Dec 2005 09:56:35 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        Craig Rodrigues <rodrigc@crodrigues.org>
Cc:        freebsd-arch@freebsd.org
Subject:   Re: [RFC] Implement cv_wait_nolock(), for emulation of SGI's sv_wait()
Message-ID:  <200512080956.36425.jhb@freebsd.org>
In-Reply-To: <20051207224359.GA4320@crodrigues.org>
References:  <20051207224359.GA4320@crodrigues.org>

next in thread | previous in thread | raw e-mail | index | archive | help

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=0650&db=man&fna
>me=/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 
tree.  Note that you could implement sv_wait() using the existing primitives 
via:

sv_wait()
{
	cv_wait()
	mtx_unlock()
}

If you do stick with cv_wait_nolock(), _please_ don't duplicate a whole bunch 
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 
function doesn't drop the lock.

-- 
John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200512080956.36425.jhb>