From owner-freebsd-usb@FreeBSD.ORG Wed Jan 14 15:22:27 2015 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B9B41759; Wed, 14 Jan 2015 15:22:27 +0000 (UTC) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (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 6FEECF25; Wed, 14 Jan 2015 15:22:26 +0000 (UTC) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id F37481FE022; Wed, 14 Jan 2015 16:22:24 +0100 (CET) Message-ID: <54B689E0.7040005@selasky.org> Date: Wed, 14 Jan 2015 16:23:12 +0100 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Ian Lepore Subject: Re: usb_pc_cpu_flush References: <1419359192795-5975583.post@n5.nabble.com> <5499E734.1070507@selasky.org> <1419392511197-5975691.post@n5.nabble.com> <549A811D.3060204@selasky.org> <1419416870924-5975752.post@n5.nabble.com> <1419423740820-5975763.post@n5.nabble.com> <549AB711.8070005@selasky.org> <1419431704871-5975773.post@n5.nabble.com> <549BF430.8000207@selasky.org> <1419877515606-5976832.post@n5.nabble.com> <1421133295061-5980199.post@n5.nabble.com> <1421160576.14601.175.camel@freebsd.org> <54B53956.4090708@selasky.org> <1421163656.14601.184.camel@freebsd.org> <54B54073.6000409@selasky.org> <1421166591.14601.195.camel@freebsd.org> <54B54D4D.3010805@selasky.org> <1421180700.14601.209.camel@freebsd.org> <54B5FAE8.7020705@selasky.org> <1421247832.14601.258.camel@freebsd.org> In-Reply-To: <1421247832.14601.258.camel@freebsd.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: kott , freebsd-usb@freebsd.org X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jan 2015 15:22:27 -0000 On 01/14/15 16:03, Ian Lepore wrote: > If you are allocating the memory using bus_dmamem_alloc() then no, > absolutely not. It's working for you by accident because of the > USB_HOST_ALIGN hacks which I think date back to freebsd 8 or so. > > When I talked to you a couple years ago about doing it the right way, > you were outraged (perhaps rightly so) about the inefficiency involved, > because of things like allocating a 16 byte buffer causing the > allocation of a full page just so that the caching attributes could be > changed. So I fixed that with the busdma zone allocator stuff that > makes it very efficient to allocate many tiny dma buffers (coherent or > not), and when you use buffers allocated that way, the sync operations > code can make some safe assumptions and avoid doing bounces due to > cacheline alignments. > > If buffers were allocated right-sized now that it's efficient to do so, > the USB_HOST_ALIGN hack could go away. Hmm, actually it might be > necessary to start using the busdma zone allocator in mips as well > before undoing the hack. Hi Ian, This sounds good. I'll make a quick patch you can try this week which splits the USB busdma allocations again. It is a quite trivial thing to do. Can you or Kott then test this patch? --HPS