Commit Graph

6544 Commits

Author SHA1 Message Date
yamt 6198e821cb sleepq_block: fix a bug to lose biglocks in the case of recursive calls.
this fixes pf rb-tree corruption on my box.
2008-08-11 02:36:25 +00:00
skrll e7901782b3 Comment whitespace. 2008-08-08 16:58:01 +00:00
christos f6e1114503 Fix broken setitimer(). (Sverre Froyen) 2008-08-08 16:44:52 +00:00
uebayasi 714c16bc3e ttywrite: g/c an unused variable (cnt). 2008-08-08 07:18:03 +00:00
skrll 371a852414 memcpy'ing a sleepq (TAILQ) doesn't work.
Re-init the condvar after memcpy'ing so that the TAILQ is valid.

regress/sys/kern/lockf now completes rather than failing in cv_wait_sig
with KASSERT(cv_has_waiters()).
2008-08-07 07:42:06 +00:00
matt 13d044e16f Pages mapped by debug_malloc are PMAP_KMPAGE so tell the pmap that. 2008-08-07 01:40:21 +00:00
plunky fd7356a917 Convert socket options code to use a sockopt structure
instead of laying everything into an mbuf.

approved by core
2008-08-06 15:01:23 +00:00
tls 717f903a98 Add accept filters, ported from FreeBSD by Coyote Point Systems. Add inetd
support for specifying an accept filter for a service (mostly as a usage
example, but it can be handy for other things).  Manual pages to follow
in a day or so.

OK core@.
2008-08-04 03:55:47 +00:00
pooka bcfb021366 rumpify sys___sysctl 2008-08-01 19:32:35 +00:00
pooka b629cd421b expose module_compatible() 2008-08-01 14:05:15 +00:00
skrll 6fd21ccbbf Improve the debug output ever so slightly. 2008-08-01 07:11:24 +00:00
simonb 2a3d67b697 Remove needless white-space change that crept in through wapbl branch
merge.
2008-07-31 08:42:01 +00:00
simonb 36d65f1138 Merge the simonb-wapbl branch. From the original branch commit:
Add Wasabi System's WAPBL (Write Ahead Physical Block Logging)
   journaling code.  Originally written by Darrin B. Jewell while
   at Wasabi and updated to -current by Antti Kantee, Andy Doran,
   Greg Oster and Simon Burge.

OK'd by core@, releng@.
2008-07-31 05:38:04 +00:00
uebayasi d1dfd4fec7 Display t_outcv* channels as "ttyout*", not "ttycan*". 2008-07-31 01:46:40 +00:00
thorpej 261002c777 rw_vector_exit(): When doing direct hand-off to a writer, only set
RW_WRITE_WANTED if there are additional writers waiting.
2008-07-29 16:13:39 +00:00
drochner a17262c3e3 Avoid NULL pointer dereference on power handler deregistration if
it was not registered before. I assume that a lot of drivers do not
proper bookkeeping in the case the attach() exits early due to
errors. This is hard to fix and to test, so just be generous here.
2008-07-28 14:22:14 +00:00
pooka f06b295c56 Adjust comment location to make it make sense.
no functional change
2008-07-27 15:08:37 +00:00
dsl c43281ec80 Remove all the pending connections in soclose().
'continue' in 'do .. while (0)' doesn't do what ad@ intended.
2008-07-25 22:45:58 +00:00
uwe 4691dacd78 Declare lwp_exit_switchaway() __dead. Add infinite loop at the end of
lwp_exit_switchaway() to convince gcc that cpu_switchto(NULL, ...) is
really not going to return in that case.  Exposed by gcc4.3.

Reported on tech-kern by Alexander Shishkin.
2008-07-25 00:48:59 +00:00
apb 7cb9e72bbb Avoid using \$ in an awk script. Instead, store '$NetBSD$'
in an awk variable and interpolate it where needed.

Based on the patch by Martin Husemann in PR 38766.
2008-07-23 21:17:25 +00:00
christos 0f5d35d8d1 report local symbols too. 2008-07-22 21:18:35 +00:00
blymn 762e875434 Add locking around veriexec operations to prevent all sorts of badness
happening.  This fixes kern/38646.
2008-07-20 08:50:20 +00:00
kardel ccab995bc6 Initialize timecounter_lock at IPL_HIGH. Prevents a "locking against myself"
when com.c (options PPS_SYNC) delivers a PPS time stamp during clock
interupt processing.
2008-07-19 10:33:58 +00:00
christos dac1180a87 fix debugging printf 2008-07-18 21:29:48 +00:00
rmind a7fc471680 PR/39155: Wolfgang Solfrank: Invalid parameter to turnstile_exit in rw_downgrade. 2008-07-17 23:00:01 +00:00
pooka cc7d901591 vfs_subr2 has lost its will to live. vfs_subr was originally split
into two parts so that some of the routines could be used by rump.
Now that rump uses both vfs_subr and vfs_subr2 and there is no
reason to keep two files lying around, re-unite them.
2008-07-16 20:06:19 +00:00
drochner 8b720093a8 wipe out tty buffer contents after read, to avoid keeping possibly
sensitive information in memory longer than necessary
(We could make this depend on ~ECHO or so, but this would be an API
change and I don't think it is worth the effort.)
2008-07-16 18:27:49 +00:00
pooka b09210ace9 rumpalooza sys_fsync 2008-07-16 15:42:54 +00:00
christos 460ae70d0a make l_flags contain more stuff. Fixes top thread display where system processes
were always displayed.
2008-07-15 22:25:30 +00:00
christos aa389c698d Use more timespecs internally. From Alexander Shishkin and me.
Welcome to 4.99.70, 30 more to go for 100.
2008-07-15 16:18:08 +00:00
hannken 0d6dbadf45 bdwrite(): The COWDONE check may fire for special vnodes with mounted
non-ffs file system.  Remove VBLK vnodes from the check.

Should fix PR kern/38892
2008-07-14 16:22:42 +00:00
rmind 7c330ba82f Fix the locking against oneself, migrate LWPs only from runqueue.
Part of the fix for PR/38882.
2008-07-14 01:27:15 +00:00
rmind 4f91cff093 - Disallow setting of affinity for zombie LWPs.
- Fix the possible NULL dereference when LWP exiting.
- Fix the inhertance of affinity.
2008-07-14 01:19:37 +00:00
rmind d489642431 sched_migratable: add KASSERT since this function cannot be called
without lock held now.  Few cosmetic changes, while here.
2008-07-14 01:18:10 +00:00
yamt e4fb48bcaf pool_do_put: fix a pool corruption bug discovered by
the recent exec_pool changes.
2008-07-09 02:43:53 +00:00
christos 7f6e74c46e Fix to bug reported and tested by Alexander Shishkin. struct ptimer has
a union that contains either a callout [for CLOCK_REALTIME] or a flag
and a list [for other clock types]. Make sure we perform the right actions
on the right union member depending on the clock type. Otherwise this would
result in crashes.
2008-07-08 20:53:02 +00:00
pooka fc6faa2baf Force vrele_thread to run in vflush() only if there is vrele_pending.
Makes unmounting a file system in a forcibly singlethreaded rump
invocation work.
2008-07-07 14:15:41 +00:00
yamt 03bb7555b4 fix pool corruption bugs in subr_pool.c 1.162. 2008-07-07 12:27:19 +00:00
pooka 21730363f8 Expose utimes() and lutimes() to rump.
from Arnaud Ysmal
2008-07-07 09:01:40 +00:00
bouyer 52346627a5 kern/39052: fix broken assertion. We can have a BC_BUSY buffer in the LRU
queue, if it's being flushed. But in this case, we'll also have B_VFLUSH.

While there fix checkfreelist() so that it can be used to check that a
buffer is not in the free lists.
2008-07-06 15:00:45 +00:00
ad 6c6c91b240 Move an assignment later. 2008-07-04 16:41:00 +00:00
ad 46587f3717 - Keep cache locked while allocating a cache group - later we might want
to automatically tune the group sizes at run time.
- Fix broken assertion.
- Avoid another test+branch.
2008-07-04 16:38:59 +00:00
ad 9d573e640e Remove a bunch of conditional branches from the pool_cache fast path. 2008-07-04 13:28:08 +00:00
ad 2526653044 vinvalbuf: broken assertion. 2008-07-03 12:37:09 +00:00
rmind b7cdc71cd2 mq_open: fix confusion of FREAD/FWRITE and VREAD/VWRITE. 2008-07-02 20:06:09 +00:00
rmind 30dfdb2897 lwp_migrate: if LWP is still on the CPU (LP_RUNNING), it must be handled
like LSONPROC.  Should fix PR/38588.  OK by <ad>.
2008-07-02 19:53:12 +00:00
rmind 160268aca6 Remove proc_representative_lwp(), use a simple LIST_FIRST() instead.
OK by <ad>.
2008-07-02 19:49:58 +00:00
rmind 73f3b7bb31 Remove outdated comments, and historical CCPU_SHIFT. Make resched_cpu static,
const-ify ccpu.  Note: resched_cpu is not correct, should be revisited.

OK by <ad>.
2008-07-02 19:44:10 +00:00
rmind 61fc86b29b Remove locking of p_stmutex from sched_pstats(), protect l_pctcpu with p_lock,
and make l_cpticks lock-less.  Should fix PR/38296.

Reviewed (slightly different version) by <ad>.
2008-07-02 19:38:37 +00:00
ad b94f79f0e8 Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@. 2008-07-02 17:28:54 +00:00
matt 7408df1239 Change {ff,fd}_exclose and ff_allocated to bool. Change exclose arg to
fd_dup to bool.  Switch assignments from 1/0 to true/false.

This make alpha kernels compile.  Bump kern to 4.99.69 since structure
changed.
2008-07-02 16:45:19 +00:00
matt 1906aa3e59 Switch from KASSERT to CTASSERT for those asserts testing sizes of types. 2008-07-02 14:47:34 +00:00
pooka 1805817468 Adjust rump syscalls: remove a few pointless ones and add a few
missing ones.
2008-07-01 13:03:08 +00:00
matt 5a4f0c6b2b Change tree op members/typedefs to rbto_compare_* from rb_compare_* 2008-06-30 20:14:09 +00:00
pooka d496f014ff Don't compile kern_lock for rump any more, it's no longer required.
Allows us to get rid of the incorrect _RUMPKERNEL ifdefs outside sys/rump.
2008-06-25 13:16:58 +00:00
ad 40818746b1 Use pool_cache. 2008-06-25 11:05:46 +00:00
ad d23ae8da8d sigpending1: don't subtract the sigmask (!!). 2008-06-25 11:04:24 +00:00
ad 80892cd092 Use pool_cache. 2008-06-24 18:50:30 +00:00
ad 8c5bcce4b9 execve1:
- Properly terminate the fake argument list.
- Fix two double-frees.
2008-06-24 18:04:52 +00:00
ad 9993bc6d33 Nothing uses getsock/getvnode any more. 2008-06-24 11:21:46 +00:00
gmcgarry 8cead24f2a The conversion to c99-style designated initialisers brought in the gcc
extension of specifying an array range.  Revert to runtime initialization
of limit0.

See here for details: http://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html
2008-06-24 10:31:05 +00:00
gmcgarry a7edd5ccdd Replace gcc-style designated initialisers with c99-style. 2008-06-24 10:27:35 +00:00
gmcgarry 8b957c9d45 ioctl commands are unsigned long. Changes ABI for fsetown() and fgetown() on 64-bit architectures. 2008-06-24 10:26:26 +00:00
gmcgarry fb6bc48511 ioctl commands are unsigned long. 2008-06-24 10:24:21 +00:00
rmind 59a180ac8f sysctl_proc_stop: fix a lock-leak when kauth returns an error.
From <kefren>.
2008-06-23 20:04:36 +00:00
ad aed68d2d63 getvnode -> fd_getvnode 2008-06-23 11:30:41 +00:00
ad 29957bec2e sys_fcntl: use l_fd, not p_fd. 2008-06-23 11:26:53 +00:00
ad 7756789d3a PR kern/38990: Unmounting a disk fails the first time
vflush: process vrele_list at least once before looking at the mount.
2008-06-23 11:23:39 +00:00
ad bce675d015 When offlining a CPU, ensure that at least one other CPU within the same
processor set remains online, otherwise the system can deadlock.
2008-06-22 13:59:06 +00:00
ad 53db9954a3 - Ensure that at least one cpu stays in the default pset, otherwise the
system will lock up.
- Use cpu_lock, there's no need for a seperate psets_lock.
- Add a sysctl to return the list of psets as a string.
2008-06-22 12:59:18 +00:00
christos 1d875fc75f Adjust to separate kcpuset_t and cpuset_t. 2008-06-22 00:06:36 +00:00
christos 5e865a2f1b Also enforce that cm->cmsg_len >= CMSG_ALIGN(sizeof cmsghdr), from
Michael van Elst
2008-06-20 15:27:50 +00:00
christos db982eb35b Don't require cm->cmsg_len == control->m_len, just that the cm->cmsg_len
<= control->m_len, like FreeBSD does. Idea from Taylor R Campbell.
2008-06-20 15:18:38 +00:00
mlelstv 8b80c3645f reassignbuf() is called by bdirty() from within biodone processing.
It can have waiters.
2008-06-18 18:11:25 +00:00
yamt fff57c5525 merge yamt-pf42 branch.
(import newer pf from OpenBSD 4.2)

ok'ed by peter@.  requested by core@
2008-06-18 09:06:25 +00:00
christos ffabbaf7c6 set mtime/atime properly, not backwards. 2008-06-17 21:02:08 +00:00
mlelstv 76a664c61a Drop !cv_has_waiters assertion.
bdirty() is called from within biodone() processing before
waiters have been woken up and removed.

N.B. it is also used by smbfs.
2008-06-17 19:14:14 +00:00
christos f5be32608a PR/38942: Pedro F. Giffuni: no support for birthtime in utimes(2). 2008-06-17 16:18:01 +00:00
tsutsui d7d2a525b1 Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t. 2008-06-17 16:17:21 +00:00
tsutsui 2bc3b0c694 Regen from syscalls.master rev 1.204:
> Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t.
2008-06-17 16:07:57 +00:00
tsutsui 33dfc34006 Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t. 2008-06-17 16:05:23 +00:00
reinoud f6a70673ba Mark a buffer `busy` in getnewbuf() when it came from the pool_cache since
its not on a free list.

Also change buf_init() to not automatically mark buffers `busy' since this
only makes sense for bufcache buffers.

Mark all buf_init'd buffers 'busy' on the places where they ought to be
flagged as such to not confuse the buffer cache.

Fixes PR 38923.
2008-06-17 14:53:10 +00:00
ad 4810cbe2bf sleepq_block: add a comment. 2008-06-17 09:11:25 +00:00
ad cad3a145a3 PR kern/38761: new (?) race in buffer cache code
Back out the workaround from cv_has_waiters(), which is not longer needed.
Removal was missed earlier.
2008-06-16 12:03:01 +00:00
ad a9c4cefebd PR kern/38927: processes getting stuck in uvm_map (cv_timedwait), hanging
machine

Assume that a vnode (and associated data structures) costs 2kB in the
worst imaginable case. Don't allow sysctl to set desiredvnodes to a
value that would use more than 75% of KVA or 75% of physical memory.
2008-06-16 11:26:28 +00:00
ad 45850c3df9 PPWAIT need only be locked by proc_lock, so move it to proc::p_lflag. 2008-06-16 10:15:57 +00:00
ad 672f91757e PR kern/38761: new (?) race in buffer cache code
- Back out the previous workaround now that the sleep queue code has
  been changed to never let the queue become empty if there are valid
  waiters.
- Use sleepq_hashlock() to improve clarity.
- Sprinkle some assertions.
2008-06-16 10:03:47 +00:00
ad 461a5fb24b PR kern/38761: new (?) race in buffer cache code
sleepq_changepri, sleepq_lendpri: don't let an active sleep queue head become
empty. The condvar code inspects the queue head without holding the sleep
queue lock and needs to see a non-empty queue if there are waiters.
2008-06-16 10:02:15 +00:00
ad 5adf7333fd - PPWAIT is need only be locked by proc_lock, so move it to proc::p_lflag.
- Remove a few needless lock acquires from exec/fork/exit.
- Sprinkle branch hints.

No functional change.
2008-06-16 09:51:14 +00:00
ad b0ac1133c6 Sprinkle some assertions. 2008-06-16 09:48:13 +00:00
ad 5bfa865311 Sprinkle more assertions. 2008-06-16 09:47:55 +00:00
ad b7f5063255 lwp_lock_retry: return a pointer to the lock acquired. No functional change. 2008-06-16 09:45:20 +00:00
rmind 481ae1556f - Add general cpuset macros.
- Use kcpuset name for kernel-only functions.
- Use cpuid_t to specify CPU ID.
- Unify all cpuset users.

API is expected to be stable now.
2008-06-16 01:41:20 +00:00
christos 09e715922e regen 2008-06-16 01:00:21 +00:00
uebayasi 9d4479f7e9 Typo. 2008-06-16 00:54:53 +00:00
christos 20d8fbfbe4 typo 2008-06-16 00:54:10 +00:00
christos 88c08e3b98 regen 2008-06-16 00:32:23 +00:00
christos 5c45905c42 adjust prototypes for the affinity calls. 2008-06-16 00:31:17 +00:00
rmind a6092d3c4a gencpuset: avoid returning of unitialized error.
sched_setaffinity: instead of E2BIG, return EINVAL in a case of invalid
CPU, which is more consistent.
2008-06-15 23:29:09 +00:00
christos f30b5785d5 Don't expose struct cpuset, share the l_affinity flag and only allocate it
if we need to. This is not a compatible change, but the syscalls are new
enough and they don't need to be versioned. Approved by rmind.
2008-06-15 20:32:57 +00:00
chris 44d939d150 Fix for biowait hangs, and possibly other condvar hangs. Also should fix
PR kern/38761.

The condvar must access the sleepq with the sleepq lock held, doing so
is causing inconsistent sleepq state to be read.

This is because some accesses to the sleepq don't come via the cv code,
but are call directly into sleepq_changepri and sleepq_lendpri, which take
the sleepq lock, and removes then re-inserts lwps into the sleepq.

Running a build.sh with -j8 now completes on my quad-core, also tested by
Simon@ on a 8-core server and matt@ on a quad-core.

I believe there is room to be more efficient with this, as we now take the
sleepq lock for all cv_broadcast and cv_signal calls. I'll look into this
and post a diff to tech-kern.
2008-06-15 09:56:18 +00:00
drochner a748803de9 tighten type checking: use device_t instead of void* at some places 2008-06-11 15:56:11 +00:00
ad 62c877a460 Don't call uvm_pageidlezero() if the CPU is marked offline. 2008-06-11 13:42:02 +00:00
drochner 520a61068b remove the hacks around fakemdrootdev[] which should be unnecessary now
that "md" devices show up in the "alldevs" list
2008-06-11 10:40:21 +00:00
dyoung 1e479b72f8 In device_pmf_driver_deregister, postpone deleting a device_t's
reference to the PMF private data until the private data has no
more waiters.  This protects against a NULL dereference.

In device_pmf_lock1(), test a device_t for PMF registration before
dereferencing its PMF private data.
2008-06-11 06:26:32 +00:00
simonb a0f8ee25d3 In mount_domount() there is no need to initialise "mp" if the first time
we use it we set it.
2008-06-10 14:14:01 +00:00
ad 06da5288fa There can be existing waiters on a socket's condition variables when we
change socket::so_lock, and they rely on the old lock to synchronize.
Wake them up whenever we change so_lock so they can restart their waits.
2008-06-10 11:49:11 +00:00
ad f77c704577 Fix error in previous. 2008-06-09 11:49:40 +00:00
ad c862aeca6f ras_purgeall: avoid taking p_auxlock. 2008-06-09 11:46:34 +00:00
ad 5ab3329550 Correct previous. 2008-06-08 12:23:18 +00:00
ad 7304342b50 cdev_tty: don't acquire kernel lock, as we may need to call this with
tty_lock already held (and it would reverse the usual lock order).
2008-06-08 12:22:39 +00:00
ad d78b3bf8f2 PR kern/38881 execve(2) panic: lock error, with path argument > PATH_MAX 2008-06-06 22:21:11 +00:00
drochner 598d615d27 add a KASSERT to catch missing locators 2008-06-06 17:52:40 +00:00
ad 6a33531fe1 - Make getiobuf() return buffers marked BUSY.
- Sprinkle more assertions.
2008-06-06 12:49:15 +00:00
cegger 6e390579fc make this build 2008-06-05 21:55:51 +00:00
ad b91062326d Avoid "free vnode isn't" assertion. 2008-06-05 12:32:57 +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
rmind af4e8e9ea7 Check the result of allocation in the cases where size is passed by user. 2008-06-04 13:02:41 +00:00
ad cbbf514e2c - vm_page: put listq, pageq into a union alongside a LIST_ENTRY, so we can
use both types of list.

- Make page coloring and idle zero state per-CPU.

- Maintain per-CPU page freelists. When freeing, put pages onto the local
  CPU's lists and the global lists. When allocating, prefer to take pages
  from the local CPU. If none are available take from the global list as
  done now. Proposed on tech-kern@.
2008-06-04 12:45:28 +00:00
ad 621389e8b2 Fix broken enable test; fixes random coredumps. 2008-06-04 12:26:20 +00:00
ad 65b594ff61 Make sure the PAX flags are copied/zeroed correctly. 2008-06-04 12:16:06 +00:00
ad 8dd7771d61 Disable the wakeup assertion for the time being because the tty code
triggers it.
2008-06-04 11:22:55 +00:00
ad cee82bbafa Don't use proc specificdata for the PAX stuff. Speeds up mmap() and others. 2008-06-03 22:15:14 +00:00
ad d191ae6b1b Don't use proc specificdata. Speeds up mmap() and others. 2008-06-03 22:14:24 +00:00
ad 1b23b70818 vfs_cache:
- Don't use goto in critical paths, it can confuse the compiler.
- Sprinkle some branch hints.
- Make namecache stats per-CPU and collate once per second.
- Use vtryget().
2008-06-03 15:50:22 +00:00
ad 457a3f8942 vtryget: try to get an initial reference to a vnode without taking its
interlock. Only works if v_usecount is already non-zero, which is nearly
always true for busy files like libc.so or ld_elf.so.
2008-06-03 14:54:12 +00:00
dyoung b5bf86befb Before freeing a ktr_desc, destroy its condition variables. 2008-06-03 05:53:09 +00:00
ad a51fec9810 Avoid assertion failures. From drochner@. 2008-06-02 22:56:09 +00:00
drochner 99cb76cad6 adjust a KASSERT to reality after atomic vnode usecount changes 2008-06-02 19:20:22 +00:00
ad 3a8db3158e Use atomics to maintain v_usecount. 2008-06-02 16:25:34 +00:00
ad 30115e937a Most contention on proc_lock is from getppid(), so cache the parent's PID. 2008-06-02 16:18:09 +00:00
ad fb8c6fcc83 Don't needlessly acquire v_interlock. 2008-06-02 16:16:27 +00:00
ad 0d151db6c9 Don't needlessly acquire v_interlock. 2008-06-02 16:00:33 +00:00
ad 8ad974fae5 vn_marktext, vn_lock: don't needlessly acquire v_interlock. 2008-06-02 15:29:18 +00:00
ad ea8a92578d If vfork(), we want the LWP to run fast and on the same CPU
as its parent, so that it can reuse the VM context and cache
footprint on the local CPU.
2008-06-02 13:58:07 +00:00
ad c3e93e738f Make trap counters per-cpu, like syscalls. 2008-06-01 21:24:15 +00:00
ad 736a4d9b78 Kill devsw_lock and just use specfs_lock. The two would need merging
in order to prevent unload of modules when a device that they provide
is still open.
2008-05-31 21:34:42 +00:00
ad 2feabc3836 PR kern/38812 race between lwp_exit_switchaway and exit1/coredump
Move the LWP RUNNING and TIMEINTR flags into the thread-private flag word.
2008-05-31 21:26:01 +00:00
dyoung 8f34c216d0 Add printf_tolog(), which writes to the kernel message buffer,
only.  I believe this is the safest way to log serious conditions
indicated by NMI.
2008-05-31 20:27:24 +00:00
ad 4c57df4a3c - Put in place module compatibility check against __NetBSD_Version__,
as discussed on tech-kern.

- Remove unused module_jettison().
2008-05-31 20:14:38 +00:00
ad bda19becba Fix wmesg for !LOCKDEBUG. 2008-05-31 16:25:23 +00:00
ad 506130b087 biodone2: if the buffer is async or has a callback method, assert that
there are no waiters on b_done (threads in biowait()).
2008-05-31 13:41:44 +00:00
ad 7442154bd9 - Give each condition variable its own sleep queue head. Helps the system
to scale more gracefully when there are thousands of active threads.
  Proposed on tech-kern@.

- Use LOCKDEBUG to catch some errors in the use of condition variables:

  freeing an active CV
  re-initializing an active CV
  using multiple distinct mutexes during concurrent waits
  not holding the interlocking mutex when calling cv_broadcast/cv_signal
  waking waiters and destroying the CV before they run and exit it
2008-05-31 13:36:25 +00:00
ad e10320350c Use __noinline. 2008-05-31 13:31:25 +00:00
ad a6f1414cd1 tsleep -> kpause 2008-05-31 13:26:29 +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 10d96b47b0 shmrealloc: destroy condition variables before freeing them. 2008-05-31 13:11:14 +00:00
ad deda5b9d55 Hold proc_lock when sleeping on p_waitcv, not proc::p_lock. 2008-05-31 13:04:14 +00:00
ad 5b4d14b9f1 Add a comment to turnstile_block:
* NOTE: if you get a panic in this code block, it is likely that
        * a lock has been destroyed or corrupted while still in use.  Try
        * compiling a kernel with LOCKDEBUG to pinpoint the problem.
2008-05-31 12:03:15 +00:00
freza 1531f6d32e Any time we remove event from the queue make sure we 1. release the
event plist and 2. free the drvctl_event struct.

Discussed with jmcneill@.
2008-05-30 15:30:37 +00:00