Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 May 2009 21:17:10 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r192478 - in stable/7/sys: . dev/bge
Message-ID:  <200905202117.n4KLHA2o044080@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Wed May 20 21:17:10 2009
New Revision: 192478
URL: http://svn.freebsd.org/changeset/base/192478

Log:
  MFC r192127:
  
  Try to workaround a race where bge_stop() may sneak in when bge_rxeof()
  drops and re-grabs the softc mutex in the middle, resulting in kernel
  trap 12.  This may happen when a lot of traffic is being hammered on
  one bge(4) interface while the system is shutting down.
  
  Reported by:	Alexander Sack <pisymbol gmail com>
  PR:		kern/134548

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/dev/bge/if_bge.c

Modified: stable/7/sys/dev/bge/if_bge.c
==============================================================================
--- stable/7/sys/dev/bge/if_bge.c	Wed May 20 21:13:49 2009	(r192477)
+++ stable/7/sys/dev/bge/if_bge.c	Wed May 20 21:17:10 2009	(r192478)
@@ -3193,6 +3193,9 @@ bge_rxeof(struct bge_softc *sc)
 		BGE_UNLOCK(sc);
 		(*ifp->if_input)(ifp, m);
 		BGE_LOCK(sc);
+
+		if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
+			return;
 	}
 
 	if (stdcnt > 0)
@@ -3301,6 +3304,10 @@ bge_poll(struct ifnet *ifp, enum poll_cm
 
 	sc->rxcycles = count;
 	bge_rxeof(sc);
+	if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
+		BGE_UNLOCK(sc);
+		return;
+	}
 	bge_txeof(sc);
 	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 		bge_start_locked(ifp);
@@ -3370,7 +3377,9 @@ bge_intr(void *xsc)
 	if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
 		/* Check RX return ring producer/consumer. */
 		bge_rxeof(sc);
+	}
 
+	if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
 		/* Check TX ring producer/consumer. */
 		bge_txeof(sc);
 	}



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