usb_pc_cpu_flush

Hans Petter Selasky hps at selasky.org
Wed Jan 14 15:22:27 UTC 2015


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


More information about the freebsd-usb mailing list