Commit Graph

8 Commits

Author SHA1 Message Date
christos 7ef7e1b997 disable PTHREAD_CONCURRENCY until the bugs are fixed. 2009-03-06 14:00:40 +00:00
ad dd1969c253 PR kern/40730 any user can crash the system with KERN_SA
Disable SA. It can be re-enabled with sysctl -w kern.no_sa_support=0.
2009-03-02 22:11:28 +00:00
wrstuden ab61b53b27 Adjust the sleeps in lwpcache and lwpublk. Make them uninterruptable
for now. This will prevent signals from waking them. Adjust
exit_lwps() to explicitly add LW_SINTR to all of them, so that
the process exit code can wake them up.

This is needed as threads in both of these wait channels die once
they are woken. So they aren't interruptable in the typical sense.

I am now able to suspend & resume firefox successfully now.
2008-11-01 05:59:33 +00:00
wrstuden 04ca26c586 Tweak change to move SA support from userret() to lwp_userret().
1) Since we want to check for upcalls only once, take LW_SA_UPCALL
out of the while(l->l_flags & LW_USERRET) loop.

2) since the goal is to keep SA code out of userret() (and especially
all the emulations that include userret() but will never do SA),
ALWAYS set LW_SA_UPCALL when we set SAVP_FLAG_NOUPCALLS. Drop the
test for it in lwp_userret() since it will never be set bare.

3) Adapt sa_upcall_userret() to clear LW_SA_UPCALL if it's no longer
needed. If we have gained upcalls since sa_yield(), we will deliver
them next time around.

Tested by skrll at.
2008-10-28 22:11:36 +00:00
wrstuden 1698883b6a Ok. Some calls to sa_upcall() pass in an 'l' that is not the current
lwp. Our "no-upcall" flagging however accesses l_pflag, and so we
can't access l->l_pflag. So access curlwp for the no-upcall-blocking
part.
2008-10-27 16:52:04 +00:00
wrstuden 27724c38ae Adjust locking on the sadata::sa_vps list. The main time we
walk the list, we're looking for a vp to do something with. We do
this in the signal code and in the timer code. The signal code already
runs with proc::p_lock held, so it's a very natural lock to use. The
timer code, however, calls into the sa timer code with a spinlock held.
Since proc::p_lock is an adaptable mutex, we can sleep to get it. Sleeping
with a spinlock is BAD. So proc::p_lock is _not_ the right lock there,
and something like sadata::sa_mutex would be best.

Address this difficulty by noting that both uses actually just read
the list. Changing the list of VPs is rare - once one's added, it stays
until the process ends. So make the locking protocol that to write the
list you have to hold both proc::p_lock and sadata::sa_mutex (taken
in that order). Thus holding either one individually grants read access.

This removes a case where we could sleep with timer_lock, a spinlock at
IPL_SCHED (!!), while trying to get p_lock. If that ever happened, we'd
pretty much be dead. So don't do that!

This fixes a merge botch from how I handled our gaining p_lock - p_lock
should not have simply replaced p_smutex.

While here, tweak the sa_unblock_userret() code for the case
when the blessed vp is actually running (on another CPU). Make its
resched RESCHED_IMMED so we whack the CPU. Addresses a hang I've
observed in starting firefox on occasion when I see one thread running
in userland and another thread sitting in lwpublk, which means it's on
the list of threads for which we need an unblocked upcall. This list is
one on which things should NOT linger.
2008-10-16 18:21:45 +00:00
cegger 968d25010f build fix: get prototype for membar_producer() 2008-10-15 10:05:07 +00:00
wrstuden fc7511b00e Merge wrstuden-revivesa into HEAD. 2008-10-15 06:51:17 +00:00