From 7bf9d51431bce7e7a56413ba06dade4fcae3352f Mon Sep 17 00:00:00 2001 From: mpi Date: Mon, 22 Jan 2018 09:08:43 +0000 Subject: [PATCH] Always grab the KERNEL_LOCK() for !IPL_MPSAFE handlers. Suggested by kettenis@, ok visa@ --- sys/arch/amd64/amd64/intr.c | 4 ++-- sys/arch/i386/i386/machdep.c | 4 ++-- sys/arch/macppc/dev/openpic.c | 11 +++++------ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/sys/arch/amd64/amd64/intr.c b/sys/arch/amd64/amd64/intr.c index 7d8947fa932..34e132465f0 100644 --- a/sys/arch/amd64/amd64/intr.c +++ b/sys/arch/amd64/amd64/intr.c @@ -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); diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 5f45491a471..4da7cb4e67f 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -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); diff --git a/sys/arch/macppc/dev/openpic.c b/sys/arch/macppc/dev/openpic.c index 70c4c057f73..474a4ba9e79 100644 --- a/sys/arch/macppc/dev/openpic.c +++ b/sys/arch/macppc/dev/openpic.c @@ -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 @@ -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++; -- 2.20.1