diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2015-05-18 04:06:38 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2015-05-18 04:06:38 +0000 |
commit | 95b91a3039d87b44bbbab45c768a15d48048aef7 (patch) | |
tree | 40cc52cad448496942dcd236e3b5fde730c788ae | |
parent | b51bd9ad58f3f315ec53d31ff44319d1b094258f (diff) |
Move the logic deciding whether to grab the kernel lock or not, deeper in the
interrupt logic, making sure the lock is not taken for clock interrupts.
Tested on aviion and luna88k.
-rw-r--r-- | sys/arch/aviion/aviion/av400_machdep.c | 20 | ||||
-rw-r--r-- | sys/arch/aviion/aviion/av530_machdep.c | 11 | ||||
-rw-r--r-- | sys/arch/luna88k/luna88k/isr.c | 10 | ||||
-rw-r--r-- | sys/arch/luna88k/luna88k/machdep.c | 13 |
4 files changed, 23 insertions, 31 deletions
diff --git a/sys/arch/aviion/aviion/av400_machdep.c b/sys/arch/aviion/aviion/av400_machdep.c index 10a8702d763..661a9fd82d9 100644 --- a/sys/arch/aviion/aviion/av400_machdep.c +++ b/sys/arch/aviion/aviion/av400_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: av400_machdep.c,v 1.27 2014/11/16 12:30:56 deraadt Exp $ */ +/* $OpenBSD: av400_machdep.c,v 1.28 2015/05/18 04:06:37 miod Exp $ */ /* * Copyright (c) 2006, 2007, Miodrag Vallat. * @@ -646,11 +646,6 @@ av400_intr(struct trapframe *eframe) } #endif -#ifdef MULTIPROCESSOR - if (old_spl < IPL_SCHED) - __mp_lock(&kernel_lock); -#endif - /* * We want to service all interrupts marked in the IST register * They are all valid because the mask would have prevented them @@ -724,10 +719,18 @@ av400_intr(struct trapframe *eframe) */ ret = 0; SLIST_FOREACH(intr, list, ih_link) { +#ifdef MULTIPROCESSOR + if (intr->ih_ipl < IPL_CLOCK) + __mp_lock(&kernel_lock); +#endif if (ISSET(intr->ih_flags, INTR_WANTFRAME)) ret = (*intr->ih_fn)((void *)eframe); else ret = (*intr->ih_fn)(intr->ih_arg); +#ifdef MULTIPROCESSOR + if (intr->ih_ipl < IPL_CLOCK) + __mp_unlock(&kernel_lock); +#endif if (ret != 0) { intr->ih_count.ec_count++; break; @@ -764,11 +767,6 @@ av400_intr(struct trapframe *eframe) problems = 0; #endif -#ifdef MULTIPROCESSOR - if (old_spl < IPL_SCHED) - __mp_unlock(&kernel_lock); -#endif - out: /* * process any remaining data access exceptions before diff --git a/sys/arch/aviion/aviion/av530_machdep.c b/sys/arch/aviion/aviion/av530_machdep.c index a8e7b780b72..10a41461e16 100644 --- a/sys/arch/aviion/aviion/av530_machdep.c +++ b/sys/arch/aviion/aviion/av530_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: av530_machdep.c,v 1.15 2015/04/25 21:15:08 miod Exp $ */ +/* $OpenBSD: av530_machdep.c,v 1.16 2015/05/18 04:06:37 miod Exp $ */ /* * Copyright (c) 2006, 2007, 2010 Miodrag Vallat. * @@ -570,9 +570,6 @@ av530_intr(struct trapframe *eframe) #ifdef DIAGNOSTIC static int problems = 0; #endif -#ifdef MULTIPROCESSOR - int need_lock; -#endif cur_mask = ISR_GET_CURRENT_MASK(cpu); cur_exmask = EXISR_GET_CURRENT_MASK(cpu); @@ -705,9 +702,7 @@ av530_intr(struct trapframe *eframe) ret = 0; SLIST_FOREACH(intr, list, ih_link) { #ifdef MULTIPROCESSOR - need_lock = intr->ih_ipl < IPL_SCHED && - intr->ih_ipl != IPL_CLOCK; - if (need_lock) + if (intr->ih_ipl < IPL_CLOCK) __mp_lock(&kernel_lock); #endif if (ISSET(intr->ih_flags, INTR_WANTFRAME)) @@ -715,7 +710,7 @@ av530_intr(struct trapframe *eframe) else ret = (*intr->ih_fn)(intr->ih_arg); #ifdef MULTIPROCESSOR - if (need_lock) + if (intr->ih_ipl < IPL_CLOCK) __mp_unlock(&kernel_lock); #endif if (ret != 0) { diff --git a/sys/arch/luna88k/luna88k/isr.c b/sys/arch/luna88k/luna88k/isr.c index 3e9fbaf9d57..0a53ed3731a 100644 --- a/sys/arch/luna88k/luna88k/isr.c +++ b/sys/arch/luna88k/luna88k/isr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isr.c,v 1.9 2010/12/21 14:56:24 claudio Exp $ */ +/* $OpenBSD: isr.c,v 1.10 2015/05/18 04:06:37 miod Exp $ */ /* $NetBSD: isr.c,v 1.5 2000/07/09 08:08:20 nisimura Exp $ */ /*- @@ -165,7 +165,15 @@ isrdispatch_autovec(int ipl) /* Give all the handlers a chance. */ LIST_FOREACH(isr, list, isr_link) { +#ifdef MULTIPROCESSOR + if (isr->isr_ipl < IPL_CLOCK) + __mp_lock(&kernel_lock); +#endif rc = (*isr->isr_func)(isr->isr_arg); +#ifdef MULTIPROCESSOR + if (isr->isr_ipl < IPL_CLOCK) + __mp_unlock(&kernel_lock); +#endif if (rc != 0) isr->isr_count.ec_count++; handled |= rc; diff --git a/sys/arch/luna88k/luna88k/machdep.c b/sys/arch/luna88k/luna88k/machdep.c index ba74a8efda5..edf6f9cd92a 100644 --- a/sys/arch/luna88k/luna88k/machdep.c +++ b/sys/arch/luna88k/luna88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.116 2015/02/25 17:41:22 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.117 2015/05/18 04:06:37 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -868,17 +868,8 @@ luna88k_ext_int(struct trapframe *eframe) case 5: case 4: case 3: -#ifdef MULTIPROCESSOR - if (CPU_IS_PRIMARY(ci)) { - if (old_spl < IPL_SCHED) - __mp_lock(&kernel_lock); -#endif + if (CPU_IS_PRIMARY(ci)) isrdispatch_autovec(cur_int_level); -#ifdef MULTIPROCESSOR - if (old_spl < IPL_SCHED) - __mp_unlock(&kernel_lock); - } -#endif break; default: printf("%s: cpu%d level %d interrupt.\n", |