Commit Graph

55 Commits

Author SHA1 Message Date
pgoyette
48e395b1b8 Introduce mutex_ownable() to determine if it is possible for the current
process to acquire a mutex.
2017-05-01 21:35:25 +00:00
christos
9be065fb89 For LOCKDEBUG:
Always provide the location of the caller of the lock as __func__, __LINE__.
2017-01-26 04:11:56 +00:00
ozaki-r
05cf8927fd Add _KERNEL_OPT
It's needed for nbmake RUMP_LOCKDEBUG=yes.
2015-09-29 01:44:57 +00:00
riastradh
428ae67203 Put the lock error info in the panicstr so ddb can get at it. 2015-04-15 14:41:17 +00:00
christos
a27531bc87 Print the shared lock(s) before we panic, to aid with debugging. 2014-11-24 02:36:31 +00:00
matt
bbe1552068 Tell where the corrruption was encountered in the panic message. 2014-03-07 16:36:32 +00:00
christos
c3caf0b851 provide a better printf for the panic message 2013-10-12 16:42:27 +00:00
mlelstv
060c06be14 Revert change that allowed rw_tryenter(&lock, RW_READER) to recurse
for vfs_busy(). This is no longer necessary.
2013-04-27 08:12:34 +00:00
njoly
5fb876b9e0 Fix LOCKDEBUG build. 2013-02-09 11:04:32 +00:00
christos
a67c3c8971 printflike maintenance. 2013-02-09 00:31:21 +00:00
christos
d9ddb5220c - fix typo in comment
- Don't call abort1 with NULL ld, after panic(9).
2012-08-04 12:38:20 +00:00
yamt
9d109b3018 try to fill ld_locked/ld_unlocked for shared acquisition of lock 2011-07-26 13:07:20 +00:00
matt
521a86d55d rearrange some common code in lockdebug_unlocked.
When printing a lockdebug error, add a '*' to indicate whether lock or
unlock was performed.
2011-04-14 06:12:02 +00:00
matt
19e6c76b2d Rename rb.h to rbtree.h, as it is more appropriate (c.f. ptree.h). Also
helps find code that hasn't been updated to use the new rbtree API.
2010-09-25 01:42:38 +00:00
rmind
879d5dfb5e Fixes/improvements to RB-tree implementation:
1. Fix inverted node order, so that negative value from comparison operator
   would represent lower (left) node, and positive - higher (right) node.
2. Add an argument (i.e. "context"), passed to comparison operators.
3. Change rb_tree_insert_node() to return a node - either inserted one or
   already existing one.
4. Amend the interface to manipulate the actual object, instead of the
   rb_node (in a similar way as Patricia-tree interface does).
5. Update all RB-tree users accordingly.

XXX: Perhaps rename rb.h to rbtree.h, since cleaning-up..

1-3 address the PR/43488 by Jeremy Huddleston.

Passes RB-tree regression tests.
Reviewed by: matt@, christos@
2010-09-24 22:51:50 +00:00
dyoung
648f423c6f Make lockdebug_lock_print(NULL, ...) dump all locks. Now, in ddb,
'show lock 0x0' dumps all of the locks.

XXX I still need to fix 'show all lock'.
2009-11-03 00:29:11 +00:00
rmind
ac8f63538a Convert cpu_number(), which can be sparse, to cpu_index(), which is MI. 2009-10-05 23:39:27 +00:00
cegger
83fde857cc buildfix: use PRIxPTR rather %lx. 2008-11-07 19:50:00 +00:00
rafal
ca70a1c015 Pass / log return address in a few more places; proposed on tech-kern and
ok'd by ad@ about 6 months ago.
2008-11-07 02:40:35 +00:00
matt
5a4f0c6b2b Change tree op members/typedefs to rbto_compare_* from rb_compare_* 2008-06-30 20:14:09 +00:00
ad
13c7f6ff40 Move lib/libkern/rb.h to sys/rb.h, so it can be used by kernel header
files.
2008-06-04 14:31:15 +00:00
ad
7b8f512433 LOCKDEBUG:
- Tweak it so it can also catch common errors with condition variables.
  The change to kern_condvar.c is not included in this commit and will
  come later.

- Don't call kmem_alloc() if operating in interrupt context, just fail
  the allocation and disable debugging for the object. Makes it safe
  to do mutex_init/rw_init/cv_init in interrupt context, when running
  a LOCKDEBUG kernel.
2008-05-31 13:15:21 +00:00
ad
a4e0004be3 LOCKDEBUG: try to speed it up a bit by not using so much global state.
This will break the build briefly but will be followed by another commit
to fix that..
2008-05-06 18:40:57 +00:00
ad
81194e34f1 Allow rw_tryenter(&lock, RW_READER) to recurse, for vfs_busy(). 2008-05-06 17:11:45 +00:00
yamt
839080f755 lockdebug: try to detect recursive acquirements of read-write locks. 2008-05-03 06:24:55 +00:00
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
ad
8f9c8f5ea5 lockdebug_barrier: disable preemption using the interrupt priority level,
not crit_enter/crit_exit. Since this is called from mi_switch(), crit_exit
could recurse and skew statistics.
2008-04-27 11:28:49 +00:00
ad
feb4783fdf Replace use of CACHE_LINE_SIZE in some obvious places. 2008-03-27 18:30:15 +00:00
ad
057adba179 Make it compile if !LOCKDEBUG. 2008-02-18 18:31:10 +00:00
ad
7eb6056f9a Try to prevent more than one CPUs panicing when an error is detected. 2008-02-18 16:02:41 +00:00
ad
212c50dd1b Need sys/lock.h for SPINLOCK_SPIN_HOOK. 2008-01-05 12:39:27 +00:00
ad
0664a0459b Start detangling lock.h from intr.h. This is likely to cause short term
breakage, but the mess of dependencies has been regularly breaking the
build recently anyhow.
2008-01-04 21:17:40 +00:00
ad
ea3f10f7e0 Merge more changes from vmlocking2, mainly:
- Locking improvements.
- Use pool_cache for more items.
2007-12-26 16:01:34 +00:00
ad
461cd942ea Merge changes from vmlocking2 branch. 2007-12-08 15:00:13 +00:00
ad
b470ab628d Use membar_*(). 2007-11-30 23:05:43 +00:00
yamt
354863d6e5 lockdebug_mem_check: turn a redundant check into a panic. 2007-11-26 08:16:49 +00:00
yamt
33e66db218 fix lockdebug_mem_check. 2007-11-22 10:47:37 +00:00
yamt
671754cc2e lockdebug_alloc: detect double initialization explicitly. 2007-11-21 11:33:11 +00:00
yamt
51e523b832 re-enable lockdebug_mem_check. ad@ said disabling it was a mistake
in the first place.
the implementation has been changed to use rb-tree rather than hash
so that it can check regions larger than page size as well.
2007-11-21 10:25:51 +00:00
yamt
87fcbb0fe8 remove #if 0'ed code. 2007-11-21 10:21:40 +00:00
yamt
38d5e34116 make kmutex_t and krwlock_t smaller by killing lock id.
ok'ed by Andrew Doran.
2007-11-21 10:19:06 +00:00
matt
2cab8950e4 Don't static init simplelock (back out those changes). 2007-11-12 06:14:57 +00:00
matt
90ef495f4d use __SIMPLELOCK_UNLOCKED, not SIMPLELOCK_INITIALIZER 2007-11-12 06:07:43 +00:00
matt
11910619f7 Change some initialization of static queues to compile time.
(xxx_INIT to xxx_HEAD_INITIALIZER).  Drop code which inits
non-auto (global or static) variables to 0 since that's
already implied by being non-auto.  Init some static/global
cpu_simple_locks at compile time.
2007-11-11 23:22:23 +00:00
ad
d831186d55 Merge scheduler changes from the vmlocking branch. All discussed on
tech-kern:

- Invert priority space so that zero is the lowest priority. Rearrange
  number and type of priority levels into bands. Add new bands like
  'kernel real time'.
- Ignore the priority level passed to tsleep. Compute priority for
  sleep dynamically.
- For SCHED_4BSD, make priority adjustment per-LWP, not per-process.
2007-11-06 00:42:39 +00:00
ad
dde5d75e78 Fix spelling. 2007-10-27 01:23:25 +00:00
ad
11dc639958 Merge from vmlocking:
- G/C spinlockmgr() and simple_lock debugging.
- Always include the kernel_lock functions, for LKMs.
- Slightly improved subr_lockdebug code.
- Keep sizeof(struct lock) the same if LOCKDEBUG.
2007-10-11 19:45:24 +00:00
dsl
0ca3d21b5b Include sys/cdefs.h first. 2007-09-21 19:14:12 +00:00
ad
029f4f9cd7 splstatclock, spllock -> splhigh 2007-06-15 20:17:07 +00:00
skrll
5492d86688 Correct comment. 2007-05-21 11:56:35 +00:00