Commit Graph

112 Commits

Author SHA1 Message Date
perseant
55307f6a04 Include the lwpid in the lock panic message, so we don't see silly messages
like
	lockmgr: pid 17, not exclusive lock holder 17 unlocking
2007-04-14 06:59:25 +00:00
ad
3d5b66ed02 Always include kernel_lock so that LOCKDEBUG checks can find the symbol. 2007-03-30 11:05:59 +00:00
christos
2058fdeab3 add a lockpanic function that prints more detailed error messages. 2007-03-04 06:20:25 +00:00
yamt
c574bfa378 typedef pri_t and use it instead of int and u_char. 2007-02-27 15:07:28 +00:00
thorpej
4f3d5a9cc0 TRUE -> true, FALSE -> false 2007-02-22 06:34:42 +00:00
ad
cebcfebbd2 kernel_lock():
- Fix error in previous.
- Call LOCKDEBUG_WANTLOCK() so the "exclusive wanted" count isn't off.
2007-02-20 16:10:10 +00:00
ad
723654a989 _kernel_lock(): we can recurse here if we take an interrupt while spinning.
Don't double book the time spent with lockstat.
2007-02-20 15:56:59 +00:00
ad
b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
ad
9f07c24ec6 lockstat: improve reporting slightly, and fix a bug where the command
could spin while resorting lists.
2006-12-25 11:57:40 +00:00
chs
a8459c8cc1 in lockstatus(), report LK_EXCLOTHER if LK_WANT_EXCL or LK_WANT_UPGRADE
is set, since the thread that set either of those flags will be the next
one to get the lock.  fixes PR 35143.
2006-12-09 15:59:25 +00:00
yamt
1a7bc55dcc remove some __unused from function parameters. 2006-11-01 10:17:58 +00:00
christos
4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
yamt
11ac1566d0 - KERNEL_LOCK_ASSERT_LOCKED: check cpu_biglock_count as well.
- implement KERNEL_LOCK_ASSERT_UNLOCKED.
2006-09-30 11:59:37 +00:00
ad
7813695db7 Add lock_owner_onproc(). 2006-09-07 02:06:47 +00:00
ad
d7c9e86f43 Track lockmgr() sleep events for lockstat. 2006-09-07 01:08:45 +00:00
yamt
13170f18a9 assert_sleepable: panic if curlwp == NULL. 2006-07-21 10:22:51 +00:00
yamt
9862c5bef2 add ASSERT_SLEEPABLE() macro to assert we can sleep. 2006-07-21 10:07:29 +00:00
erh
76d8aa2c53 Fix call to simple_lock_assert_held() so builds with -DDEBUG work. 2006-03-31 06:01:07 +00:00
erh
e4412d2162 Add simple_lock_assert_locked/simple_lock_assert_unlocked to provide additional
useful information when panic'ing because the assertion fails.
Use these to define the SCHED_ASSERT_LOCKED/SCHED_ASSERT_UNLOCKED macros.
2006-03-26 20:19:52 +00:00
erh
762add7da1 Check db_onpanic before dropping into the debugger on lock errors. 2006-03-16 00:52:32 +00:00
chs
0545b6e0cb changes for making DIAGNOSTIC not change the kernel ABI:
- for structure fields that are conditionally present,
   make those fields always present.
 - for functions which are conditionally inline, make them never inline.
 - remove some other functions which are conditionally defined but
   don't actually do anything anymore.
 - make a lock-debugging function conditional on only LOCKDEBUG.

as discussed on tech-kern some time back.
2005-12-27 04:06:45 +00:00
perry
a2cd732268 Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 19:12:23 +00:00
christos
95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
chs
20b89dd47f default to simple_lock_debugger=1 with LOCKDEBUG. 2005-10-08 03:18:25 +00:00
blymn
92bd9a35e9 Fix function variable names shadowing global declarations. 2005-06-01 13:12:49 +00:00
christos
6639138da1 Now we can fix the volatile cast-aways.
Rename some shadowed variables while here.
2005-05-29 21:16:14 +00:00
perry
da8abec863 nuke trailing whitespace 2005-02-26 21:34:55 +00:00
yamt
4dd708bfff a relatively lightweight implementation of kernel_lock. 2004-10-26 00:14:46 +00:00
yamt
c0ebe301d7 don't reference kernel_lock directly. 2004-10-23 21:27:33 +00:00
yamt
1e4aff5d38 add missing wakeups in the cases of lock failure.
from Stephan Uphoff, FreeBSD PR/69964.

(http://www.freebsd.org/cgi/query-pr.cgi?pr=69964)
> The LK_WANT_EXCL and LK_WANT_UPGRADE bits act as mini-locks and can block
> other threads.
> Normally this is not a problem since the mini locks are upgraded to full loc
> and the release of the locks will unblock the other threads.
> However if a thread reset the bits without optaining a full lock
> other threads are not awoken.
> This can happens if obtaining the full lock fails because of a LK_SLEEPFAIL,
> or a signal (if lock priority includes PCATCH .. don't think this is used).
2004-08-04 10:37:08 +00:00
yamt
8b4f43c443 - revert a part of the previous which breaks LK_SPIN locks.
(reported by Nicolas Joly on current-users@)
- propagate the previous to spinlock_acquire_count.
2004-08-04 01:16:06 +00:00
yamt
c602229c1a when acquiring an exclusive lock,
ensure that no one else have the same lock.
a patch from Stephan Uphoff, FreeBSD PR/69934.

(http://www.freebsd.org/cgi/query-pr.cgi?pr=69934)
>	Upgrading a lock does not play well together with acquiring
>	an exclusive lock and can lead to two threads being
>	granted exclusive access.
>
>	Problematic sequence:
>	Thread A acquires a previous unlocked lock in shared mode.
>	Thread B tries to acquire the same lock in exclusive mode
>	and blocks.
>	Thread A upgrades its lock - waking up thread B.
>	Thread B wakes up and also acquires the same lock as it only checks
>	if the lock is not shared or if someone wants to upgrade the lock
>	and not if someone already upgraded the lock to an exclusive lock.
2004-08-03 12:08:51 +00:00
yamt
2fd3d08b3d lockmgr: add a comment about LK_RETRY. 2004-05-31 09:05:10 +00:00
yamt
59ba83d898 lockmgr: assert that LK_RETRY is not specified. 2004-05-30 20:49:04 +00:00
hannken
8c21bc6224 Add ffs internal snapshots. Written by Marshall Kirk McKusick for FreeBSD.
- Not enabled by default. Needs kernel option FFS_SNAPSHOT.
- Change parameters of ffs_blkfree.
- Let the copy-on-write functions return an error so spec_strategy
    may fail if the copy-on-write fails.
- Change genfs_*lock*() to use vp->v_vnlock instead of &vp->v_lock.
- Add flag B_METAONLY to VOP_BALLOC to return indirect block buffer.
- Add a function ffs_checkfreefile needed for snapshot creation.
- Add special handling of snapshot files:
    Snapshots may not be opened for writing and the attributes are read-only.
    Use the mtime as the time this snapshot was taken.
    Deny mtime updates for snapshot files.
- Add function transferlockers to transfer any waiting processes from
  one lock to another.
- Add vfsop VFS_SNAPSHOT to take a snapshot and make it accessible through
  a vnode.
- Add snapshot support to ls, fsck_ffs and dump.

Welcome to 2.0F.

Approved by: Jason R. Thorpe <thorpej@netbsd.org>
2004-05-25 14:54:55 +00:00
yamt
efc80878d1 use lockstatus() instead of L_BIGLOCK to check if we're holding a biglock.
fix PR/25595.
2004-05-18 11:59:11 +00:00
yamt
b4831906b2 introduce LK_EXCLOTHER for lockstatus().
from FreeBSD, but a little differently.  instead of letting lockstatus()
take an additional thread argument, always use curlwp/curcpu.
2004-05-18 11:55:59 +00:00
wiz
d20841bb64 Uppercase CPU, plural is CPUs. 2004-02-13 11:36:08 +00:00
hannken
10654a5c0a Fix last commit. The current spl was an implicit argument to the ACQUIRE
macro.  With help and approval from YAMAMOTO Takashi <yamt@netbsd.org>
2003-12-08 14:21:25 +00:00
yamt
f9d2295ad0 turn ACQUIRE macro into a function by introducing new internal
flags, LK_SHARE_NONZERO and LK_WAIT_NONZERO.  from FreeBSD.
2003-11-23 08:57:16 +00:00
agc
aad01611e7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
2003-08-07 16:26:28 +00:00
pk
9ead24ac7a Use lock_printf() in SPINLOCK_SPINCHECK() and SLOCK_TRACE(). 2003-02-19 22:34:42 +00:00
pk
7f03dc8c13 _simple_lock(): revert to IPL at entry while spinning on the lock; raise
to spllock() again after we get it.
2003-01-19 14:40:55 +00:00
thorpej
e0d8d366df Merge the nathanw_sa branch. 2003-01-18 10:06:22 +00:00
pk
c70db21e38 lock_printf(): use vsnprintf/printf_nolog to avoid covertly using the system
log and thereby invoking scheduler code.
2003-01-15 23:11:05 +00:00
scw
0f91ed3dfa Quell uninitialised variable warnings. 2002-11-24 11:37:54 +00:00
perry
6858187df6 /*CONTCOND*/ while (0)'ed macros 2002-11-02 07:20:42 +00:00
fvdl
4244ef3b22 For INTERLOCK_ACQUIRE, s/splsched/spllock/. 2002-11-01 01:13:32 +00:00
provos
0f09ed48a5 remove trailing \n in panic(). approved perry. 2002-09-27 15:35:29 +00:00
chs
0e83d71253 print a stack trace in the "spinout" case too. 2002-09-14 21:42:42 +00:00