226 * The sobj_ops vector exports a set of functions needed when a thread
227 * is asleep on a synchronization object of this type.
228 */
229 static sobj_ops_t mutex_sobj_ops = {
230 SOBJ_MUTEX, mutex_owner, turnstile_stay_asleep, turnstile_change_pri
231 };
232
233 /*
234 * If the system panics on a mutex, save the address of the offending
235 * mutex in panic_mutex_addr, and save the contents in panic_mutex.
236 */
237 static mutex_impl_t panic_mutex;
238 static mutex_impl_t *panic_mutex_addr;
239
240 static void
241 mutex_panic(char *msg, mutex_impl_t *lp)
242 {
243 if (panicstr)
244 return;
245
246 if (casptr(&panic_mutex_addr, NULL, lp) == NULL)
247 panic_mutex = *lp;
248
249 panic("%s, lp=%p owner=%p thread=%p",
250 msg, (void *)lp, (void *)MUTEX_OWNER(&panic_mutex),
251 (void *)curthread);
252 }
253
254 /* "tunables" for per-platform backoff constants. */
255 uint_t mutex_backoff_cap = 0;
256 ushort_t mutex_backoff_base = MUTEX_BACKOFF_BASE;
257 ushort_t mutex_cap_factor = MUTEX_CAP_FACTOR;
258 uchar_t mutex_backoff_shift = MUTEX_BACKOFF_SHIFT;
259
260 void
261 mutex_sync(void)
262 {
263 MUTEX_SYNC();
264 }
265
266 /* calculate the backoff interval */
|
226 * The sobj_ops vector exports a set of functions needed when a thread
227 * is asleep on a synchronization object of this type.
228 */
229 static sobj_ops_t mutex_sobj_ops = {
230 SOBJ_MUTEX, mutex_owner, turnstile_stay_asleep, turnstile_change_pri
231 };
232
233 /*
234 * If the system panics on a mutex, save the address of the offending
235 * mutex in panic_mutex_addr, and save the contents in panic_mutex.
236 */
237 static mutex_impl_t panic_mutex;
238 static mutex_impl_t *panic_mutex_addr;
239
240 static void
241 mutex_panic(char *msg, mutex_impl_t *lp)
242 {
243 if (panicstr)
244 return;
245
246 if (atomic_cas_ptr(&panic_mutex_addr, NULL, lp) == NULL)
247 panic_mutex = *lp;
248
249 panic("%s, lp=%p owner=%p thread=%p",
250 msg, (void *)lp, (void *)MUTEX_OWNER(&panic_mutex),
251 (void *)curthread);
252 }
253
254 /* "tunables" for per-platform backoff constants. */
255 uint_t mutex_backoff_cap = 0;
256 ushort_t mutex_backoff_base = MUTEX_BACKOFF_BASE;
257 ushort_t mutex_cap_factor = MUTEX_CAP_FACTOR;
258 uchar_t mutex_backoff_shift = MUTEX_BACKOFF_SHIFT;
259
260 void
261 mutex_sync(void)
262 {
263 MUTEX_SYNC();
264 }
265
266 /* calculate the backoff interval */
|