kernel - Fix very annoying lockup (SMP)
* Fix an extremely annoying lockup that took a week+ to find. The cpusync
code is rather fragile and any for (;;) or while (1) style loops in the
kernel can trip it up and cause a deadlock. These loops are careful to
call lwkt_process_ipiq() to ensure that cpusync processing occurs.
However, there is a race in the LWKT thread migration code where a thread
deschedules itself on one cpu and schedules itself on another via a remote
ipi. The target cpu expects the thread's TDF_RUNNING state to clear and
will loop until that happens.
An IPI could sneak itself into the deschedule/lwkt_switch() path and
deadlock against a cpusync, preventing the thread from leaving the
TDF_RUNNING state.
The solution is to ensure that lwkt_process_ipiq() is *NOT* run in
the lwkt_switch() path if the calling thread has descheduled itself.
* The original bug could be reproduced by running blogbench in one window
and a while (1) ps axl shell script in another.
* Add DEBUG_PUSH_INFO(msg)/DEBUG_POP_INFO() macros which record (msg)
in the globaldata structure as a debugging aid.
* Remove unused platform/pc64/x86_64/systimer.c file. The entire contents
of this file was #ifdef'd out and its functionality is handled elsewhere
by the lapic timer code.
* #if 0 out numerous debugging bits but don't remove the code because it
is extremely useful for finding lockup conditions.
12 files changed: