Commit Graph

72 Commits

Author SHA1 Message Date
chs
e5440b91e0 add defines to control whether or not mutex operations are skipped
after we have panic'd.  no functional change.
2018-02-25 18:54:29 +00:00
ozaki-r
9a52f68c10 Check if adaptive mutex isn't called in interrupt context
By this check, we can notice this programming error without LOCKDEBUG.
The same check exists in rw_enter.
2018-02-06 07:46:24 +00:00
ozaki-r
5e1cf642fa Obtain proper initialized addresses of locks allocated by mutex_obj_alloc or rw_obj_alloc
Initialized addresses of locks allocated by mutex_obj_alloc or rw_obj_alloc
were not useful because the addresses were mutex_obj_alloc or rw_obj_alloc
itself. What we want to know are callers of them.
2018-02-05 04:25:04 +00:00
ozaki-r
8812081aa6 Apply C99-style struct initialization to syncobj_t 2018-01-30 07:52:22 +00:00
skrll
2d94c39cd2 typo in comment 2018-01-18 08:40:56 +00:00
ozaki-r
a45a6f1723 Apply C99-style struct initialization to lockops_t 2017-12-25 09:13:40 +00:00
christos
e7f0067cbe more const 2017-09-16 23:55:33 +00:00
christos
9d349e2adb add missing const 2017-09-16 23:25:34 +00:00
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
msaitoh
8bc54e5be6 KNF. Remove extra spaces. No functional change. 2016-07-07 06:55:38 +00:00
prlw1
4b3129d595 typo 2015-05-25 21:02:37 +00:00
uebayasi
f0f069cba4 Consistently use KPREEMPT_*() here. 2014-11-28 08:27:27 +00:00
matt
c3dcd587c0 Allow MD code to use something other than __cpu_simple_lock_t for doing spin
locks but use the same logic.

MUTEX_SPINBIT_LOCK_INIT
MUTEX_SPINBIT_LOCK_TRY
MUTEX_SPINBIT_LOCKED_P
MUTEX_SPINBIT_LOCK_UNLOCK
MUTEX_INITIALIZE_SPIN_IPL

For those platforms without sub-word CAS, you can use these to place the
mutex lock and ipl inside a full machine word and use CAS to update them.
2014-09-19 17:52:43 +00:00
matt
a35d1a8c7c Don't next structure and enum definitions.
Don't use C++ keywords new, try, class, private, etc.
2014-09-05 05:57:21 +00:00
mrg
923e17fd1b use __USE() where appropriate. 2013-10-19 21:01:39 +00:00
joerg
d572dfc897 Remove redundant declaration of MUTEX_CLEAR_WAITERS without checking if
any of the !__HAVE_SIMPLE_MUTEX architectures need it based on the
assumption that HPPA is the only member of that category.
2013-09-22 14:59:07 +00:00
skrll
a6cc1b9335 Revert previous - it was wrong. hi joerg. 2013-09-22 14:55:07 +00:00
joerg
c954523660 MUTEX_CLEAR_WAITERS is only ever used by !__HAVE_SIMPLE_MUTEXES 2013-09-14 13:19:18 +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
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