Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Issue awge(4) on NetBSD/CubieBoard2



Hi,

(i'm on this mailing list.)

I found an issue of awge(4) on NetBSD/CubieBoard2.
When TX ring is almost full, ``map'' (L858) has the valid DMA map,
and overrided (L869) and destroyed (L870) by bus_dma(9).
After this, tx_intr do bus_dmamap_sync(9) and panic.

I have attached the temporary fix to just avoid kernel panic.

Before: https://twitter.com/cvsync/status/545781495898451968
 After: https://twitter.com/cvsync/status/546531923342798848 (works fine)

Some bugs seems to be there. (esp. heavey load cases).

Taken from sys/dev/ic/dwc_gmac.c (rev.1.29)
857:        first = sc->sc_txq.t_cur;
858:        map = sc->sc_txq.t_data[first].td_map;
859:        flags = 0;
860:
861:        error = bus_dmamap_load_mbuf(sc->sc_dmat, map, m0,
862:            BUS_DMA_WRITE|BUS_DMA_NOWAIT);
863:        if (error != 0) {
864:                aprint_error_dev(sc->sc_dev, "could not map mbuf "
865:                    "(len: %d, error %d)\n", m0->m_pkthdr.len, error);
866:                return error;
867:        }
868:
869:        if (sc->sc_txq.t_queued + map->dm_nsegs >= AWGE_TX_RING_COUNT - 1) {
870:                bus_dmamap_unload(sc->sc_dmat, map);
871:                return ENOBUFS;
872:        }

Best regards,

MAEKAWA Masahide @ M-Systems, Inc.
-- GitHub : https://github.com/cvsync
-- Use the Source, Luke
Index: dwc_gmac.c
===================================================================
RCS file: /cvs/cvsroot/src/sys/dev/ic/dwc_gmac.c,v
retrieving revision 1.29
diff -u -r1.29 dwc_gmac.c
--- dwc_gmac.c	7 Dec 2014 02:23:14 -0000	1.29
+++ dwc_gmac.c	21 Dec 2014 05:16:27 -0000
@@ -856,6 +856,13 @@
 
 	first = sc->sc_txq.t_cur;
 	map = sc->sc_txq.t_data[first].td_map;
+	if (map->dm_mapsize != 0) {
+#ifdef DWC_GMAC_DEBUG
+		/* TX ring is exhausted */
+		aprint_error_dev(sc->sc_dev, "TX ring is full!!!\n");
+#endif
+		return ENOBUFS;
+	}
 	flags = 0;
 
 	error = bus_dmamap_load_mbuf(sc->sc_dmat, map, m0,


Home | Main Index | Thread Index | Old Index