Fix vkernel issues - enable ithread preemption, races, and more.
authorMatthew Dillon <dillon@apollo.backplane.com>
Wed, 22 Apr 2009 19:56:37 +0000 (12:56 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Wed, 22 Apr 2009 19:56:37 +0000 (12:56 -0700)
commit6179d4f3f16b482e364e1bd90002e52b7bee9089
treeb5db5dd34f8a626428709f878e398e2da7b9202b
parent82949828d84137a0576569c347cdfa5a22164447
Fix vkernel issues - enable ithread preemption, races, and more.

signalintr() was improperly entering a critical section, preventing
sched_ithd() from being able to preempt the current thread.  Adjust
so the code matches the pc32 code.

lwp0 was being assigned cpu_heavy_switch instead of cpu_lwkt_switch,
which works fine on pc32 but blows up the vkernel if process 0 gets
preempted, because vkernel LWKT processes are not assigned vmspaces.
Properly use cpu_lwkt_switch() to fix the problem.

We were not checking for pending reschedule requests when the
vmspace_ctl() call got interrupted by a signal.  NOTE:  There is
still a race after the check prior to re-entry into vmspace_ctl()
which needs to be closed.

Tracked-down-by: corecode, dillon
sys/kern/init_main.c
sys/platform/vkernel/i386/trap.c
sys/platform/vkernel/platform/machintr.c