version 1.2, 2007/02/09 21:55:30 |
version 1.3, 2007/02/10 21:07:52 |
Line 261 mutex_dump(volatile void *cookie) |
|
Line 261 mutex_dump(volatile void *cookie) |
|
/* |
/* |
* mutex_abort: |
* mutex_abort: |
* |
* |
* Dump information about an error and panic the system. |
* Dump information about an error and panic the system. This |
|
* generates a lot of machine code in the DIAGNOSTIC case, so |
|
* we ask the compiler to not inline it. |
*/ |
*/ |
__attribute ((noinline)) __attribute ((noreturn)) void |
__attribute ((noinline)) __attribute ((noreturn)) void |
mutex_abort(kmutex_t *mtx, const char *func, const char *msg) |
mutex_abort(kmutex_t *mtx, const char *func, const char *msg) |
{ |
{ |
|
|
LOCKDEBUG_ABORT(MUTEX_GETID(mtx), mtx, (MUTEX_SPIN_P(mtx) ? |
LOCKDEBUG_ABORT(MUTEX_GETID(mtx), mtx, (MUTEX_SPIN_P(mtx) ? |
&mutex_spin_lockops : &mutex_adaptive_lockops), |
&mutex_spin_lockops : &mutex_adaptive_lockops), func, msg); |
__FUNCTION__, msg); |
|
/* NOTREACHED */ |
/* NOTREACHED */ |
} |
} |
|
|
Line 340 mutex_destroy(kmutex_t *mtx) |
|
Line 341 mutex_destroy(kmutex_t *mtx) |
|
* Note that we can't use the mutex owner field as an LWP pointer. We |
* Note that we can't use the mutex owner field as an LWP pointer. We |
* don't have full control over the timing of our execution, and so the |
* don't have full control over the timing of our execution, and so the |
* pointer could be completely invalid by the time we dereference it. |
* pointer could be completely invalid by the time we dereference it. |
|
* |
|
* XXX This should be optimised further to reduce potential cache line |
|
* ping-ponging and skewing of the spin time while busy waiting. |
*/ |
*/ |
#ifdef MULTIPROCESSOR |
#ifdef MULTIPROCESSOR |
int |
int |
Line 354 mutex_onproc(uintptr_t owner, struct cpu |
|
Line 358 mutex_onproc(uintptr_t owner, struct cpu |
|
l = (struct lwp *)MUTEX_OWNER(owner); |
l = (struct lwp *)MUTEX_OWNER(owner); |
|
|
if ((ci = *cip) != NULL && ci->ci_curlwp == l) { |
if ((ci = *cip) != NULL && ci->ci_curlwp == l) { |
mb_read(); /* XXXSMP Necessary? */ |
mb_read(); /* XXXSMP Very expensive, necessary? */ |
return ci->ci_biglock_wanted != l; |
return ci->ci_biglock_wanted != l; |
} |
} |
|
|
for (CPU_INFO_FOREACH(cii, ci)) { |
for (CPU_INFO_FOREACH(cii, ci)) { |
if (ci->ci_curlwp == l) { |
if (ci->ci_curlwp == l) { |
*cip = ci; |
*cip = ci; |
mb_read(); /* XXXSMP Necessary? */ |
mb_read(); /* XXXSMP Very expensive, necessary? */ |
return ci->ci_biglock_wanted != l; |
return ci->ci_biglock_wanted != l; |
} |
} |
} |
} |
Line 699 mutex_vector_exit(kmutex_t *mtx) |
|
Line 703 mutex_vector_exit(kmutex_t *mtx) |
|
/* |
/* |
* mutex_owned: |
* mutex_owned: |
* |
* |
* Return true if the current thread holds the mutex. |
* Return true if the current LWP (adaptive) or CPU (spin) |
|
* holds the mutex. |
*/ |
*/ |
int |
int |
mutex_owned(kmutex_t *mtx) |
mutex_owned(kmutex_t *mtx) |