From owner-svn-src-stable-7@FreeBSD.ORG Mon Mar 7 00:44:00 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EAEAD1065670; Mon, 7 Mar 2011 00:44:00 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC55E8FC12; Mon, 7 Mar 2011 00:44:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p270i0Mr014501; Mon, 7 Mar 2011 00:44:00 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p270i0Y5014498; Mon, 7 Mar 2011 00:44:00 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201103070044.p270i0Y5014498@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 7 Mar 2011 00:44:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r219357 - stable/7/sys/dev/sis X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Mar 2011 00:44:01 -0000 Author: yongari Date: Mon Mar 7 00:44:00 2011 New Revision: 219357 URL: http://svn.freebsd.org/changeset/base/219357 Log: MFC r219102: Make sure changing ownership of RX descriptor to be done as last operation. Previously ownership was transferred to hardware before setting address of new RX buffer such that it was possible for hardware to use wrong RX buffer address. While here keep compiler from re-ordering instructions by declaring descriptor members volatile. Memory barriers would do the same job but volatile is supposed to be cheaper than using memory barriers, especially on MP systems. Submitted by: marius Modified: stable/7/sys/dev/sis/if_sis.c stable/7/sys/dev/sis/if_sisreg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/sis/if_sis.c ============================================================================== --- stable/7/sys/dev/sis/if_sis.c Mon Mar 7 00:42:22 2011 (r219356) +++ stable/7/sys/dev/sis/if_sis.c Mon Mar 7 00:44:00 2011 (r219357) @@ -1568,8 +1568,8 @@ sis_newbuf(struct sis_softc *sc, struct sc->sis_rx_sparemap = map; bus_dmamap_sync(sc->sis_rx_tag, rxd->rx_dmamap, BUS_DMASYNC_PREREAD); rxd->rx_m = m; - rxd->rx_desc->sis_cmdsts = htole32(SIS_RXLEN); rxd->rx_desc->sis_ptr = htole32(SIS_ADDR_LO(segs[0].ds_addr)); + rxd->rx_desc->sis_cmdsts = htole32(SIS_RXLEN); return (0); } Modified: stable/7/sys/dev/sis/if_sisreg.h ============================================================================== --- stable/7/sys/dev/sis/if_sisreg.h Mon Mar 7 00:42:22 2011 (r219356) +++ stable/7/sys/dev/sis/if_sisreg.h Mon Mar 7 00:44:00 2011 (r219357) @@ -337,8 +337,8 @@ struct sis_desc { /* SiS hardware descriptor section */ uint32_t sis_next; - uint32_t sis_cmdsts; - uint32_t sis_ptr; + volatile uint32_t sis_cmdsts; + volatile uint32_t sis_ptr; }; #define SIS_CMDSTS_BUFLEN 0x00000FFF