From eccb255f50aed629be44c089281eb0db406c8ad3 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sat, 29 Jan 2011 13:56:00 -0800 Subject: [PATCH] kernel - Run emergency interrupt handlers in critical section * Handlers run from the emergency interrupt polling thread (kern.emergency_intr_enable=1) are now run inside a critical section, just like the normal interrupt thread runs its handlers. * This may or may not help stability issues reported when emergency interrupt polling is enabled. --- sys/kern/kern_intr.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index a6828970be..31860a1cc1 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -927,7 +927,7 @@ ithread_handler(void *arg) break; } } - /* not reached */ + /* NOT REACHED */ } /* @@ -948,14 +948,15 @@ ithread_handler(void *arg) static void ithread_emergency(void *arg __unused) { + globaldata_t gd = mycpu; struct intr_info *info; intrec_t rec, nrec; int intr; - thread_t td __debugvar = curthread; TD_INVARIANTS_DECLARE; get_mplock(); - TD_INVARIANTS_GET(td); + crit_enter_gd(gd); + TD_INVARIANTS_GET(gd->gd_curthread); for (;;) { for (intr = 0; intr < max_installed_hard_intr; ++intr) { @@ -970,13 +971,14 @@ ithread_emergency(void *arg __unused) } else { rec->handler(rec->argument, NULL); } - TD_INVARIANTS_TEST(td, rec->name); + TD_INVARIANTS_TEST(gd->gd_curthread, rec->name); } } } - lwkt_deschedule_self(curthread); + lwkt_deschedule_self(gd->gd_curthread); lwkt_switch(); } + /* NOT REACHED */ } /* -- 2.41.0