Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/x86 Fix a bug that an interrupt mask is "un"mas...



details:   https://anonhg.NetBSD.org/src/rev/b7c57a5a2993
branches:  trunk
changeset: 339037:b7c57a5a2993
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Jun 23 10:00:13 2015 +0000

description:
Fix a bug that an interrupt mask is "un"masked in intr_"dis"establish_xcall().
It's not intended.
 - If there is no any handler,
   1) do delroute because it has no any source and
   2) dont' hwunmask to prevent spurious interrupt.
 - If there is any handler,
   1) don't delroute because it has source and
   2) do hwunmask to be able to get interrupt again.

diffstat:

 sys/arch/x86/x86/intr.c |  18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diffs (39 lines):

diff -r 2ac1889497eb -r b7c57a5a2993 sys/arch/x86/x86/intr.c
--- a/sys/arch/x86/x86/intr.c   Tue Jun 23 06:28:29 2015 +0000
+++ b/sys/arch/x86/x86/intr.c   Tue Jun 23 10:00:13 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intr.c,v 1.85 2015/05/15 08:36:41 knakahara Exp $      */
+/*     $NetBSD: intr.c,v 1.86 2015/06/23 10:00:13 msaitoh Exp $        */
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.85 2015/05/15 08:36:41 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.86 2015/06/23 10:00:13 msaitoh Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -1096,8 +1096,18 @@
        *p = q->ih_next;
 
        intr_calculatemasks(ci);
-       (*pic->pic_delroute)(pic, ci, ih->ih_pin, idtvec, source->is_type);
-       (*pic->pic_hwunmask)(pic, ih->ih_pin);
+       /*
+        * If there is no any handler, 1) do delroute because it has no
+        * any source and 2) dont' hwunmask to prevent spurious interrupt.
+        *
+        * If there is any handler, 1) don't delroute because it has source
+        * and 2) do hwunmask to be able to get interrupt again.
+        *
+        */
+       if (source->is_handlers == NULL)
+               (*pic->pic_delroute)(pic, ci, ih->ih_pin, idtvec, source->is_type);
+       else
+               (*pic->pic_hwunmask)(pic, ih->ih_pin);
 
        /* Re-enable interrupts. */
        x86_write_psl(psl);



Home | Main Index | Thread Index | Old Index