[lkml]   [2011]   [Jul]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectAllocating buffers for USB transfers (again)
    I have to revisit an issue we've discussed in length around a year ago
    and which still remains unsolved. I've been getting feedback from more
    users of my driver snd-usb-caiaq who report the issue found in bug
    #15580 in the kernel bugzilla:

    Let me quickly summarize the current state of this issue as I see it.

    The problem seems to be that certain 64bit chipsets can't deal with
    the fact that an URB's transfer_buffer is allocated with
    kmalloc(GFP_KERNEL). The effect is that kmalloc() is very likely to
    hand out memory which is not addressable by devices that are connected
    via 32bit PCI busses, such as EHCI controllers. In theory, DMA bounce
    buffers should be installed in such cases, or the IOMMU would be in
    charge to re-map these buffers to suitable locations, but for at least
    two people who have reported the issue, this obviously fails.

    So my approach was to force the driver using memory that is DMA
    coherent, which leads to 32bit addressable memory if the device's
    DMA_MASK is set accordingly. Other drivers do the same, and the patch
    for doing this is found here: Users
    that see the bug all report that this patch fixes their problem with
    my driver. However, it was rejected back then as other developers said
    it was fixing the wrong end, and that the driver doesn't necessarily
    need coherent memory.

    Takashi recently posted a patch to the bugzilla entry which uses a
    different approach: it introduces a function to determine suitable GFP
    flags for USB devices, and passes __DMA32 to kmalloc() eventually.
    However, using this flags directly with the SLUB allocator is illegal
    and causes a BUG() in mm/slub.c, cache_grow().

    The question now is how to proceed. I see three possible ways.

    1. Find a way to allocate 32bit-aware memory with kmalloc(), following
    Takashi's idea
    2. Find out exactly why these machines fail to install bounce buffers
    or set up their IOMMU correctly
    3. re-activate the currently disabled functions
    usb_buffer_{map,unmap,sync} functions and let the USB stack do the
    memory mapping

    I'm not really deep into all the memory management code and even less
    into how the IOMMU and bounce buffers work, so I need some help here.
    Can anyone elaborate what would be the best option? I really want to
    get this fixed now, and provide a driver that works for everyone.

    What really puzzles me is that this doesn't hit a lot more people with
    other drivers.


     \ /
      Last update: 2011-07-07 13:57    [W:0.022 / U:0.284 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site