From owner-svn-src-all@FreeBSD.ORG Tue Feb 8 01:49:30 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A37E5106566B; Tue, 8 Feb 2011 01:49:30 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 78EC18FC08; Tue, 8 Feb 2011 01:49:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p181nUUv029616; Tue, 8 Feb 2011 01:49:30 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p181nUY8029614; Tue, 8 Feb 2011 01:49:30 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201102080149.p181nUY8029614@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 8 Feb 2011 01:49:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r218427 - head/sys/arm/mv X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Feb 2011 01:49:30 -0000 Author: marcel Date: Tue Feb 8 01:49:30 2011 New Revision: 218427 URL: http://svn.freebsd.org/changeset/base/218427 Log: In arm_get_next_irq(), use the last IRQ argument in order to prevent a hard hang due to an interrupt storm or stuck interrupt pin. We return the next IRQ that is larger than the last one returned and in doing so give all interrupts a fair chance of being handled. Consequently, we're able to break into the kernel debugger in such an event. Modified: head/sys/arm/mv/ic.c Modified: head/sys/arm/mv/ic.c ============================================================================== --- head/sys/arm/mv/ic.c Tue Feb 8 01:43:45 2011 (r218426) +++ head/sys/arm/mv/ic.c Tue Feb 8 01:49:30 2011 (r218427) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -143,27 +144,38 @@ static devclass_t mv_ic_devclass; DRIVER_MODULE(ic, simplebus, mv_ic_driver, mv_ic_devclass, 0, 0); int -arm_get_next_irq(int last __unused) +arm_get_next_irq(int last) { - int irq; + u_int filt, irq; + int next; + filt = ~((last >= 0) ? (2 << last) - 1 : 0); irq = mv_ic_get_cause() & mv_ic_get_mask(); - if (irq) - return (ffs(irq) - 1); - + if (irq & filt) { + next = ffs(irq & filt) - 1; + goto out; + } if (mv_ic_sc->ic_high_regs) { + filt = ~((last >= 32) ? (2 << (last - 32)) - 1 : 0); irq = mv_ic_get_cause_hi() & mv_ic_get_mask_hi(); - if (irq) - return (ffs(irq) + 31); + if (irq & filt) { + next = ffs(irq & filt) + 31; + goto out; + } } - if (mv_ic_sc->ic_error_regs) { + filt = ~((last >= 64) ? (2 << (last - 64)) - 1 : 0); irq = mv_ic_get_cause_error() & mv_ic_get_mask_error(); - if (irq) - return (ffs(irq) + 63); + if (irq & filt) { + next = ffs(irq & filt) + 63; + goto out; + } } + next = -1; - return (-1); + out: + CTR3(KTR_INTR, "%s: last=%d, next=%d", __func__, last, next); + return (next); } static void