Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Jul 2004 07:40:22 +0100
From:      Bruce M Simpson <bms@spc.org>
To:        Andrew Boothman <andrew@mux.org.uk>, Doug White <dwhite@FreeBSD.org>
Cc:        freebsd-gnats-submit@FreeBSD.org
Subject:   Re: kern/62889: Panic in vr(4): interrupt related
Message-ID:  <20040703064022.GJ97102@empiric.dek.spc.org>

next in thread | raw e-mail | index | archive | help

--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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040703064022.GJ97102>