Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Jan 2015 16:23:12 +0100
From:      Hans Petter Selasky <hps@selasky.org>
To:        Ian Lepore <ian@freebsd.org>
Cc:        kott <kmatpral@yahoo.com>, freebsd-usb@freebsd.org
Subject:   Re: usb_pc_cpu_flush
Message-ID:  <54B689E0.7040005@selasky.org>
In-Reply-To: <1421247832.14601.258.camel@freebsd.org>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?54B689E0.7040005>