From owner-svn-src-head@freebsd.org Thu Jul 13 22:12:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7FAADAF079; Thu, 13 Jul 2017 22:12:42 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 84A74663E2; Thu, 13 Jul 2017 22:12:42 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6DMCfCF007005; Thu, 13 Jul 2017 22:12:41 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6DMCfrC007004; Thu, 13 Jul 2017 22:12:41 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201707132212.v6DMCfrC007004@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Thu, 13 Jul 2017 22:12:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320972 - head/sys/dev/ixl X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: head/sys/dev/ixl X-SVN-Commit-Revision: 320972 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 22:12:42 -0000 Author: erj Date: Thu Jul 13 22:12:41 2017 New Revision: 320972 URL: https://svnweb.freebsd.org/changeset/base/320972 Log: ixl(4)/ixlv(4): Stop leaking every busdma entry in receive path From Brett: In short, busdma maps for received packets were not being unloaded in the interrupt handler before the packets were passed up the network stack. The fix was to add a busdma sync and unload for the two receive maps. This bug is significant for certain busdma providers, for example IOMMUs, where not unloading the maps means that 1) the IOMMU mappings that allow the NIC to DMA the received packets into host memory stay open indefinitely, potentially violating a desired security policy, and 2) resources such as device address space addresses and host memory for bookkeeping are never freed. Without an IOMMU or bounce buffering enabled for the ixl device, I don't think adding these calls will have any significant performance impact. With the IOMMU enabled, I have noticed a performance impact on the receive side, which is expected. Submitted by: Brett Gutstein Reviewed by: erj@ MFC after: 1 week Modified: head/sys/dev/ixl/ixl_txrx.c Modified: head/sys/dev/ixl/ixl_txrx.c ============================================================================== --- head/sys/dev/ixl/ixl_txrx.c Thu Jul 13 22:01:38 2017 (r320971) +++ head/sys/dev/ixl/ixl_txrx.c Thu Jul 13 22:12:41 2017 (r320972) @@ -1578,6 +1578,18 @@ ixl_rxeof(struct ixl_queue *que, int count) else vtag = 0; + /* Remove device access to the rx buffers. */ + if (rbuf->m_head != NULL) { + bus_dmamap_sync(rxr->htag, rbuf->hmap, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(rxr->htag, rbuf->hmap); + } + if (rbuf->m_pack != NULL) { + bus_dmamap_sync(rxr->ptag, rbuf->pmap, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(rxr->ptag, rbuf->pmap); + } + /* ** Make sure bad packets are discarded, ** note that only EOP descriptor has valid