From owner-svn-src-head@FreeBSD.ORG Thu Dec 27 16:34:42 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 027D3A44; Thu, 27 Dec 2012 16:34:42 +0000 (UTC) (envelope-from freebsd@damnhippie.dyndns.org) Received: from duck.symmetricom.us (duck.symmetricom.us [206.168.13.214]) by mx1.freebsd.org (Postfix) with ESMTP id ED8EA8FC13; Thu, 27 Dec 2012 16:34:28 +0000 (UTC) Received: from damnhippie.dyndns.org (daffy.symmetricom.us [206.168.13.218]) by duck.symmetricom.us (8.14.5/8.14.5) with ESMTP id qBRGYRhK028013; Thu, 27 Dec 2012 09:34:28 -0700 (MST) (envelope-from freebsd@damnhippie.dyndns.org) Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id qBRGYPus075335; Thu, 27 Dec 2012 09:34:25 -0700 (MST) (envelope-from freebsd@damnhippie.dyndns.org) Subject: Re: svn commit: r244469 - head/sys/arm/arm From: Ian Lepore To: Peter Jeremy In-Reply-To: <20121224211921.GA54928@server.rulingia.com> References: <201212200035.qBK0ZRU0022739@svn.freebsd.org> <20121224211921.GA54928@server.rulingia.com> Content-Type: text/plain; charset="us-ascii" Date: Thu, 27 Dec 2012 09:34:25 -0700 Message-ID: <1356626065.1144.79.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Olivier Houchard X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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, 27 Dec 2012 16:34:42 -0000 On Tue, 2012-12-25 at 08:19 +1100, Peter Jeremy wrote: > On 2012-Dec-20 00:35:27 +0000, Olivier Houchard wrote: > >Author: cognet > >Date: Thu Dec 20 00:35:26 2012 > >New Revision: 244469 > >URL: http://svnweb.freebsd.org/changeset/base/244469 > > > >Log: > > Use the new allocator in bus_dmamem_alloc(). > > > >Modified: > > head/sys/arm/arm/busdma_machdep-v6.c > > Do you have any plans to make similar changes to the other busdma_machdep.c > files? > I wrote that allocator code to address some specific needs of architectures that use software-assisted cache coherency rather than hardware bus snooping. On such platforms, the bus_dmamem_alloc() implementations treat BUS_DMA_COHERENT as a request for uncacheable memory, and some drivers have come to rely on that for correct operation. (The concept is valid, overloading BUS_DMA_COHERENT to have different meanings on different platforms, maybe not so much so.) The old code on arm had the side effect of making an entire page uncacheable if any small dma buffer got allocated within that page. That was bad for performance, but it worked. When armv6 came along that caused problems with ldrex/strex instructions, which will fault if they operate on uncacheable memory. So the main thrust of the allocation changes was to make it easy to efficiently allocate small(-ish) dma buffers from a pool of pages that have caching turned off, without accidentally affecting memory that isn't being used for dma buffers. A nice secondary benefit is that they help eliminate partial cacheline flushes, because the allocator ensures that all dma buffers are aligned and padded to cacheline boundaries. So any busdma implementation that has similar needs can benefit from the new allocator code. I was thinking MIPS would be a good candidate, but I've only glanced at the mips code and noted its superficial similarity to the arm code. -- Ian