Re: Alignment of disk-I/O from userland.

From: Harti Brandt (brandt_at_fokus.fraunhofer.de)
Date: 10/07/03

  • Next message: Ben Mesander: "Re: Alignment of disk-I/O from userland."
    Date: Tue, 7 Oct 2003 13:04:22 +0200 (CEST)
    To: Jeff Roberson <jroberson@chesapeake.net>
    
    

    On Tue, 7 Oct 2003, Jeff Roberson wrote:

    JR>On Tue, 7 Oct 2003, Harti Brandt wrote:
    JR>
    JR>> On Mon, 6 Oct 2003, Scott Long wrote:
    JR>>
    JR>> SL>buffers and prepare them for transfer to/from hardware. It already
    JR>> SL>understands the concept of alignment, though it only applies it to
    JR>> SL>buffers that it allocates, not buffers that are handed to it. Fixing
    JR>>
    JR>> This seems to be not true. The alignment parameter for the busdma tag is
    JR>> more or less ignored in all backends. With the old malloc code you could
    JR>> simply make sure that the buffer you request is at least the size of
    JR>> alignment you need. With UMA this doesn't work anymore. I bumped into this
    JR>> problem while writing several ATM drivers which need alignment of 16 or 32
    JR>> byte. At the moment the driver does this alignment itself by allocating a
    JR>> large enough dmamem buffer and fiddling with the pointers.
    JR>
    JR>I don't believe that this is the case with UMA. Too many things depended
    JR>on this behavior and so I left it in.

    Well, when UMA went in I suddenly got panics (because I checked the
    alignment via KASSERT() so I added the address twiddeling code. This was
    some time ago, but I remember that a buffer was aligned to half of its
    size. That was when UMA was new, maybe that this was a problem only a
    short time - anyway I did not remove that code just to be on the safe
    side.

    In any case it should make sense to document in malloc(9) that one either
    can or cannot rely on this feature.

    Anyway, even with the guarantee that UMA aligns to at least the size of
    the buffer. bus_dmamem_alloc does not allocate a 256 byte buffer to a 1k
    boundary even if I specify the 1k alignment in the dma tag.

    harti

    -- 
    harti brandt,
    http://www.fokus.fraunhofer.de/research/cc/cats/employees/hartmut.brandt/private
    brandt@fokus.fraunhofer.de, harti@freebsd.org
    _______________________________________________
    freebsd-arch@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-arch
    To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
    

  • Next message: Ben Mesander: "Re: Alignment of disk-I/O from userland."

    Relevant Pages

    • Re: Alignment of disk-I/O from userland.
      ... On Tue, 7 Oct 2003, Harti Brandt wrote: ... > SL>Working around hardware requirements from the block layer gets messy. ... > SL>for hardware that doesn't care about the alignment. ... > large enough dmamem buffer and fiddling with the pointers. ...
      (freebsd-arch)
    • Re: Pointer hell
      ... Alignment requirements are generally referred to as, ... I used a struct like so, which reflected the structure of the data ... char ca; ... because the buffer was obtained from callocand ...
      (comp.lang.c)
    • Re: METHOD_NEITHER and buffer alignment
      ... so if the app allocates a buffer>= page_size it should be aligned as best you need it. ... WdfDeviceSetAlignmentRequirement effects buffer alignment for DMA. ...
      (microsoft.public.development.device.drivers)
    • Re: Pointer hell
      ... Alignment requirements are generally referred to as, ... Some compilers don't bother with this kind of stuff, ... The mis-aligned access causes a trap of some kind, ... because the buffer was obtained from callocand ...
      (comp.lang.c)
    • Re: [RFT] Intel 3945abg wireless driver (wpi)
      ... experimental version of the wpi wireless driver and hence require your ... Does the UMA sub-system reliably work with 4k aligned requests? ... assign dma tags once that chunk is 'trimmed' to an acceptable alignment? ... 4K alignment to works reliably and I've plans to manually do the alignment with the 12k loss in the future. ...
      (freebsd-current)

  • Quantcast