From owner-freebsd-current@FreeBSD.ORG Thu Jul 8 21:52:22 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E90A106566B; Thu, 8 Jul 2010 21:52:22 +0000 (UTC) (envelope-from r.c.ladan@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 7B80C8FC0A; Thu, 8 Jul 2010 21:52:21 +0000 (UTC) Received: by eyh6 with SMTP id 6so208716eyh.13 for ; Thu, 08 Jul 2010 14:52:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :organization:user-agent:mime-version:to:cc:subject:references :in-reply-to:x-enigmail-version:content-type; bh=ZqfhhbvfrbX8Rk9/Vb5UKKCy0uSFDseygxCDjpydlDQ=; b=C4rQ86LCXdZG9sKDmr2RfmgpHFlNgxqSMru6cORMQDreCUG9EGmifc7CJ7ZISi+LRw zsmT7ZNgByYwVB5D5vyv+1sGCQQSaqi9KjVVNQMbvM6jL6JjLO9fuKmfaOHFkJ/KJ1+F WPihcA8Tx1YWwYlNnT98QT6REzTMDRW+4dUTI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:organization:user-agent:mime-version:to :cc:subject:references:in-reply-to:x-enigmail-version:content-type; b=SWeqOVFnjB8IXfKGjVEyb5UdkJ1tuM1+r1MCg7L4TGr+MN+JRkvOXB5VbmBo3gqLAu +14fuQuUB50t1NcIKYm4q16m1zgNlXbLrbeuH0EqTcCl0Nl/V0yi2rclp9nelhpwu/lI ggcHUZdMnwRMk/T4yD7FHoCXMeuaC9VCQOa9s= Received: by 10.213.97.196 with SMTP id m4mr7304044ebn.80.1278625934724; Thu, 08 Jul 2010 14:52:14 -0700 (PDT) Received: from [192.168.1.70] (ip4da3ae31.direct-adsl.nl [77.163.174.49]) by mx.google.com with ESMTPS id x54sm1174609eeh.17.2010.07.08.14.52.11 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 08 Jul 2010 14:52:12 -0700 (PDT) Sender: =?UTF-8?Q?Ren=C3=A9_Ladan?= Message-ID: <4C36488A.6030203@freebsd.org> Date: Thu, 08 Jul 2010 23:52:10 +0200 From: Rene Ladan Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; nl-NL; rv:1.9.1.10) Gecko/20100627 Thunderbird/3.0.5 MIME-Version: 1.0 To: Doug Barton References: <201007021146.46542.naylor.b.david@gmail.com> <201007021855.42103.naylor.b.david@gmail.com> <201007080826.32764.jhb@freebsd.org> In-Reply-To: X-Enigmail-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030504040103000101080404" Cc: Yuri Pankov , freebsd-current@freebsd.org, David Naylor Subject: Re: nvidia-driver crashing kernel on head 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: Thu, 08 Jul 2010 21:52:22 -0000 This is a multi-part message in MIME format. --------------030504040103000101080404 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 08-07-2010 22:09, Doug Barton wrote: > On Thu, 8 Jul 2010, John Baldwin wrote: > >> These freezes and panics are due to the driver using a spin mutex >> instead of a >> regular mutex for the per-file descriptor event_mtx. If you patch the >> driver >> to change it to be a regular mutex I think that should fix the problems. > > Can you give an example? :) I don't mind creating a patch for all of > them if you can illustrate what needs to be changed. > See the attached patch -- http://www.rene-ladan.nl/ GPG fingerprint = ADBC ECCD EB5F A6B4 549F 600D 8C9E 647A E564 2BFC (subkeys.pgp.net) --------------030504040103000101080404 Content-Type: text/plain; name="patch-mutex-jhb" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch-mutex-jhb" --- src/nvidia_ctl.c.orig 2010-06-17 03:28:57.000000000 +0200 +++ src/nvidia_ctl.c 2010-07-08 15:30:10.000000000 +0200 @@ -53,7 +53,7 @@ } filep->nv = nv; - mtx_init(&filep->event_mtx, "event_mtx", NULL, (MTX_SPIN | MTX_RECURSE)); + mtx_init(&filep->event_mtx, "event_mtx", NULL, (MTX_DEF | MTX_RECURSE)); STAILQ_INIT(&filep->event_queue); nv_lock_api(nv); @@ -123,7 +123,7 @@ if (status != 0) return status; - mtx_lock_spin(&filep->event_mtx); + mtx_lock(&filep->event_mtx); et = STAILQ_FIRST(&filep->event_queue); if (et == NULL) @@ -131,7 +131,7 @@ else mask = (events & (POLLIN | POLLPRI | POLLRDNORM)); - mtx_unlock_spin(&filep->event_mtx); + mtx_unlock(&filep->event_mtx); return mask; } --- src/nvidia_dev.c.orig 2010-06-17 03:28:57.000000000 +0200 +++ src/nvidia_dev.c 2010-07-08 15:29:54.000000000 +0200 @@ -52,7 +52,7 @@ } filep->nv = nv; - mtx_init(&filep->event_mtx, "event_mtx", NULL, (MTX_SPIN | MTX_RECURSE)); + mtx_init(&filep->event_mtx, "event_mtx", NULL, (MTX_DEF | MTX_RECURSE)); STAILQ_INIT(&filep->event_queue); nv_lock_api(nv); @@ -123,7 +123,7 @@ if (status != 0) return status; - mtx_lock_spin(&filep->event_mtx); + mtx_lock(&filep->event_mtx); et = STAILQ_FIRST(&filep->event_queue); if (et == NULL) @@ -131,7 +131,7 @@ else mask = (events & (POLLIN | POLLPRI | POLLRDNORM)); - mtx_unlock_spin(&filep->event_mtx); + mtx_unlock(&filep->event_mtx); return mask; } --------------030504040103000101080404--