nvidia-driver crashing kernel on head

Rene Ladan rene at freebsd.org
Thu Jul 8 21:52:22 UTC 2010


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)
-------------- next part --------------
--- 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;
 }


More information about the freebsd-current mailing list