Go Back   nV News Forums > Linux Support Forums > NVIDIA FreeBSD

Newegg Daily Deals

Reply
 
Thread Tools
Old 10-02-07, 11:12 PM   #1
johnjen
Registered User
 
Join Date: Jun 2007
Posts: 4
Default Patch for driver on -current

I know -current isn't "officially supported" but once 7.0-CURRENT goes to 7.0-RELEASE, maybe it will . I just noticed a message on the current mailing list from Craig Boston stating that he found and fixed something that was plaguing him. I'm reproducing the message here for those who might be able to use the patch ... just FYI .....

-----------------------------

From: Craig Boston <cb at severious.net>

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.

Craig

------------- patch --------------------

--- src/nvidia_os.c.orig 2007-10-02 15:27:33.211059621 -0500
+++ src/nvidia_os.c 2007-10-02 15:27:43.708791970 -0500
@@ -598,7 +598,7 @@
!= RM_OK))
return status;

- mtx_init(&mtx->mutex_mtx, "rm.mutex_mtx", NULL, MTX_SPIN | MTX_RECURSE);
+ mtx_init(&mtx->mutex_mtx, "rm.mutex_mtx", NULL, MTX_DEF | MTX_RECURSE);
cv_init(&mtx->mutex_wait, "rm.mutex_wait");

mtx->refcnt = 1;
@@ -624,13 +624,13 @@
{
struct os_mutex *mtx = semaphore;

- mtx_lock_spin(&mtx->mutex_mtx);
+ mtx_lock(&mtx->mutex_mtx);
if (mtx->refcnt > 0)
rm_disable_interrupts(NULL);
mtx->refcnt--;
if (mtx->refcnt < 0)
cv_wait(&mtx->mutex_wait, &mtx->mutex_mtx);
- mtx_unlock_spin(&mtx->mutex_mtx);
+ mtx_unlock(&mtx->mutex_mtx);

return RM_OK;
}
@@ -639,14 +639,14 @@
{
struct os_mutex *mtx = semaphore;

- mtx_lock_spin(&mtx->mutex_mtx);
+ mtx_lock(&mtx->mutex_mtx);
if (mtx->refcnt < 1) {
- mtx_unlock_spin(&mtx->mutex_mtx);
+ mtx_unlock(&mtx->mutex_mtx);
return FALSE;
} else {
rm_disable_interrupts(NULL);
mtx->refcnt--;
- mtx_unlock_spin(&mtx->mutex_mtx);
+ mtx_unlock(&mtx->mutex_mtx);
}

return TRUE;
@@ -656,13 +656,13 @@
{
struct os_mutex *mtx = semaphore;

- mtx_lock_spin(&mtx->mutex_mtx);
+ mtx_lock(&mtx->mutex_mtx);
if (mtx->refcnt < 0)
cv_signal(&mtx->mutex_wait);
if (!mtx->refcnt)
rm_enable_interrupts(NULL);
mtx->refcnt++;
- mtx_unlock_spin(&mtx->mutex_mtx);
+ mtx_unlock(&mtx->mutex_mtx);

return RM_OK;
}
johnjen is offline   Reply With Quote
Old 10-03-07, 12:07 AM   #2
zander
NVIDIA Corporation
 
zander's Avatar
 
Join Date: Aug 2002
Posts: 3,740
Default Re: Patch for driver on -current

Thanks, I'll take a closer look.
zander is offline   Reply With Quote
Old 10-10-07, 08:54 PM   #3
zander
NVIDIA Corporation
 
zander's Avatar
 
Join Date: Aug 2002
Posts: 3,740
Default Re: Patch for driver on -current

Thanks again for bringing this to my attention. Unfortunately, it is not FreeBSD 7.0-CURRENT specific, though it may be masked on UP systems. I recently ran into the same problem with a FreeBSD 6.2-RELEASE SMP system and convinced myself that the switching from a spin mutex to a regular/adaptive mutex is correct. This bug should be fixed in a future NVIDIA FreeBSD graphics driver release.
zander is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
Max Payne 3 patch makes Max skinnier News Archived News Items 0 06-07-12 06:50 AM
Current NVIDIA Linux graphics driver releases AaronP NVIDIA Linux 0 11-06-08 04:39 PM
AMD kernel patch question redmoose NVIDIA Linux 2 09-07-02 07:16 PM
Soldier of Fortune 2 patch -=DVS=- Gaming Central 7 07-30-02 02:31 PM

All times are GMT -5. The time now is 02:53 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.