Commit Graph

52 Commits

Author SHA1 Message Date
rmind
251f7169ed {mutex,rw}_vector_enter: use macro versions to disable/enable preemption. 2012-02-25 22:32:44 +00:00
rmind
ad12c77015 Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
2012-02-19 21:05:51 +00:00
rmind
7742d02d14 G/C unused MUTEX_COUNT_BIAS (it was for VAX) 2011-04-11 19:11:08 +00:00
rmind
ccfaf6e414 Optimise mutex_onproc() and rw_onproc() by making them O(1), instead
of O(ncpu) for adaptive paths.  Add an LWP destructor, lwp_dtor() with
a comment describing the principle of this barrier.

Reviewed by yamt@ and ad@.
2011-03-20 23:19:16 +00:00
skrll
c53ddcfff2 Re-apply:
Invert the sense of the bit to mark if LOCKDEBUG is enabled to
	disabled.

	This will help my fellow developers spot "use before initialised"
	problems that hppa picks up very well.

but fix the !LOCKDEBUG case by defining the "no debug" bits to zero so
they have no effect on lock stubs.
2010-02-08 09:54:27 +00:00
cube
5ba423200b Revert commit from Fri Feb 5 06:43:17 UTC 2010 by skrll:
Invert the sense of the bit to mark if LOCKDEBUG is enabled to disabled.

      This will help my fellow developers spot "use before initialised" problems
      that hppa picks up very well.

It has to be done differently, because the semantics of mtx_owner in the non-
LOCKDEBUG case can vary significantly between archs, and thus it is not
possible to simply flip a bit to 1.

Ok core@, as at least i386 is unbootable right now.
2010-02-06 04:50:19 +00:00
skrll
60b795dc0a Invert the sense of the bit to mark if LOCKDEBUG is enabled to disabled.
This will help my fellow developers spot "use before initialised" problems
that hppa picks up very well.
2010-02-05 06:43:16 +00:00
pooka
83685e650c Heave-ho mutex/rwlock object routines into separate modules -- they
don't have anything to do with the lock internals.
2009-11-04 13:29:45 +00:00
rmind
5a84a46b8c mutex_vector_enter: few predictions. 2009-01-25 04:45:14 +00:00
wrstuden
fc7511b00e Merge wrstuden-revivesa into HEAD. 2008-10-15 06:51:17 +00:00
ad
e10320350c Use __noinline. 2008-05-31 13:31:25 +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
245f0726ac Reduce ifdefs due to MULTIPROCESSOR slightly. 2008-05-19 17:06:02 +00:00
ad
81194e34f1 Allow rw_tryenter(&lock, RW_READER) to recurse, for vfs_busy(). 2008-05-06 17:11:45 +00:00
yamt
d1de8f5e7f mutex_vector_enter: fix a typo in a comment. 2008-04-30 00:40:13 +00:00
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
ad
5668836100 MUTEX_SPIN_SPLRAISE: add another __insn_barrier() for safety. 2008-04-28 13:18:50 +00:00
ad
02691198b8 Minor fix for preemption safety. 2008-04-27 14:29:09 +00:00
ad
ebca8ee832 mutex_owned, rw_read_held, rw_write_held, rw_lock_held: check for a NULL
pointer.
2008-04-22 14:46:35 +00:00
ad
baba274422 mutex_vector_enter: reduce reads of mtx_owner slightly. 2008-04-11 15:28:34 +00:00
ad
58420c122f mutex_vector_exit: add another panicstr check. 2008-03-28 22:19:39 +00:00
ad
13c3856c4c Remove dead code from previous. 2008-03-28 16:23:39 +00:00
ad
bb61e73cd5 Add code for dynamically allocated mutexes, as posted on tech-kern. 2008-03-27 19:11:05 +00:00
ad
ac85866313 simple_lock_only_held() is gone. 2008-01-05 12:31:39 +00:00
xtraeme
9bb6b94d89 sys/lock.h is required now. ok ad 2008-01-04 21:31:06 +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
ce6680f888 Add back mutex_owner() for Solaris compat. 2007-12-24 14:57:56 +00:00
ad
f2fb0b3870 mutex_init: use 'if' instead of 'switch' to avoid complaints from the
compiler.
2007-12-06 01:18:46 +00:00
ad
b21038696d mutex_init: make MUTEX_DEFAULT + IPL_SOFT* return an adaptive mutex. 2007-12-05 06:50:07 +00:00
ad
b470ab628d Use membar_*(). 2007-11-30 23:05:43 +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
ad
d18c6ca4de Merge from vmlocking:
- pool_cache changes.
- Debugger/procfs locking fixes.
- Other minor changes.
2007-11-07 00:23:13 +00:00
pooka
c71057099f fix typo in comment (greetings to ad, someone read your longwinded
prattling dissertation)
2007-11-04 17:26:02 +00:00
ad
a2a3828545 machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h 2007-10-19 11:59:34 +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
5b3ae27b0d __FUNCTION__ -> __func__ 2007-09-17 21:33:34 +00:00
skrll
9fdaf800d9 Merge nick-csl-alignment. 2007-09-10 11:34:05 +00:00
ad
88ab7da936 Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
2007-07-09 20:51:58 +00:00
yamt
f03010953f merge yamt-idlelwp branch. asked by core@. some ports still needs work.
from doc/BRANCHES:

	idle lwp, and some changes depending on it.

	1. separate context switching and thread scheduling.
	   (cf. gmcgarry_ctxsw)
	2. implement idle lwp.
	3. clean up related MD/MI interfaces.
	4. make scheduler(s) modular.
2007-05-17 14:51:11 +00:00
ad
bf8c3c1d7b mutex_vector_enter: put a read memory barrier between the final check that
(1) the holder is no longer running and (2) the waiters bit is set. Needed
to ensure that the operations happen in the correct order.
2007-03-12 22:34:08 +00:00
matt
57257364a0 Define/use MUTEX_COUNT_BIAS for those implementations that need one (like
vax).
2007-03-12 02:19:14 +00:00
ad
b1da576054 Add a MUTEX_NODEBUG type that avoids allocating debugging resources for
the lock. To be used for e.g. struct vm_page until a better way is found.
2007-03-10 16:01:13 +00:00
ad
50a8df5d23 mutex_onproc: remove unnecessary memory barriers. 2007-03-09 14:08:26 +00:00
mrg
3a04ec414c change an error message from:
Mutex error: sched_unlock_idle: sched_unlock_idle
to
	Mutex error: sched_unlock_idle: sched_mutex not locked
2007-03-04 21:06:13 +00:00
itohy
d2585a8c91 Remove extra space so that symbol renaming works properly. 2007-03-03 10:08:18 +00:00
itohy
cdbe0f0296 kern_mutex.c:190: macro `MUTEX_RECEIVE' used without args
kern_mutex.c:199: macro `MUTEX_RECEIVE' used without args
kern_mutex.c:206: macro `MUTEX_GIVE' used without args
2007-03-02 13:14:12 +00:00
ad
cbe547e6a7 - Nuke mutex_owner()
- mutex_getowner() -> mutex_owner()
2007-02-26 19:11:28 +00:00
yamt
e781af39bd implement priority inheritance. 2007-02-26 09:20:52 +00:00
ad
10a11a26b3 - Add a mutex_wakeup() which clears the waiters flag and wakes all waiters.
Will be needed to fix a problem with mutexes on sparc.
- mutex_tryenter(): fix a false "locking against myself" error.
2007-02-15 15:49:27 +00:00