Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Nov 2010 13:45:14 -0800
From:      Pyun YongHyeon <pyunyh@gmail.com>
To:        M?rcio Luciano Donada <mdonada@auroraalimentos.com.br>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: watchdog
Message-ID:  <20101110214514.GB13340@michelle.cdnetworks.com>
In-Reply-To: <4CD9AA69.7070408@auroraalimentos.com.br>
References:  <4CD92E25.7060304@auroraalimentos.com.br> <20101109192419.GB7766@michelle.cdnetworks.com> <4CD9AA69.7070408@auroraalimentos.com.br>

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

--azLHFNyN32YCQGCU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Tue, Nov 09, 2010 at 06:09:13PM -0200, M?rcio Luciano Donada wrote:
> Em 9/11/2010 17:24, Pyun YongHyeon escreveu:
> > On Tue, Nov 09, 2010 at 09:19:01AM -0200, M?rcio Luciano Donada wrote:
> >> Hi list,
> >>
> >> I'm using FreeBSD (uname is below) and these days I'm caught in the log
> >> message below:
> >>
> >> vpn# uname -a
> >> FreeBSD vpn.auroraalimentos.com.br 7.3-STABLE FreeBSD 7.3-STABLE #0: Sat
> >> Jun 19 18:39:18 BRT 2010
> >> root@vpn.xxx.com.br:/usr/obj/usr/src/sys/VPN  i386
> >>
> >> Nov  8 11:53:55 vpn kernel: xl0: watchdog timeout (missed Tx interrupts)
> >> -- recovering
> >> Nov  8 12:01:21 vpn kernel: xl0: watchdog timeout (missed Tx interrupts)
> >> -- recovering
> >> Nov  8 12:21:55 vpn kernel: xl0: watchdog timeout (missed Tx interrupts)
> >> -- recovering
> >> Nov  8 16:11:34 vpn kernel: xl0: watchdog timeout (missed Tx interrupts)
> >> -- recovering
> >>
> >> it is possible that the network interface (xl0) is in trouble?
> >>
> > 
> > If my memory serve me right there were a couple of reports about
> > xl(4) watchdog timeout in past. The message was added by me to
> > track down possible cause of watchdog timeouts. The message means
> > driver lost Tx completion interrupts but driver noticed that the
> > queued frames were successfully transmitted such that it didn't
> > reset the controller and showed the informational message.
> > 
> > To further narrow down the issue, would you show me the following
> > information?
> >  o full 'dmesg' output
> >  o 'pciconf -lcbv' output
> >  o 'devinfo -rv | grep phy' output
> 
> 
> Hi,
> here's the information you requested:
> 

Thanks for the information.

If there is easy way to reproduce it would you let me know?
I've cleaned up some part of xl(4) which looks wrong to me but I
am not sure whether this can address the issue you reported.
Anyway, would you try attached patch?

--azLHFNyN32YCQGCU
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="xl.watchdog.diff"

Index: sys/dev/xl/if_xl.c
===================================================================
--- sys/dev/xl/if_xl.c	(revision 215102)
+++ sys/dev/xl/if_xl.c	(working copy)
@@ -1872,6 +1872,8 @@
 
 	XL_LOCK_ASSERT(sc);
 
+	bus_dmamap_sync(sc->xl_ldata.xl_rx_tag, sc->xl_ldata.xl_rx_dmamap,
+	    BUS_DMASYNC_POSTREAD);
 	pos = sc->xl_cdata.xl_rx_head;
 
 	for (i = 0; i < XL_RX_LIST_CNT; i++) {
@@ -2227,7 +2229,8 @@
 	}
 #endif
 
-	while ((status = CSR_READ_2(sc, XL_STATUS)) & XL_INTRS &&
+	while (ifp->if_drv_flags & IFF_DRV_RUNNING &&
+	    (status = CSR_READ_2(sc, XL_STATUS)) & XL_INTRS &&
 	    status != 0xFFFF) {
 		CSR_WRITE_2(sc, XL_COMMAND,
 		    XL_CMD_INTR_ACK|(status & XL_INTRS));
@@ -2260,14 +2263,12 @@
 			xl_init_locked(sc);
 		}
 
-		if (status & XL_STAT_STATSOFLOW) {
-			sc->xl_stats_no_timeout = 1;
+		if (status & XL_STAT_STATSOFLOW)
 			xl_stats_update_locked(sc);
-			sc->xl_stats_no_timeout = 0;
-		}
 	}
 
-	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) {
+	if (ifp->if_drv_flags & IFF_DRV_RUNNING &&
+	    !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) {
 		if (sc->xl_type == XL_TYPE_905B)
 			xl_start_90xB_locked(ifp);
 		else
@@ -2331,11 +2332,8 @@
 				xl_init_locked(sc);
 			}
 
-			if (status & XL_STAT_STATSOFLOW) {
-				sc->xl_stats_no_timeout = 1;
+			if (status & XL_STAT_STATSOFLOW)
 				xl_stats_update_locked(sc);
-				sc->xl_stats_no_timeout = 0;
-			}
 		}
 	}
 	return (rx_npkts);
@@ -2349,13 +2347,19 @@
 xl_stats_update(void *xsc)
 {
 	struct xl_softc *sc = xsc;
+	struct mii_data *mii;
 
 	XL_LOCK_ASSERT(sc);
 
-	if (xl_watchdog(sc) == EJUSTRETURN)
-		return;
+	if (sc->xl_miibus != NULL) {
+		mii = device_get_softc(sc->xl_miibus);
+		mii_tick(mii);
+	}
 
 	xl_stats_update_locked(sc);
+
+	xl_watchdog(sc);
+	callout_reset(&sc->xl_stat_callout, hz, xl_stats_update, sc);
 }
 
 static void
@@ -2365,15 +2369,11 @@
 	struct xl_stats		xl_stats;
 	u_int8_t		*p;
 	int			i;
-	struct mii_data		*mii = NULL;
 
 	XL_LOCK_ASSERT(sc);
 
 	bzero((char *)&xl_stats, sizeof(struct xl_stats));
 
-	if (sc->xl_miibus != NULL)
-		mii = device_get_softc(sc->xl_miibus);
-
 	p = (u_int8_t *)&xl_stats;
 
 	/* Read all the stats registers. */
@@ -2395,14 +2395,7 @@
 	 */
 	XL_SEL_WIN(4);
 	CSR_READ_1(sc, XL_W4_BADSSD);
-
-	if ((mii != NULL) && (!sc->xl_stats_no_timeout))
-		mii_tick(mii);
-
 	XL_SEL_WIN(7);
-
-	if (!sc->xl_stats_no_timeout)
-		callout_reset(&sc->xl_stat_callout, hz, xl_stats_update, sc);
 }
 
 /*
@@ -2939,9 +2932,7 @@
 
 	/* Clear out the stats counters. */
 	CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_STATS_DISABLE);
-	sc->xl_stats_no_timeout = 1;
 	xl_stats_update_locked(sc);
-	sc->xl_stats_no_timeout = 0;
 	XL_SEL_WIN(4);
 	CSR_WRITE_2(sc, XL_W4_NET_DIAG, XL_NETDIAG_UPPER_BYTES_ENABLE);
 	CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_STATS_ENABLE);
Index: sys/dev/xl/if_xlreg.h
===================================================================
--- sys/dev/xl/if_xlreg.h	(revision 215102)
+++ sys/dev/xl/if_xlreg.h	(working copy)
@@ -614,7 +614,6 @@
 	u_int32_t		xl_xcvr;
 	u_int16_t		xl_media;
 	u_int16_t		xl_caps;
-	u_int8_t		xl_stats_no_timeout;
 	u_int16_t		xl_tx_thresh;
 	int			xl_pmcap;
 	int			xl_if_flags;

--azLHFNyN32YCQGCU--



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