Commit Graph

32 Commits

Author SHA1 Message Date
cl 8edffb7356 Avoid race condition where an LWP is put into the cache before
its state is saved:
- don't sa_putcachelwp() in sa_vp_repossess/sa_vp_donate
- only defer saving the event LWP's state
- sa_putcachelwp() after the interrupted LWP's state is saved
2003-10-31 23:36:50 +00:00
cl 8904362ede Allow defer of event and interrupted LWP state independently.
Removes code duplication in sa_upcall_getstate() and allows
sa_upcall_getstate() to be used to get state of a single LWP.
2003-10-31 22:47:44 +00:00
cl def5d22a63 Don't PHOLD() in sa_putcachelwp() because the scheduler lock is held.
PHOLD() before grabbing the scheduler lock unless the lwp is curlwp.
2003-10-31 22:03:18 +00:00
simonb b6abb6ab1d Remove some assigned-to but otherwise unused variables. 2003-10-30 01:58:17 +00:00
yamt 01de53d5f4 don't assume the order of upcall stacks in the array from userland.
(it's reversed in the case of topdown vm.)

kern/23266 from Kouichirou Hiratsuka and tested by him.
2003-10-25 12:08:45 +00:00
yamt a526db13df sa_unblockyield:
don't assert that syscall arguments are sane.
return an appropriate error instead.
2003-10-24 16:11:21 +00:00
wiz 48f28cea9e sa_vp_faultaddr, sa_vp_ofaultaddr, sa_vp_stacks_low, and sa_vp_stacks_high
are vaddr_t (and thus unsigned long).
Initialize them with 0 instead of NULL.
Closes PR 23204 by Dheeraj Reddy.
2003-10-20 07:15:26 +00:00
cl 1453f2ca48 make sa_vp_donate update p_nrlwps when it retires an LWP 2003-10-01 14:50:06 +00:00
cl 52a920b5da add comments to the pagefault code 2003-09-16 15:28:45 +00:00
cl c08e54b26b fix SA/pthread pagefault failure:
- prevent BLOCKED upcalls on double page faults and during upcalls
- make libpthread handle blocked threads which hold locks
- prevent UNBLOCKED upcalls from overtaking their BLOCKED upcall
this adds a new syscall sa_unblockyield
see also http://mail-index.netbsd.org/tech-kern/2003/09/15/0020.html
2003-09-16 13:46:24 +00:00
cl 96b4f15141 KNF and use f instead of s to temporarily save l_flag 2003-09-11 01:32:09 +00:00
cl f8a1f76075 fix timerupcall breakage after SA_SIGINFO changes:
- sa_upcall only stores a pointer to the `arg'
2003-09-09 15:16:30 +00:00
yamt 611b0b9f15 don't use a space char in wmesg.
it makes outputs of SIGINFO confusing.
2003-08-20 13:54:48 +00:00
fvdl 8655b27bf5 SA fixes from Stephan Uphoff. Quoting him:
The patch below (hopefully) improves some signaling problems
found by Nathan.

It also contains some cleanup of the sa_upcall_userret() function
removing any sleep calls using PCATCH.

Unblocked threads now only use an upcall stack after they
acquire the virtual CPU.
This prevents unblocked threads from stealing all available
upcall stacks.


Tested by Nick Hudson.
2003-08-11 21:18:18 +00:00
nathanw f0dee7380d KNF a bit. 2003-07-21 19:21:12 +00:00
fvdl 091ff13b7b Move nstacks assertion and stack assignment to an earlier time, before
the sa_vp_repossess call. From Stephan Uphoff.
2003-07-17 20:34:41 +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
nathanw 998110e1d0 Put the tsleep() call in sa_yield() inside a while loop that tests
whether there is anything to do - almost as if it were a predicate
test outside of a condition wait. This prevents returning to userland
when tsleep() has woken up spuriously, such as from a signal that was
caught and then removed by a tracing process.

Kills off some double-stops in GDB due to signals as well as a couple
of pthread__idle assertions when detaching from a process.

XXX stopping inside tsleep, via CURSIG(), is evil.
2003-05-28 22:17:20 +00:00
kristerw 7941ff4225 Use 0 instead of NULL for size parameters. 2003-05-21 17:57:21 +00:00
nathanw f7905a50d4 Clear L_SA duting sa_upcall_userret(); faults encountered while
reporting an upcall are not of interest and just cause trouble.
2003-05-19 21:02:31 +00:00
tsutsui d6458621a3 Fix too many arguments for format warning in #ifdef DIAGNOSTIC part
detected by gcc-3.x.
2003-02-22 12:42:28 +00:00
skrll e8f64a20cb typo in comment. 2003-02-21 16:30:48 +00:00
nathanw a87506d477 Note yet another SMP danger spot. 2003-02-17 23:32:33 +00:00
nathanw 49f53e20ea Make sa_yieldcall also allocate a new LWP for the cache if it's empty.
(XXX sa_yieldcall() and sa_switchcall() should be combined and take
arg as the function to call, but I'm somewhat nervous about void *
vs. void (*)()).
2003-02-14 20:45:12 +00:00
nathanw 158b157b2a Move stack allocation in case 1 of sa_switch() to after the
sau == NULL check, to avoid a stack leak in the error case.

Spotted by enami.
2003-02-11 00:03:47 +00:00
nathanw 695bc028ab Since sadata_upcall_alloc(1) can sleep, call it before checking the
supply of stacks, to avoid a race. Problem pointed out by Lars
Heidieker on current-users.
2003-02-10 19:02:52 +00:00
briggs c17a890fc8 Fix DIAGNOSTIC printf format. 2003-02-05 15:38:14 +00:00
jdolecek f02bf3cc39 add XXX coment to sadata_upcall_alloc() noting this might need to zero memory
use 'l' for sa_yield() tsleep call; sa->sa_idle == l there
add DIAGNOSTIC printf on one more place in sa_upcall_userret() where
we kill process with SIGILL
2003-02-04 15:54:26 +00:00
nathanw 6722952b21 In sa_yield(), sleep on a p->p_sa->sa_idle instead of just p, to avoid
being woken up by the the reaper when a child process is cleaned up
(SIGCHLD will still cause this to run, and threads actually waiting
for the child will still see the wakeup, of course).

Should fix various spurious wakeups that manifest as assertion
failures in pthread__idle().
2003-02-03 23:31:42 +00:00
thorpej b193480908 Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant.  Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
2003-02-01 06:23:35 +00:00
scw 34db3d4652 Cast integer to pointer via intptr_t. 2003-01-19 12:59:59 +00:00
thorpej e0d8d366df Merge the nathanw_sa branch. 2003-01-18 10:06:22 +00:00