From owner-freebsd-current@FreeBSD.ORG Wed Oct 10 21:31:28 2007 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4229616A417; Wed, 10 Oct 2007 21:31:28 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from speedfactory.net (mail6.speedfactory.net [66.23.216.219]) by mx1.freebsd.org (Postfix) with ESMTP id A073113C469; Wed, 10 Oct 2007 21:31:27 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (unverified [66.23.211.162]) by speedfactory.net (SurgeMail 3.8p) with ESMTP id 213856265-1834499 for multiple; Wed, 10 Oct 2007 17:29:28 -0400 Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.8/8.13.8) with ESMTP id l9ALVLAe017700; Wed, 10 Oct 2007 17:31:22 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-current@freebsd.org Date: Wed, 10 Oct 2007 16:46:49 -0400 User-Agent: KMail/1.9.6 References: <20070921202523.GB4044@nowhere> <20071002204850.GA33227@nowhere> In-Reply-To: <20071002204850.GA33227@nowhere> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200710101646.50012.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]); Wed, 10 Oct 2007 17:31:22 -0400 (EDT) X-Virus-Scanned: ClamAV 0.88.3/4523/Wed Oct 10 14:30:26 2007 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: danfe@freebsd.org, current@freebsd.org, Craig Boston Subject: Re: Patch for nvidia-driver on current (panic: spin locks can only use msleep_spin) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2007 21:31:28 -0000 On Tuesday 02 October 2007 04:48:57 pm Craig Boston wrote: > Hi all, I did some more investigating and found what was causing the > nvidia driver to occasionally panic on my machine. It calls cv_wait(9) > using a spin mutex, which according to the man page is a no-no. > > I simply changed the os_*_sema interfaces to use a standard mutex > instead. Tried running a bunch of glxgears and xscreensaver GL demos in > parallel and haven't been able to reproduce a panic since. As a bonus, > the 5 second pause I would sometimes get when a GL-based xscreensaver > process terminates seems to be gone as well. > > There doesn't appear to be any documentation that I could find as to > what contexts those functions may be called from. I'm not a locking > guru, so I can't say for certain why a spin mutex was being used. Wild > guess: an artifact from the 4.x or 5.x code that may be obsoleted by > adaptive mutexes. > > Patch is attached; cc danfe@ in case others report this problem to him. Your patch is good, and I think nvidia is going to fix their driver to use a regular mutex as well. It probably uses a spin mutex because on other OS's you have to use a spin mutex to protect data shared with an interrupt handler. However, in the case of FreeBSD, you only use a spin mutex if you use an INTR_FAST/filter handler, and can use a regular mutex otherwise. -- John Baldwin