Always grab the KERNEL_LOCK() for !IPL_MPSAFE handlers.
authormpi <mpi@openbsd.org>
Mon, 22 Jan 2018 09:08:43 +0000 (09:08 +0000)
committermpi <mpi@openbsd.org>
Mon, 22 Jan 2018 09:08:43 +0000 (09:08 +0000)
Suggested by kettenis@, ok visa@

sys/arch/amd64/amd64/intr.c
sys/arch/i386/i386/machdep.c
sys/arch/macppc/dev/openpic.c

index 7d8947f..34e1324 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: intr.c,v 1.50 2017/10/14 04:44:43 jsg Exp $   */
+/*     $OpenBSD: intr.c,v 1.51 2018/01/22 09:08:43 mpi Exp $   */
 /*     $NetBSD: intr.c,v 1.3 2003/03/03 22:16:20 fvdl Exp $    */
 
 /*
@@ -519,7 +519,7 @@ intr_handler(struct intrframe *frame, struct intrhand *ih)
        if (ih->ih_flags & IPL_MPSAFE)
                need_lock = 0;
        else
-               need_lock = frame->if_ppl < IPL_SCHED;
+               need_lock = 1;
 
        if (need_lock)
                __mp_lock(&kernel_lock);
index 5f45491..4da7cb4 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: machdep.c,v 1.608 2017/12/30 20:46:59 guenther Exp $  */
+/*     $OpenBSD: machdep.c,v 1.609 2018/01/22 09:08:43 mpi Exp $       */
 /*     $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $    */
 
 /*-
@@ -3938,7 +3938,7 @@ intr_handler(struct intrframe *frame, struct intrhand *ih)
        if (ih->ih_flags & IPL_MPSAFE)
                need_lock = 0;
        else
-               need_lock = frame->if_ppl < IPL_SCHED;
+               need_lock = 1;
 
        if (need_lock)
                __mp_lock(&kernel_lock);
index 70c4c05..474a4ba 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: openpic.c,v 1.84 2017/04/30 16:45:45 mpi Exp $        */
+/*     $OpenBSD: openpic.c,v 1.85 2018/01/22 09:08:43 mpi Exp $        */
 
 /*-
  * Copyright (c) 2008 Dale Rahn <drahn@openbsd.org>
@@ -99,7 +99,7 @@ void  *openpic_intr_establish(void *, int, int, int, int (*)(void *), void *,
 void   openpic_intr_disestablish(void *, void *);
 void   openpic_collect_preconf_intr(void);
 void   openpic_ext_intr(void);
-int    openpic_ext_intr_handler(struct intrhand *, int, int *);
+int    openpic_ext_intr_handler(struct intrhand *, int *);
 
 /* Generic IRQ management routines. */
 void   openpic_gen_acknowledge_irq(int, int);
@@ -658,7 +658,7 @@ openpic_ext_intr(void)
                spurious = 1;
                TAILQ_FOREACH(ih, &iq->iq_list, ih_list) {
                        ppc_intr_enable(1);
-                       ret = openpic_ext_intr_handler(ih, pcpl, &spurious);
+                       ret = openpic_ext_intr_handler(ih, &spurious);
                        (void)ppc_intr_disable();
                        if (intr_shared_edge == 00 && ret == 1)
                                break;
@@ -679,7 +679,7 @@ openpic_ext_intr(void)
 }
 
 int
-openpic_ext_intr_handler(struct intrhand *ih, int pcpl, int *spurious)
+openpic_ext_intr_handler(struct intrhand *ih, int *spurious)
 {
        int ret;
 #ifdef MULTIPROCESSOR
@@ -688,12 +688,11 @@ openpic_ext_intr_handler(struct intrhand *ih, int pcpl, int *spurious)
        if (ih->ih_flags & IPL_MPSAFE)
                need_lock = 0;
        else
-               need_lock = pcpl < IPL_SCHED;
+               need_lock = 1;
 
        if (need_lock)
                KERNEL_LOCK();
 #endif
-
        ret = (*ih->ih_fun)(ih->ih_arg);
        if (ret) {
                ih->ih_count.ec_count++;