From owner-svn-src-all@FreeBSD.ORG Fri May 30 15:34:00 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C545AEE6; Fri, 30 May 2014 15:34:00 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9ABA021FF; Fri, 30 May 2014 15:34:00 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 8C580B963; Fri, 30 May 2014 11:33:59 -0400 (EDT) From: John Baldwin To: attilio@freebsd.org Subject: Re: svn commit: r266775 - head/sys/x86/x86 Date: Fri, 30 May 2014 11:03:11 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; ) References: <201405272131.s4RLVBEU035321@svn.freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201405301103.11980.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 30 May 2014 11:33:59 -0400 (EDT) Cc: "src-committers@freebsd.org" , Benno Rice , "svn-src-all@freebsd.org" , Scott Long , "svn-src-head@freebsd.org" , "Peel, Casey" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 May 2014 15:34:00 -0000 On Friday, May 30, 2014 10:54:06 am Attilio Rao wrote: > On Tue, May 27, 2014 at 11:31 PM, Scott Long wrote: > > Author: scottl > > Date: Tue May 27 21:31:11 2014 > > New Revision: 266775 > > URL: http://svnweb.freebsd.org/changeset/base/266775 > > > > Log: > > Eliminate the fake contig_dmamap and replace it with a new flag, > > BUS_DMA_KMEM_ALLOC. They serve the same purpose, but using the flag > > means that the map can be NULL again, which in turn enables significant > > optimizations for the common case of no bouncing. > > While I think this is in general a good idea, unfortunately our > drivers do so many dumb things when freeing DMA allocated buffers that > having a NULL map is going to cause some "turbolence" and make such > bugs more visible. > An example is with ATA, where I think this fix is needed: > http://www.freebsd.org/~attilio/dmamem_free-ata.patch > > Otherwise, what can happen with bounce buffers, is that the allocated > memory via contig malloc was not going to be freed anytime. > > I tried to look around and I found questionable (read broken) code in > basically every driver which allocates DMA buffers, so I really don't > feel I want to fix the majority of our drivers. I just think such > paths are not excercised enough to be seen in practice often or the > bugs just get unnoticed. Eh, many maps for static allocations were already NULL and have been for a long time. This is nothign new. Plus, the diff you posted has a bug regardless of explicitly destroying a map created by bus_dmamem_alloc(). -- John Baldwin