panic with HEAD

Matthew Dillon dillon at apollo.backplane.com
Wed Dec 14 09:00:53 PST 2005


:with sephe's patch...

    That code path should be properly locked by Sephe's patch.  Double check
    that the whole patch is applied (I've included it below).

					-Matt

Index: dev/netif/wi/if_wi.c
===================================================================
RCS file: /cvs/src/sys/dev/netif/wi/if_wi.c,v
retrieving revision 1.32
diff -u -r1.32 if_wi.c
--- dev/netif/wi/if_wi.c	22 Nov 2005 00:24:34 -0000	1.32
+++ dev/netif/wi/if_wi.c	12 Dec 2005 23:56:16 -0000
@@ -82,6 +82,7 @@
 #include <sys/random.h>
 #include <sys/syslog.h>
 #include <sys/sysctl.h>
+#include <sys/serialize.h>
 #include <sys/thread2.h>
 
 #include <machine/bus.h>
@@ -484,7 +485,8 @@
 
 
 	error = bus_setup_intr(dev, sc->irq, INTR_MPSAFE,
-			       wi_intr, sc, &sc->wi_intrhand, NULL);
+			       wi_intr, sc, &sc->wi_intrhand,
+			       ifp->if_serializer);
 	if (error) {
 		ieee80211_ifdetach(ifp);
 		device_printf(dev, "bus_setup_intr() failed! (%d)\n", error);
@@ -503,9 +505,8 @@
 {
 	struct wi_softc	*sc = device_get_softc(dev);
 	struct ifnet *ifp = &sc->sc_ic.ic_if;
-	WI_LOCK_DECL();
 
-	WI_LOCK(sc);
+	lwkt_serialize_enter(ifp->if_serializer);
 
 	/* check if device was removed */
 	sc->wi_gone |= !bus_child_present(dev);
@@ -514,7 +515,9 @@
 
 	ieee80211_ifdetach(ifp);
 	wi_free(dev);
-	WI_UNLOCK(sc);
+
+	lwkt_serialize_exit(ifp->if_serializer);
+
 	return (0);
 }
 
@@ -522,8 +525,11 @@
 wi_shutdown(device_t dev)
 {
 	struct wi_softc *sc = device_get_softc(dev);
+	struct ifnet *ifp = &sc->sc_if;
 
-	wi_stop(&sc->sc_if, 1);
+	lwkt_serialize_enter(ifp->if_serializer);
+	wi_stop(ifp, 1);
+	lwkt_serialize_exit(ifp->if_serializer);
 }
 
 #ifdef DEVICE_POLLING
@@ -573,7 +579,6 @@
 	struct wi_softc *sc = arg;
 	struct ifnet *ifp = &sc->sc_ic.ic_if;
 	u_int16_t status;
-	WI_LOCK_DECL();
 
 	if (sc->wi_gone || !sc->sc_enabled || (ifp->if_flags & IFF_UP) == 0) {
 		CSR_WRITE_2(sc, WI_INT_EN, 0);
@@ -581,8 +586,6 @@
 		return;
 	}
 
-	WI_LOCK(sc);
-
 	/* Disable interrupts. */
 	CSR_WRITE_2(sc, WI_INT_EN, 0);
 
@@ -603,8 +606,6 @@
 	/* Re-enable interrupts. */
 	CSR_WRITE_2(sc, WI_INT_EN, WI_INTRS);
 
-	WI_UNLOCK(sc);
-
 	return;
 }
 
@@ -617,14 +618,9 @@
 	struct wi_joinreq join;
 	int i;
 	int error = 0, wasenabled;
-	WI_LOCK_DECL();
-
-	WI_LOCK(sc);
 
-	if (sc->wi_gone) {
-		WI_UNLOCK(sc);
+	if (sc->wi_gone)
 		return;
-	}
 
 	if ((wasenabled = sc->sc_enabled))
 		wi_stop(ifp, 1);
@@ -785,15 +781,13 @@
 		if (sc->sc_firmware_type != WI_LUCENT)
 			wi_write_rid(sc, WI_RID_JOIN_REQ, &join, sizeof(join));
 	}
-
-	WI_UNLOCK(sc);
 	return;
 out:
 	if (error) {
 		if_printf(ifp, "interface not running\n");
 		wi_stop(ifp, 1);
 	}
-	WI_UNLOCK(sc);
+
 	DPRINTF((ifp, "wi_init: return %d\n", error));
 	return;
 }
@@ -803,9 +797,6 @@
 {
 	struct ieee80211com *ic = (struct ieee80211com *) ifp;
 	struct wi_softc *sc = ifp->if_softc;
-	WI_LOCK_DECL();
-
-	WI_LOCK(sc);
 
 	DELAY(100000);
 
@@ -830,8 +821,6 @@
 	sc->sc_false_syns = 0;
 	sc->sc_naps = 0;
 	ifp->if_timer = 0;
-
-	WI_UNLOCK(sc);
 }
 
 static void
@@ -844,18 +833,12 @@
 	struct mbuf *m0;
 	struct wi_frame frmhdr;
 	int cur, fid, off, error;
-	WI_LOCK_DECL();
-
-	WI_LOCK(sc);
 
-	if (sc->wi_gone) {
-		WI_UNLOCK(sc);
+	if (sc->wi_gone)
 		return;
-	}
-	if (sc->sc_flags & WI_FLAGS_OUTRANGE) {
-		WI_UNLOCK(sc);
+
+	if (sc->sc_flags & WI_FLAGS_OUTRANGE)
 		return;
-	}
 
 	memset(&frmhdr, 0, sizeof(frmhdr));
 	cur = sc->sc_txnext;
@@ -961,8 +944,6 @@
 		}
 		sc->sc_txnext = cur = (cur + 1) % sc->sc_ntxbuf;
 	}
-
-	WI_UNLOCK(sc);
 }
 
 static int
@@ -1060,9 +1041,6 @@
 	u_int8_t nodename[IEEE80211_NWID_LEN];
 	int error = 0;
 	struct wi_req wreq;
-	WI_LOCK_DECL();
-
-	WI_LOCK(sc);
 
 	if (sc->wi_gone) {
 		error = ENODEV;
@@ -1191,9 +1169,7 @@
 		error = 0;
 	}
 out:
-	WI_UNLOCK(sc);
-
-	return (error);
+	return error;
 }
 
 static int
Index: dev/netif/wi/if_wi_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/netif/wi/if_wi_pci.c,v
retrieving revision 1.7
diff -u -r1.7 if_wi_pci.c
--- dev/netif/wi/if_wi_pci.c	30 Jun 2005 17:11:28 -0000	1.7
+++ dev/netif/wi/if_wi_pci.c	12 Dec 2005 23:56:16 -0000
@@ -48,6 +48,8 @@
 #include <sys/module.h>
 #include <sys/bus.h>
 #include <sys/thread.h>
+#include <sys/serialize.h>
+#include <sys/thread2.h>
 
 #include <machine/bus.h>
 #include <machine/resource.h>
@@ -240,12 +242,15 @@
 {
 	struct wi_softc		*sc;
 	struct ifnet *ifp;
+
 	sc = device_get_softc(dev);
 	ifp = &sc->sc_if;
 
+	lwkt_serialize_enter(ifp->if_serializer);
 	wi_stop(ifp, 1);
+	lwkt_serialize_exit(ifp->if_serializer);
 	
-	return (0);
+	return 0;
 }
 
 static int
@@ -253,11 +258,16 @@
 {
 	struct wi_softc *sc;
 	struct ifnet *ifp;
+
 	sc = device_get_softc(dev);
 	ifp = &sc->sc_if;
 
-	if (sc->wi_bus_type != WI_BUS_PCI_NATIVE)
-		return (0);
+	lwkt_serialize_enter(ifp->if_serializer);
+
+	if (sc->wi_bus_type != WI_BUS_PCI_NATIVE) {
+		lwkt_serialize_exit(ifp->if_serializer);
+		return 0;
+	}
 
 	if (ifp->if_flags & IFF_UP) {
 		ifp->if_init(ifp->if_softc);
@@ -265,5 +275,7 @@
 			ifp->if_start(ifp);
 	}
 
-	return (0);
+	lwkt_serialize_exit(ifp->if_serializer);
+
+	return 0;
 }
Index: dev/netif/wi/if_wivar.h
===================================================================
RCS file: /cvs/src/sys/dev/netif/wi/if_wivar.h,v
retrieving revision 1.8
diff -u -r1.8 if_wivar.h
--- dev/netif/wi/if_wivar.h	30 Jun 2005 15:57:27 -0000	1.8
+++ dev/netif/wi/if_wivar.h	12 Dec 2005 23:56:16 -0000
@@ -209,13 +209,6 @@
 #define	WI_RSSI_TO_DBM(sc, rssi) (MIN((sc)->sc_max_rssi, \
     MAX((sc)->sc_min_rssi, (rssi))) - (sc)->sc_dbm_offset)
 
-/*
- * Various compat hacks/kludges
- */
-#define	WI_LOCK_DECL()
-#define	WI_LOCK(_sc)		crit_enter()
-#define	WI_UNLOCK(_sc)		crit_exit()
-
 int	wi_attach(device_t);
 int	wi_detach(device_t);
 void	wi_shutdown(device_t);





More information about the Bugs mailing list