From owner-p4-projects@FreeBSD.ORG Mon Jun 26 22:29:55 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 2329416A52A; Mon, 26 Jun 2006 22:29:55 +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 C4D7E16A51D; Mon, 26 Jun 2006 22:29:54 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6E8A3446CF; Mon, 26 Jun 2006 22:05:19 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.4/8.13.4) with ESMTP id k5QM5FvJ086648; Mon, 26 Jun 2006 18:05:18 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: Kip Macy Date: Mon, 26 Jun 2006 17:59:22 -0400 User-Agent: KMail/1.9.1 References: <200606262051.k5QKp8b3022216@repoman.freebsd.org> In-Reply-To: <200606262051.k5QKp8b3022216@repoman.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200606261759.23136.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Mon, 26 Jun 2006 18:05:18 -0400 (EDT) X-Virus-Scanned: ClamAV 0.87.1/1564/Mon Jun 26 10:55:16 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on server.baldwin.cx Cc: Perforce Change Reviews Subject: Re: PERFORCE change 100088 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: Mon, 26 Jun 2006 22:29:55 -0000 On Monday 26 June 2006 16:51, Kip Macy wrote: > http://perforce.freebsd.org/chv.cgi?CH=100088 > > Change 100088 by kmacy@kmacy_storage:sun4v_work_sleepq on 2006/06/26 20:50:54 > > allow turnstiles to handle sleeping for us I thought this wasn't safe as some places wanted to sleep while holding the filedesc lock. Maybe in select? > Affected files ... > > .. //depot/projects/kmacy_sun4v/src/sys/sys/filedesc.h#5 edit > > Differences ... > > ==== //depot/projects/kmacy_sun4v/src/sys/sys/filedesc.h#5 (text+ko) ==== > > @@ -96,60 +96,11 @@ > #ifdef _KERNEL > > /* Lock a file descriptor table. */ > -#define FILEDESC_LOCK(fd) \ > - do { \ > - mtx_lock(&(fd)->fd_mtx); \ > - (fd)->fd_wanted++; \ > - while ((fd)->fd_locked) \ > - msleep(&(fd)->fd_locked, &(fd)->fd_mtx, PLOCK, "fdesc", 0); \ > - (fd)->fd_locked = 2; \ > - (fd)->fd_wanted--; \ > - mtx_unlock(&(fd)->fd_mtx); \ > - } while (0) > - > -#define FILEDESC_UNLOCK(fd) \ > - do { \ > - mtx_lock(&(fd)->fd_mtx); \ > - KASSERT((fd)->fd_locked == 2, \ > - ("fdesc locking mistake %d should be %d", (fd)->fd_locked, 2)); \ > - (fd)->fd_locked = 0; \ > - if ((fd)->fd_wanted) \ > - wakeup_one(&(fd)->fd_locked); \ > - mtx_unlock(&(fd)->fd_mtx); \ > - } while (0) > - > -#define FILEDESC_LOCK_FAST(fd) \ > - do { \ > - mtx_lock(&(fd)->fd_mtx); \ > - (fd)->fd_wanted++; \ > - while ((fd)->fd_locked) \ > - msleep(&(fd)->fd_locked, &(fd)->fd_mtx, PLOCK, "fdesc", 0); \ > - (fd)->fd_locked = 1; \ > - (fd)->fd_wanted--; \ > - } while (0) > - > -#define FILEDESC_UNLOCK_FAST(fd) \ > - do { \ > - KASSERT((fd)->fd_locked == 1, \ > - ("fdesc locking mistake %d should be %d", (fd)->fd_locked, 1)); \ > - (fd)->fd_locked = 0; \ > - if ((fd)->fd_wanted) \ > - wakeup_one(&(fd)->fd_locked); \ > - mtx_unlock(&(fd)->fd_mtx); \ > - } while (0) > - > -#ifdef INVARIANT_SUPPORT > -#define FILEDESC_LOCK_ASSERT(fd, arg) \ > - do { \ > - if ((arg) == MA_OWNED) \ > - KASSERT((fd)->fd_locked != 0, ("fdesc locking mistake")); \ > - else \ > - KASSERT((fd)->fd_locked == 0, ("fdesc locking mistake")); \ > - } while (0) > -#else > -#define FILEDESC_LOCK_ASSERT(fd, arg) > -#endif > - > +#define FILEDESC_LOCK(fd) mtx_lock(&(fd)->fd_mtx); > +#define FILEDESC_LOCK_FAST(fd) mtx_lock(&(fd)->fd_mtx); > +#define FILEDESC_UNLOCK(fd) mtx_unlock(&(fd)->fd_mtx); > +#define FILEDESC_UNLOCK_FAST(fd) mtx_unlock(&(fd)->fd_mtx); > +#define FILEDESC_LOCK_ASSERT(fd, arg) mtx_assert(&(fd)->fd_mtx, arg) > #define FILEDESC_LOCK_DESC "filedesc structure" > > struct thread; > -- John Baldwin