Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 08 Jul 2010 23:52:10 +0200
From:      Rene Ladan <rene@freebsd.org>
To:        Doug Barton <dougb@FreeBSD.org>
Cc:        Yuri Pankov <yuri.pankov@gmail.com>, freebsd-current@freebsd.org, David Naylor <naylor.b.david@gmail.com>
Subject:   Re: nvidia-driver crashing kernel on head
Message-ID:  <4C36488A.6030203@freebsd.org>
In-Reply-To: <alpine.BSF.2.00.1007081304590.5061@yncgbc.qbhto.arg>
References:  <201007021146.46542.naylor.b.david@gmail.com> <AANLkTimT4UwDzB6jF2eML4U7jQubOs1slwBPHwy_5U3b@mail.gmail.com> <201007021855.42103.naylor.b.david@gmail.com> <201007080826.32764.jhb@freebsd.org> <alpine.BSF.2.00.1007081304590.5061@yncgbc.qbhto.arg>

next in thread | previous in thread | raw e-mail | index | archive | help
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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C36488A.6030203>