Commit Graph

34 Commits

Author SHA1 Message Date
yamt a0e5478237 lwp_suspend: don't forget to decrement p_nrlwps when suspending ourselves.
fix PR/33287 from Gregory McGarry.
2006-04-26 11:44:39 +00:00
cube 699fe710fb Rework the _lwp* and sa_* families of syscalls so some details can be
handled differently depending on the emulation.  This paves the way for
COMPAT_NETBSD32 support of our pthread system.
2006-03-29 23:02:31 +00:00
chs 6c854a4076 disallow non-SA LWP syscalls for SA processes. they add no value
in this context, only headaches.
2005-11-12 02:28:31 +00:00
yamt d6d16da423 remove a redundant assignment in the previous. 2005-10-05 15:46:00 +00:00
yamt f615d37667 simplify lwp exit code. 2005-10-01 06:12:44 +00:00
yamt 9020ca379a protect p_nrlwps by sched_lock. no objection on tech-kern@. PR/29652. 2005-08-28 14:57:18 +00:00
fvdl 7b10f1cabc Don't panic when lwp_suspend finds an LWP on another CPU, just return
EINVAL for now.
2005-02-12 21:39:00 +00:00
skrll d42dfb7727 Correct arg name in comment. 2004-10-06 08:55:27 +00:00
matt 617ba1df60 In proc_representative_lwp, if there is an outstanding trap signal, return
the lwp that had the trap.
2004-05-12 21:10:09 +00:00
junyoung 103afd6ebf lwp_exit2(): set lwp state to SZOMB at more appropriate point. 2004-03-05 11:17:41 +00:00
yamt 471ef5f249 once exit1() releases big kernel lock, the struct proc can be freed and
re-used by another cpu immediately.  in that case, lwp_exit2() will
access freed memory.  to fix this:

- remove curlwp from p_lwps in exit1() rather than letting lwp_exit2() do so.
- add assertions to ensure freed proc has no lwps.

kern/24329 from me and kern/24574 from Havard Eidnes.
2004-03-02 09:15:26 +00:00
wiz d20841bb64 Uppercase CPU, plural is CPUs. 2004-02-13 11:36:08 +00:00
yamt 1e18e59746 - borrow vmspace0 in uvm_proc_exit instead of uvmspace_free.
the latter is not a appropriate place to do so and it broke vfork.
- deactivate pmap before calling cpu_exit() to keep a balance of
  pmap_activate/deactivate.
2004-02-09 13:11:21 +00:00
yamt fa47baddee lwp_exit2: grab kernel_lock to preserve locking order. 2004-02-09 13:02:48 +00:00
junyoung 48d5030e12 ANSIfy & zap some blank lines. 2004-02-06 08:08:46 +00:00
jdolecek 475a5858bf g/c process state SDEAD - it's not used anymore after 'reaper' removal 2004-01-11 19:39:48 +00:00
jdolecek 089abdad44 Rearrange process exit path to avoid need to free resources from different
process context ('reaper').

From within the exiting process context:
* deactivate pmap and free vmspace while we can still block
* introduce MD cpu_lwp_free() - this cleans all MD-specific context (such
  as FPU state), and is the last potentially blocking operation;
  all of cpu_wait(), and most of cpu_exit(), is now folded into cpu_lwp_free()
* process is now immediatelly marked as zombie and made available for pickup
  by parent; the remaining last lwp continues the exit as fully detached
* MI (rather than MD) code bumps uvmexp.swtch, cpu_exit() is now same
  for both 'process' and 'lwp' exit

uvm_lwp_exit() is modified to never block; the u-area memory is now
always just linked to the list of available u-areas. Introduce (blocking)
uvm_uarea_drain(), which is called to release the excessive u-area memory;
this is called by parent within wait4(), or by pagedaemon on memory shortage.
uvm_uarea_free() is now private function within uvm_glue.c.

MD process/lwp exit code now always calls lwp_exit2() immediatelly after
switching away from the exiting lwp.

g/c now unneeded routines and variables, including the reaper kernel thread
2004-01-04 11:33:29 +00:00
jdolecek 6ea538748e constify a bit 2004-01-03 20:10:01 +00:00
manu 54db0e51ad Split sys_lwp_suspend, just like sys_lwp_unsuspend is split. We get
sys_lwp_suspend, with the sanity checks, and lwp_suspend, with the
actual implementation.
2003-12-24 22:42:11 +00:00
manu b23b73b953 Introduce lwp_emuldata and the associated hooks. No hook is provided for the
exec case, as the emulation already has the ability to intercept that
with the e_proc_exec hook. It is the responsability of the emulation to
take appropriaye action about lwp_emuldata in e_proc_exec.

Patch reviewed by Christos.
2003-12-20 18:22:16 +00:00
dsl 2ffbd2ab99 Remove p_nras from struct proc - use LIST_EMPTY(&p->p_raslist) instead.
Remove p_raslock and rename p_lwplock p_lock (one lock is enough).
Simplify window test when adding a ras and correct test on VM_MAXUSER_ADDRESS.
Avoid unpredictable branch in i386 locore.S
(pad fields left in struct proc to avoid kernel bump)
2003-11-04 10:33:15 +00:00
cl 68a0d153d2 Don't grab the sched lock in lwp_continue() because lwp_continue() is
called from kpsignal2() with the sched lock held.  Get the lock in
sys__lwp_continue() instead.
2003-10-30 23:31:21 +00:00
simonb 59fb31d7cc Remove unreachable break after return and goto statements. 2003-10-19 01:44:48 +00:00
matt 79fccc7527 Improve _lwp_wakeup so when it wakes a thread, the target thread thinks
ltsleep has been interrupted and thus the target will not think it was
a spurious wakeup.  (this makes syscalls cancellable for libpthread).
2003-07-28 23:35:20 +00:00
fvdl 84078486a4 Return the value of 'error' instead of always 0. From Christian Limpach. 2003-07-17 19:05:30 +00:00
fvdl 4bd1a8dcf8 Changes from Stephan Uphoff to patch problems with LWPs blocking when they
shouldn't, and MP.
2003-07-17 18:16:58 +00:00
lukem 09b3191490 add missing __KERNEL_RCSID() 2003-07-14 14:59:01 +00:00
martin d505b18964 Make sure to include opt_foo.h if a defflag option FOO is used. 2003-06-23 11:00:59 +00:00
kristerw 7941ff4225 Use 0 instead of NULL for size parameters. 2003-05-21 17:57:21 +00:00
dsl 9be8ac5294 Alternative pid/proc allocater, removes all searches associated with pid
lookup and allocation, and any dependency on NPROC or MAXUSERS.
NO_PID changed to -1 (and renamed NO_PGID) to remove artificial limit
on PID_MAX.
As discussed on tech-kern.
2003-03-19 11:36:32 +00:00
matt 161af1dd62 Add a KASSERT when copying l1->l_cpu to l2->l_cpu 2003-01-30 05:51:58 +00:00
nathanw d2027d4d00 Fix _lwp_wakeup() so that it stands a chance of working (although it
turns out to be insufficent for signal-level interruption of system
calls. guess we need _lwp_kill(), ugh).
2003-01-29 23:27:54 +00:00
nathanw 892c25bc38 Fix proc_representative_lwp(); a closing brace was in the wrong place,
which means it would return the first non-dead LWP.

Pointed out by Stephan Uphoff.
2003-01-28 02:20:35 +00:00
thorpej e0d8d366df Merge the nathanw_sa branch. 2003-01-18 10:06:22 +00:00