DragonFly commits List (threaded) for 2005-07
cvs commit: src/sys/kern kern_shutdown.c
dillon 2005/07/17 19:47:36 PDT
DragonFly src repository
DELAY() is a spin loop, we can't use it any more because shutdown
depends on other threads working. Not only does the syncer and buffer
flusher need to work (else they might get stuck holding a lock on a buffer),
but the scheduler helper threads and device helper threads must also continue
to operate to be able to successfully flush the buffer cache. In addition,
busy looping while holding the BGL can seriously deadlock SMP machines, so
even if it was (sometimes) possible to get away with using DELAY on UP boxes,
it's simply impossible on an SMP box.
So change the DELAY's to tsleep's in the shutdown code. The current thread
is also given a very high priority (higher then an interrupt thread,
in fact), to try to ensure it gets through the shutdown procedure even if
the system is fried. For the moment we do not move the thread to cpu #0.
This puts us in a somewhat awkwar situation when handling panics, but I don't
see that we have much of a choice.
Reported-by: Peter Avalos, David Rhodus, and numerous other people over time.
Revision Changes Path
1.21 +10 -3 src/sys/kern/kern_shutdown.c