From owner-p4-projects@FreeBSD.ORG Fri Aug 11 12:13:22 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id BCE9016A4E5; Fri, 11 Aug 2006 12:13:22 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8CCF016A4DA; Fri, 11 Aug 2006 12:13:22 +0000 (UTC) (envelope-from xdivac02@stud.fit.vutbr.cz) Received: from eva.fit.vutbr.cz (eva.fit.vutbr.cz [147.229.10.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id DEFB143D49; Fri, 11 Aug 2006 12:13:21 +0000 (GMT) (envelope-from xdivac02@stud.fit.vutbr.cz) Received: from eva.fit.vutbr.cz (localhost [127.0.0.1]) by eva.fit.vutbr.cz (envelope-from xdivac02@eva.fit.vutbr.cz) (8.13.7/8.13.7) with ESMTP id k7BCDEcI085369 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Fri, 11 Aug 2006 14:13:15 +0200 (CEST) Received: (from xdivac02@localhost) by eva.fit.vutbr.cz (8.13.7/8.13.3/Submit) id k7BCDEZ8085368; Fri, 11 Aug 2006 14:13:14 +0200 (CEST) Date: Fri, 11 Aug 2006 14:13:14 +0200 From: Divacky Roman To: Robert Watson Message-ID: <20060811121314.GA85207@stud.fit.vutbr.cz> References: <200608111110.k7BBAxIO059339@repoman.freebsd.org> <20060811124027.K45647@fledge.watson.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060811124027.K45647@fledge.watson.org> User-Agent: Mutt/1.4.2i X-Scanned-By: MIMEDefang 2.54 on 147.229.10.14 Cc: Roman Divacky , Perforce Change Reviews Subject: Re: PERFORCE change 103633 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2006 12:13:23 -0000 On Fri, Aug 11, 2006 at 12:42:50PM +0100, Robert Watson wrote: > On Fri, 11 Aug 2006, Roman Divacky wrote: > > >http://perforce.freebsd.org/chv.cgi?CH=103633 > > > >Change 103633 by rdivacky@rdivacky_witten on 2006/08/11 11:10:09 > > > > Giantify futex code - this is necessary because the futex code is > > expected to be atomic. > > I need to assure the atomicity. I am using Giant because its > > sleepable mutex. I hope > > someone will point me to some other better solution. > > Giant is not "sleepable" in the same sense that sx locks, lockmgr locks, > etc, are. Normally "sleepable" means that the lock can be held across a > sleep of potentially unbounded length, such as msleep(), tsleep(), > cv_wait(), etc. Giant is automatically dropped by the kernel on sleep, and > re-acquired one wakeup. This means that Giant does not provide mutual > exclusion across a sleep -- if this is a property you are relying on, then > Giant is not what you want. If you most sleep while holding a lock, I > would recommend an sx lock. However, a preferred solution is not to sleep > holding a lock. yes... sleepable as in "can be held while sleeping no matter how this is acomplished" I think the main problem (which is now fixed) was with this: copyin(addr, val1); if (val1 == val2) .... being non-atomic. On the other hand I tried to use other locks other then Giant and it didnt work. I hope to investigate that later. Now I have this working and my focus is elsewhere.