kern_sx.c (240475) | kern_sx.c (244582) |
---|---|
1/*- 2 * Copyright (c) 2007 Attilio Rao <attilio@freebsd.org> 3 * Copyright (c) 2001 Jason Evans <jasone@freebsd.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 28 unchanged lines hidden (view full) --- 37 */ 38 39#include "opt_ddb.h" 40#include "opt_hwpmc_hooks.h" 41#include "opt_kdtrace.h" 42#include "opt_no_adaptive_sx.h" 43 44#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2007 Attilio Rao <attilio@freebsd.org> 3 * Copyright (c) 2001 Jason Evans <jasone@freebsd.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 28 unchanged lines hidden (view full) --- 37 */ 38 39#include "opt_ddb.h" 40#include "opt_hwpmc_hooks.h" 41#include "opt_kdtrace.h" 42#include "opt_no_adaptive_sx.h" 43 44#include <sys/cdefs.h> |
45__FBSDID("$FreeBSD: head/sys/kern/kern_sx.c 240475 2012-09-13 22:26:22Z attilio $"); | 45__FBSDID("$FreeBSD: head/sys/kern/kern_sx.c 244582 2012-12-22 09:37:34Z attilio $"); |
46 47#include <sys/param.h> 48#include <sys/systm.h> | 46 47#include <sys/param.h> 48#include <sys/systm.h> |
49#include <sys/kdb.h> |
|
49#include <sys/ktr.h> 50#include <sys/lock.h> 51#include <sys/mutex.h> 52#include <sys/proc.h> 53#include <sys/sleepqueue.h> 54#include <sys/sx.h> 55#include <sys/sysctl.h> 56 --- 187 unchanged lines hidden (view full) --- 244 245int 246_sx_slock(struct sx *sx, int opts, const char *file, int line) 247{ 248 int error = 0; 249 250 if (SCHEDULER_STOPPED()) 251 return (0); | 50#include <sys/ktr.h> 51#include <sys/lock.h> 52#include <sys/mutex.h> 53#include <sys/proc.h> 54#include <sys/sleepqueue.h> 55#include <sys/sx.h> 56#include <sys/sysctl.h> 57 --- 187 unchanged lines hidden (view full) --- 245 246int 247_sx_slock(struct sx *sx, int opts, const char *file, int line) 248{ 249 int error = 0; 250 251 if (SCHEDULER_STOPPED()) 252 return (0); |
252 KASSERT(!TD_IS_IDLETHREAD(curthread), | 253 KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), |
253 ("sx_slock() by idle thread %p on sx %s @ %s:%d", 254 curthread, sx->lock_object.lo_name, file, line)); 255 KASSERT(sx->sx_lock != SX_LOCK_DESTROYED, 256 ("sx_slock() of destroyed sx @ %s:%d", file, line)); 257 WITNESS_CHECKORDER(&sx->lock_object, LOP_NEWORDER, file, line, NULL); 258 error = __sx_slock(sx, opts, file, line); 259 if (!error) { 260 LOCK_LOG_LOCK("SLOCK", &sx->lock_object, 0, 0, file, line); --- 7 unchanged lines hidden (view full) --- 268int 269sx_try_slock_(struct sx *sx, const char *file, int line) 270{ 271 uintptr_t x; 272 273 if (SCHEDULER_STOPPED()) 274 return (1); 275 | 254 ("sx_slock() by idle thread %p on sx %s @ %s:%d", 255 curthread, sx->lock_object.lo_name, file, line)); 256 KASSERT(sx->sx_lock != SX_LOCK_DESTROYED, 257 ("sx_slock() of destroyed sx @ %s:%d", file, line)); 258 WITNESS_CHECKORDER(&sx->lock_object, LOP_NEWORDER, file, line, NULL); 259 error = __sx_slock(sx, opts, file, line); 260 if (!error) { 261 LOCK_LOG_LOCK("SLOCK", &sx->lock_object, 0, 0, file, line); --- 7 unchanged lines hidden (view full) --- 269int 270sx_try_slock_(struct sx *sx, const char *file, int line) 271{ 272 uintptr_t x; 273 274 if (SCHEDULER_STOPPED()) 275 return (1); 276 |
276 KASSERT(!TD_IS_IDLETHREAD(curthread), | 277 KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), |
277 ("sx_try_slock() by idle thread %p on sx %s @ %s:%d", 278 curthread, sx->lock_object.lo_name, file, line)); 279 280 for (;;) { 281 x = sx->sx_lock; 282 KASSERT(x != SX_LOCK_DESTROYED, 283 ("sx_try_slock() of destroyed sx @ %s:%d", file, line)); 284 if (!(x & SX_LOCK_SHARED)) --- 12 unchanged lines hidden (view full) --- 297 298int 299_sx_xlock(struct sx *sx, int opts, const char *file, int line) 300{ 301 int error = 0; 302 303 if (SCHEDULER_STOPPED()) 304 return (0); | 278 ("sx_try_slock() by idle thread %p on sx %s @ %s:%d", 279 curthread, sx->lock_object.lo_name, file, line)); 280 281 for (;;) { 282 x = sx->sx_lock; 283 KASSERT(x != SX_LOCK_DESTROYED, 284 ("sx_try_slock() of destroyed sx @ %s:%d", file, line)); 285 if (!(x & SX_LOCK_SHARED)) --- 12 unchanged lines hidden (view full) --- 298 299int 300_sx_xlock(struct sx *sx, int opts, const char *file, int line) 301{ 302 int error = 0; 303 304 if (SCHEDULER_STOPPED()) 305 return (0); |
305 KASSERT(!TD_IS_IDLETHREAD(curthread), | 306 KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), |
306 ("sx_xlock() by idle thread %p on sx %s @ %s:%d", 307 curthread, sx->lock_object.lo_name, file, line)); 308 KASSERT(sx->sx_lock != SX_LOCK_DESTROYED, 309 ("sx_xlock() of destroyed sx @ %s:%d", file, line)); 310 WITNESS_CHECKORDER(&sx->lock_object, LOP_NEWORDER | LOP_EXCLUSIVE, file, 311 line, NULL); 312 error = __sx_xlock(sx, curthread, opts, file, line); 313 if (!error) { --- 9 unchanged lines hidden (view full) --- 323int 324sx_try_xlock_(struct sx *sx, const char *file, int line) 325{ 326 int rval; 327 328 if (SCHEDULER_STOPPED()) 329 return (1); 330 | 307 ("sx_xlock() by idle thread %p on sx %s @ %s:%d", 308 curthread, sx->lock_object.lo_name, file, line)); 309 KASSERT(sx->sx_lock != SX_LOCK_DESTROYED, 310 ("sx_xlock() of destroyed sx @ %s:%d", file, line)); 311 WITNESS_CHECKORDER(&sx->lock_object, LOP_NEWORDER | LOP_EXCLUSIVE, file, 312 line, NULL); 313 error = __sx_xlock(sx, curthread, opts, file, line); 314 if (!error) { --- 9 unchanged lines hidden (view full) --- 324int 325sx_try_xlock_(struct sx *sx, const char *file, int line) 326{ 327 int rval; 328 329 if (SCHEDULER_STOPPED()) 330 return (1); 331 |
331 KASSERT(!TD_IS_IDLETHREAD(curthread), | 332 KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), |
332 ("sx_try_xlock() by idle thread %p on sx %s @ %s:%d", 333 curthread, sx->lock_object.lo_name, file, line)); 334 KASSERT(sx->sx_lock != SX_LOCK_DESTROYED, 335 ("sx_try_xlock() of destroyed sx @ %s:%d", file, line)); 336 337 if (sx_xlocked(sx) && 338 (sx->lock_object.lo_flags & LO_RECURSABLE) != 0) { 339 sx->sx_recurse++; --- 874 unchanged lines hidden --- | 333 ("sx_try_xlock() by idle thread %p on sx %s @ %s:%d", 334 curthread, sx->lock_object.lo_name, file, line)); 335 KASSERT(sx->sx_lock != SX_LOCK_DESTROYED, 336 ("sx_try_xlock() of destroyed sx @ %s:%d", file, line)); 337 338 if (sx_xlocked(sx) && 339 (sx->lock_object.lo_flags & LO_RECURSABLE) != 0) { 340 sx->sx_recurse++; --- 874 unchanged lines hidden --- |