Commit Graph

5256 Commits

Author SHA1 Message Date
ad
0ac3a31ea3 Cosmetic changes. 2007-03-30 11:06:58 +00:00
ad
3d5b66ed02 Always include kernel_lock so that LOCKDEBUG checks can find the symbol. 2007-03-30 11:05:59 +00:00
ad
5714ab2718 Make cv_has_waiters() return type bool. 2007-03-29 17:39:34 +00:00
ad
79da439b94 - cv_wakeup, cv_broadcast -> cv_signal where appropriate
- Update some comments.
2007-03-29 17:37:13 +00:00
ad
4911263df8 cv_wakeup -> cv_signal 2007-03-29 17:35:17 +00:00
ad
6cf46baa77 - cv_wakeup: remove this. There are ~zero situations where it's useful.
- cv_wait and friends: after resuming execution, check to see if we have
  been restarted as a result of cv_signal. If we have, but cannot take
  the wakeup (because of eg a pending Unix signal or timeout) then try to
  ensure that another LWP sees it. This is necessary because there may
  be multiple waiters, and at least one should take the wakeup if possible.
  Prompted by a discussion with pooka@.
- typedef struct lwp lwp_t;
- int -> bool, struct lwp -> lwp_t in a few places.
2007-03-29 17:34:39 +00:00
hubertf
3bfc0c42ee Remove duplicate #include's
From: Slava Semushin <php-coder@altlinux.ru>
2007-03-26 22:52:44 +00:00
rmind
7b9af0160d Handle newlwp() error case. Currently, newlwp() cannot fail, but this
will likely change in the future.
2007-03-24 16:43:56 +00:00
ad
bb25376cda Fix a deadlock w/kqueue that was introduced with the last set of changes.
Spotted by yamt@.
2007-03-23 18:33:43 +00:00
dsl
f99253cbf6 Somehow a single K&R function definition was lurking - nuke it. 2007-03-21 21:18:56 +00:00
ad
fed1793605 Improvements to lwp_wait1(), for PR kern/35932:
- Better detect simple cycles of threads calling _lwp_wait and return
  EDEADLK. Does not handle deeper cycles like t1 -> t2 -> t3 -> t1.
- If there are multiple threads in _lwp_wait, then make sure that
  targeted waits take precedence over waits for any LWP to exit.
- When checking for deadlock, also count the number of zombies currently
  in the process as potentially reapable. Whenever a zombie is murdered,
  kick all waiters to make them check again for deadlock.
- Add more comments.

Also, while here:

- LOCK_ASSERT -> KASSERT in some places
- lwp_free: change boolean arguments to type 'bool'.
- proc_free: let lwp_free spin waiting for the last LWP to exit, there's
  no reason to do it here.
2007-03-21 18:25:59 +00:00
ad
e0fd341348 Changes to LWP wakeup:
- Don't bother sorting the sleep queues, since user space controls the
  order of removal.
- Change setrunnable(t) to lwp_unsleep(t). No functional change from the
  perspective of user applications.
- Minor cosmetic changes.
2007-03-20 23:25:17 +00:00
skrll
335ac44f76 Restore previous semantics of PT_LWPINFO and make sure to lwp_addref the
LWP.

OK'ed by ad.
2007-03-15 20:55:15 +00:00
ad
1b83cbc3d6 sodopendfreel: Getting a bit over ambitious.. Go to splvm() before calling
pool_cache_put().
2007-03-15 16:28:31 +00:00
ad
06aeb1d344 - Remove the LWP counters. The race between park/unpark rarely occurs
so it's not worth counting.

- lwp_wakeup: set LW_UNPARKED on the target. Ensures that _lwp_park will
  always be awoken even if another system call eats the wakeup, e.g. as a
  result of an intervening signal. To deal with this correctly for other
  system calls will require a different approach.

- _lwp_unpark, _lwp_unpark_all: use setrunnable if the LWP is not parked
  on the same sync queue: (1) simplifies the code a bit as there no point
  doing anything special for this case (2) makes it possible for p_smutex
  to be replaced by p_mutex and (3) restores the guarantee that the 'hint'
  argument really is just a hint.
2007-03-14 23:58:24 +00:00
yamt
b84c74b2d4 sys__lwp_park: whitespace. no functional change. 2007-03-14 23:07:27 +00:00
yamt
b1b0d0db04 sys__lwp_park: don't restart on signals. PR/35969 from Andrew Doran. 2007-03-14 23:00:32 +00:00
dyoung
3cd3acad77 Exclude some files that replicate NetBSD typedefs and #defines. 2007-03-14 17:20:22 +00:00
ad
19ae9745a3 Don't call pipe_init if PIPE_SOCKETPAIR is defined. 2007-03-13 17:23:49 +00:00
ad
883bea1471 Revert previous now that simplelock.h has been fixed. 2007-03-13 15:59:47 +00:00
dogcow
592f917095 now that simple_lock is a define elsewhere as well, #undef it in the
regress case.
2007-03-13 13:25:57 +00:00
thorpej
217c6e4c0e Return EEXIST if attempting to install a RAS that is already installed. 2007-03-13 04:44:06 +00:00
ad
a240617e8c msgctl1: fix a lock leak. 2007-03-13 03:43:54 +00:00
ad
1c7c7fe356 Sync with kern_proc.c: make p2->p_rasmutex a spin mutex at IPL_SCHED. 2007-03-13 00:35:44 +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
ad
194273271b Use mutexes/condvars. 2007-03-12 21:33:07 +00:00
ad
c81da4c01d Put a lock around pipe->pipe_peer. 2007-03-12 21:31:03 +00:00
ad
b171797731 Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-12 19:05:05 +00:00
ad
59d979c5f1 Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-12 18:18:22 +00:00
ad
3fcdeca2cc Use mutexes. 2007-03-12 16:42:14 +00:00
ad
7888016cf9 Use mutexes & condvars. 2007-03-12 16:20:53 +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
a3128f66df Adjust previous: move the release of specificdata after the very last
file system operation.
2007-03-11 23:40:58 +00:00
ad
1bf149ba4c exit1: destroy the proc/lwp specificdata after calling uvm_proc_exit, as
file systems can still be using it.
2007-03-11 23:19:49 +00:00
ad
f96f2e2a7f Add the LWP's runtime to kinfo_lwp. 2007-03-11 21:38:38 +00:00
ad
9a92ddadc8 Put back mtsleep() temporarily. Converting everything over to condvars
at once will take too much time..
2007-03-11 21:36:48 +00:00
dsl
6d1bab1af3 Split the work for sys_stat, sys_lstat, sys_fstat and sys_fhstat out into
separate functions that don't do the copyout.
This allows all the compat_xxx versions to convert the 'struct stat' to
the correct format without using the 'stackgap'.
The stackgap isn't at all LWP friendly, and needs to be removed from
any compat functions that might involve threads (inc. clone()).
The code is still binary compatible with existing LKMs.
2007-03-10 16:50:01 +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
64e54fbb70 lockdebug:
- Initialize on the first allocation.
- Handle overflow better. PR kern/35723.
2007-03-10 15:56:21 +00:00
ad
ba01c7d177 qc_init: don't leave pointers to destroyed pools hanging or we will
allocate from them later.
2007-03-10 15:54:14 +00:00
matt
770557b66a If STACKALIGN is defined, use it instead of ALIGN. Some arches need a
stack more aligned that ALIGN will give.
2007-03-09 22:25:56 +00:00
ad
c147748d84 - Make the proclist_lock a mutex. The write:read ratio is unfavourable,
and mutexes are cheaper use than RW locks.
- LOCK_ASSERT -> KASSERT in some places.
- Hold proclist_lock/kernel_lock longer in a couple of places.
2007-03-09 14:11:22 +00:00
ad
50a8df5d23 mutex_onproc: remove unnecessary memory barriers. 2007-03-09 14:08:26 +00:00
yamt
fd1a6294d1 fileassoc_table_lookup: call fileassoc_init if it has not been done yet.
fixes crashes sys_unlink when there are no users of fileassoc.
2007-03-09 05:51:50 +00:00
yamt
27515959ec fix typos in comments. 2007-03-09 05:00:26 +00:00
ad
7caf5b2025 trace_enter, trace_exit: acquire kernel_lock for systrace. 2007-03-08 21:25:27 +00:00
drochner
c29d907bea use char* for the kernel representation of the user profile buffer
address too, for consistency
(we've lost some abstraction here)
2007-03-06 16:16:02 +00:00
drochner
5f590e753e regen 2007-03-06 16:10:17 +00:00
drochner
067e5852ea make the first argument to profil(2) char*, for consistency with <unistd.h> 2007-03-06 16:09:21 +00:00
drochner
7767c569f2 Make the attach functions for real and pseudo devices share as much code
as possible. For that, split out a function which does the allocation
of a softc (without linking it into global structures) and a function
which inserts the device into the global alldevs lists and the per-driver
cd_devs.
There is a little semantic change involved: the pseudo-device code didn't
interpret FSTATE_STAR as such, for no good reason. This looks harmless;
I'll modify driver frontends as I find ways to test.
Get config_makeroom() out of the public namespace - that's clearly an
internal of autoconf which drivers can't be allowed to deal with.
2007-03-05 20:32:43 +00:00