From owner-freebsd-current@FreeBSD.ORG Wed Jan 11 17:18:49 2012 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB994106566C; Wed, 11 Jan 2012 17:18:49 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id D5D108FC16; Wed, 11 Jan 2012 17:18:48 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id TAA20760; Wed, 11 Jan 2012 19:18:47 +0200 (EET) (envelope-from avg@FreeBSD.org) Message-ID: <4F0DC476.8050509@FreeBSD.org> Date: Wed, 11 Jan 2012 19:18:46 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20111109 Thunderbird/8.0 MIME-Version: 1.0 To: John Baldwin References: <4F0C9D14.60705@FreeBSD.org> <201201111001.04724.jhb@freebsd.org> In-Reply-To: <201201111001.04724.jhb@freebsd.org> X-Enigmail-Version: undefined Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-current@FreeBSD.org Subject: Re: bus dma: a flag/quirk for page zero X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 17:18:49 -0000 on 11/01/2012 17:01 John Baldwin said the following: > I think this is fine, but you should just always exclude page zero when allocating > bounce pages. Bounce pages are assigned to zones that can be shared by multiple > tags, so other tags that map to the same zone can alloc bounce pages that ohci > will use (add_bounce_page() should probably take the bounce zone as an arg instead > of a tag). I think it's not worth creating a separate zone just for ohci, but > to forbid page zero from all zones instead. Thank you for the explanation. Actually, I think that on x86 we don't have to do anything special for any memory allocations that we do, including the bounce pages, as the page zero is excluded from phys_avail and is not available for normal use. The only thing we have to do on x86 is to bounce the page zero if it gets passed to us. (And that can happen only in very special situations, obviously. I am not sure if anything besides the system dump would do that.) And I would prefer to defer any changes to !x86 bus dma to the respective platform maintainers, obviously ;-) > Also, please change this: > > - if (newtag->lowaddr < ptoa((vm_paddr_t)Maxmem) > - || newtag->alignment > 1) > + if (newtag->lowaddr < ptoa((vm_paddr_t)Maxmem) || > + newtag->alignment > 1) > + newtag->flags |= BUS_DMA_COULD_BOUNCE; > + > + if ((newtag->flags & BUS_DMA_NO_PAGEZERO) != 0) > newtag->flags |= BUS_DMA_COULD_BOUNCE; > > To just be one if. Will do. -- Andriy Gapon