From owner-freebsd-arch@FreeBSD.ORG Fri Oct 31 23:35:08 2014 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 96593820; Fri, 31 Oct 2014 23:35:08 +0000 (UTC) Received: from mail-wi0-x22b.google.com (mail-wi0-x22b.google.com [IPv6:2a00:1450:400c:c05::22b]) (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 0866B5F1; Fri, 31 Oct 2014 23:35:07 +0000 (UTC) Received: by mail-wi0-f171.google.com with SMTP id q5so2536856wiv.4 for ; Fri, 31 Oct 2014 16:35:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=3QiSI2ci/GVxQj4qve93FYPyQGi8c4kwaw04rrnf0tw=; b=CSdefo+85GlExOt+/G1I0Fp6ZyIGaSmNxektAv6VZvVzwWudXVHmM+DawlI5stwOaV HX5UjgSIB1zQzRQNmyRRXd+iRTfsd8PPi7upAyuDguVNLDDY6rnetBuf9P5lVCzot1JZ JPqvGehdI+MI+f9/JnJNeU5YnBpiO85/tbAxY0Vtu9M3OWCVcPRgYJYwjwHASadwRB/Q Jx5ivRl4PE+SZMAdizrXabOspbRC45XrGT9y49MNI2+d8RlCXpnV9XUXKjeGxt6anncg xsl092peSIIq/BnhcriZRqVbf/ep4qqR6Ie1jJ2rG9ZUHw8D9COwbjcyxoydn8XvJzVO vVzw== X-Received: by 10.194.62.226 with SMTP id b2mr26950561wjs.46.1414798505978; Fri, 31 Oct 2014 16:35:05 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id da3sm13654686wjb.12.2014.10.31.16.35.04 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 31 Oct 2014 16:35:05 -0700 (PDT) Date: Sat, 1 Nov 2014 00:35:02 +0100 From: Mateusz Guzik To: John Baldwin Subject: Re: refcount_release_take_##lock Message-ID: <20141031233502.GB20591@dft-labs.eu> References: <20141025184448.GA19066@dft-labs.eu> <201410281154.54581.jhb@freebsd.org> <20141028174428.GA12014@dft-labs.eu> <201410281413.58414.jhb@freebsd.org> <20141028193404.GB12014@dft-labs.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20141028193404.GB12014@dft-labs.eu> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: John-Mark Gurney , freebsd-arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 23:35:08 -0000 On Tue, Oct 28, 2014 at 08:34:04PM +0100, Mateusz Guzik wrote: > On Tue, Oct 28, 2014 at 02:13:58PM -0400, John Baldwin wrote: > > On Tuesday, October 28, 2014 1:44:28 pm Mateusz Guzik wrote: > > > diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c > > > index f8ae0e6..e94ccde 100644 > > > --- a/sys/kern/kern_jail.c > > > +++ b/sys/kern/kern_jail.c > > > > The diff looks good to me. Just need to update refcount.9 as well. > > > Ping? Is this diff ok? > diff --git a/share/man/man9/refcount.9 b/share/man/man9/refcount.9 > index e7702a2..61b9b51 100644 > --- a/share/man/man9/refcount.9 > +++ b/share/man/man9/refcount.9 > @@ -26,7 +26,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd January 20, 2009 > +.Dd October 28, 2014 > .Dt REFCOUNT 9 > .Os > .Sh NAME > @@ -44,6 +44,15 @@ > .Fn refcount_acquire "volatile u_int *count" > .Ft int > .Fn refcount_release "volatile u_int *count" > +.In sys/mutex.h > +.Fn refcount_release_lock_mtx "volatile u_int *count, struct mtx *lock" > +.In sys/rmlock.h > +.Fn refcount_release_lock_rmlock "volatile u_int *count, struct rmlock *lock" > +.In sys/rwlock.h > +.Fn refcount_release_lock_rwlock "volatile u_int *count, struct rwlock *lock" > +.In sys/lock.h > +.In sys/sx.h > +.Fn refcount_release_lock_sx "volatile u_int *count, struct sx *lock" > .Sh DESCRIPTION > The > .Nm > @@ -77,6 +86,13 @@ The function returns a non-zero value if the reference being released was > the last reference; > otherwise, it returns zero. > .Pp > +.Fn refcount_release_lock_* > +functions release an existing reference holding the lock if it is the last > +reference. > +These functions return with the lock held and a non-zero value if the reference > +being released was the last reference; > +otherwise, they returns zero and the lock is not held. > +.Pp > Note that these routines do not provide any inter-CPU synchronization, > data protection, > or memory ordering guarantees except for managing the counter. > @@ -91,6 +107,18 @@ The > .Nm refcount_release > function returns non-zero when releasing the last reference and zero when > releasing any other reference. > +.Pp > +.Nm refcount_release_lock_* > +functions return with the lock held and non-zero value when releasing the last > +reference, zero without the lock held when releasing any other reference. > .Sh HISTORY > -These functions were introduced in > +.Fn refcount_init , > +.Fn refcount_acquire > +and > +.Fn refcount_release > +functions were introduced in > .Fx 6.0 . > +.Pp > +.Fn refcount_release_lock_* > +functions were introduced in > +.Fx 10.2 . > > -- > Mateusz Guzik -- Mateusz Guzik