From 57a1818078bf9021589898333d9352010285fe1c Mon Sep 17 00:00:00 2001 From: miod Date: Tue, 16 Dec 2014 21:29:05 +0000 Subject: [PATCH] Do not grab the kernel lock for clock interrupts, hardclock() will behave correctly without. Modeled after sparc64 logic. --- sys/arch/aviion/aviion/av530_machdep.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/sys/arch/aviion/aviion/av530_machdep.c b/sys/arch/aviion/aviion/av530_machdep.c index 381728da556..8e7e1433a33 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.13 2014/11/16 12:30:56 deraadt Exp $ */ +/* $OpenBSD: av530_machdep.c,v 1.14 2014/12/16 21:29:05 miod Exp $ */ /* * Copyright (c) 2006, 2007, 2010 Miodrag Vallat. * @@ -570,6 +570,9 @@ 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); @@ -613,11 +616,6 @@ av530_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 @@ -706,10 +704,20 @@ 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) + __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 (need_lock) + __mp_unlock(&kernel_lock); +#endif if (ret != 0) { intr->ih_count.ec_count++; break; @@ -760,11 +768,6 @@ av530_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 -- 2.20.1