Attempt to fix an interrupt recursion which can occur in specific
authorMatthew Dillon <dillon@dragonflybsd.org>
Mon, 14 Jan 2008 15:27:17 +0000 (15:27 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Mon, 14 Jan 2008 15:27:17 +0000 (15:27 +0000)
commit1be5027b83f0b63a89dcce263f989ee955b3f5d1
tree70fed83cb283c457efb1ca05c75bc0bb9df131ef
parent06c196ceed2f8568b7eaf46f2a759363b6bf2116
Attempt to fix an interrupt recursion which can occur in specific
situations.  The 'slow' interrupt code schedules an interrupt thread
without holding a critical section in an attempt to allow the thread to
preempt the current thread.  If the thread preempts it can re-arm the
interrupt prior to returning and cause an interrupt recursion to occur
before the interrupt code is able to finish doreti, leading to a stack
overflow.

Since we want to preempt we cannot use a critical section to prevent
the recursion.  Instead, use curthread->td_nest_count to prevent
recursive interrupts while the thread is unprotected by a critical
section.  The same condition will now cause successive interrupts to
be queued and then dispatched synchronously by doreti.

Reported-by: "Simon 'corecode' Schubert" <corecode@fs.ei.tum.de>
sys/platform/pc32/apic/apic_vector.s
sys/platform/pc32/icu/icu_vector.s