summaryrefslogtreecommitdiffstats
path: root/sys/x86
diff options
context:
space:
mode:
authorroyger <royger@FreeBSD.org>2015-12-02 10:23:54 +0000
committerroyger <royger@FreeBSD.org>2015-12-02 10:23:54 +0000
commit28836b5874b4d176b3acc6cc8b16bccbe5fff5a6 (patch)
tree1609448a6f5fc763187fb9a151838742e4d567ee /sys/x86
parent90fda359a485dc948c06d33f261406352083d898 (diff)
downloadFreeBSD-src-28836b5874b4d176b3acc6cc8b16bccbe5fff5a6.zip
FreeBSD-src-28836b5874b4d176b3acc6cc8b16bccbe5fff5a6.tar.gz
MFC r291022:
x86/intr: allow mutex recursion in intr_remove_handler Sponsored by: Citrix Systems R&D
Diffstat (limited to 'sys/x86')
-rw-r--r--sys/x86/x86/intr_machdep.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/x86/x86/intr_machdep.c b/sys/x86/x86/intr_machdep.c
index 9a5e463..cc50321 100644
--- a/sys/x86/x86/intr_machdep.c
+++ b/sys/x86/x86/intr_machdep.c
@@ -197,19 +197,28 @@ int
intr_remove_handler(void *cookie)
{
struct intsrc *isrc;
- int error;
+ int error, mtx_owned;
isrc = intr_handler_source(cookie);
error = intr_event_remove_handler(cookie);
if (error == 0) {
- mtx_lock(&intr_table_lock);
+ /*
+ * Recursion is needed here so PICs can remove interrupts
+ * while resuming. It was previously not possible due to
+ * intr_resume holding the intr_table_lock and
+ * intr_remove_handler recursing on it.
+ */
+ mtx_owned = mtx_owned(&intr_table_lock);
+ if (mtx_owned == 0)
+ mtx_lock(&intr_table_lock);
isrc->is_handlers--;
if (isrc->is_handlers == 0) {
isrc->is_pic->pic_disable_source(isrc, PIC_NO_EOI);
isrc->is_pic->pic_disable_intr(isrc);
}
intrcnt_updatename(isrc);
- mtx_unlock(&intr_table_lock);
+ if (mtx_owned == 0)
+ mtx_unlock(&intr_table_lock);
}
return (error);
}
OpenPOWER on IntegriCloud