From owner-freebsd-net@FreeBSD.ORG Sat Jul 3 06:40:24 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D52EB16A4CE; Sat, 3 Jul 2004 06:40:24 +0000 (GMT) Received: from arginine.spc.org (arginine.spc.org [195.206.69.236]) by mx1.FreeBSD.org (Postfix) with ESMTP id 98D6943D66; Sat, 3 Jul 2004 06:40:24 +0000 (GMT) (envelope-from bms@spc.org) Received: from localhost (localhost [127.0.0.1]) by arginine.spc.org (Postfix) with ESMTP id A4768651FA; Sat, 3 Jul 2004 07:40:23 +0100 (BST) Received: from arginine.spc.org ([127.0.0.1]) by localhost (arginine.spc.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 68440-03; Sat, 3 Jul 2004 07:40:23 +0100 (BST) Received: from empiric.dek.spc.org (82-147-17-88.dsl.uk.rapidplay.com [82.147.17.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by arginine.spc.org (Postfix) with ESMTP id C38FA651F7; Sat, 3 Jul 2004 07:40:22 +0100 (BST) Received: by empiric.dek.spc.org (Postfix, from userid 1001) id 3954A614B; Sat, 3 Jul 2004 07:40:22 +0100 (BST) Date: Sat, 3 Jul 2004 07:40:22 +0100 From: Bruce M Simpson To: Andrew Boothman , Doug White Message-ID: <20040703064022.GJ97102@empiric.dek.spc.org> Mail-Followup-To: Andrew Boothman , Doug White , freebsd-net@FreeBSD.org, freebsd-gnats-submit@FreeBSD.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="ZYOWEO2dMm2Af3e3" Content-Disposition: inline cc: freebsd-net@FreeBSD.org cc: freebsd-gnats-submit@FreeBSD.org Subject: Re: kern/62889: Panic in vr(4): interrupt related X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jul 2004 06:40:25 -0000 --ZYOWEO2dMm2Af3e3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Please try the attached patches (broadly inspired by fxp(4)) and let me know if they solve the problem. I am inclined to commit as-is as they are quite trivial, but I'm not sure how the VIA Rhine chips act if we try to detach them as devices without necessarily reading the ISR register to consume an unwanted interrupt. Regards, BMS --ZYOWEO2dMm2Af3e3 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="if_vrreg.h.diff" Index: if_vrreg.h =================================================================== RCS file: /home/ncvs/src/sys/pci/if_vrreg.h,v retrieving revision 1.19 diff -u -p -r1.19 if_vrreg.h --- if_vrreg.h 5 Apr 2004 17:39:57 -0000 1.19 +++ if_vrreg.h 3 Jul 2004 06:39:46 -0000 @@ -468,6 +468,7 @@ struct vr_softc { struct vr_chain_data vr_cdata; struct callout_handle vr_stat_ch; struct mtx vr_mtx; + int suspended; /* if 1, sleeping/detaching */ #ifdef DEVICE_POLLING int rxcycles; #endif --ZYOWEO2dMm2Af3e3 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="if_vr.c.diff" Index: if_vr.c =================================================================== RCS file: /home/ncvs/src/sys/pci/if_vr.c,v retrieving revision 1.89 diff -u -p -r1.89 if_vr.c --- if_vr.c 3 Jul 2004 02:59:02 -0000 1.89 +++ if_vr.c 3 Jul 2004 06:36:48 -0000 @@ -755,6 +755,8 @@ vr_attach(dev) /* Call MI attach routine. */ ether_ifattach(ifp, eaddr); + sc->suspended = 0; + /* Hook interrupt last to avoid having to lock softc */ error = bus_setup_intr(dev, sc->vr_irq, INTR_TYPE_NET | INTR_MPSAFE, vr_intr, sc, &sc->vr_intrhand); @@ -789,6 +791,8 @@ vr_detach(device_t dev) VR_LOCK(sc); + sc->suspended = 1; + /* These should only be active if attach succeeded */ if (device_is_attached(dev)) { vr_stop(sc); @@ -1219,6 +1223,10 @@ vr_intr(void *arg) uint16_t status; VR_LOCK(sc); + if (sc->suspended) { + VR_UNLOCK(sc); + return; + } #ifdef DEVICE_POLLING if (ifp->if_flags & IFF_POLLING) { VR_UNLOCK(sc); --ZYOWEO2dMm2Af3e3--