21 Jan, 2009

2 commits

  • When doing large allocations (larger than the per-device coherent area)
    the generic memory allocators are silently fallen back on regardless of
    consideration for the per-device constraints.

    In the DMA_MEMORY_EXCLUSIVE case falling back on generic memory is not
    an option, as it tends not to be addressable by the DMA hardware in
    question. This issue showed up with the 8139too breakage on the
    Dreamcast, where non-addressable buffers were silently allocated due to
    the size mismatch calculation -- while it should have simply errored out
    upon being unable to satisfy the allocation with the given device
    constraints.

    This restores fall back behaviour to what it was before the oversized
    request change caused multiple regressions.

    Signed-off-by: Paul Mundt

    Paul Mundt
     
  • Commit 58c6d3dfe436eb8cfb451981d8fdc9044eaf42da ("dma-coherent: catch
    oversized requests to dma_alloc_from_coherent()") attempted to add a
    sanity check to bail out on allocations larger than the coherent area.

    Unfortunately when this was implemented, the fact the coherent area
    is tracked in pages rather than bytes was overlooked, which subsequently
    broke every single dma_alloc_from_coherent() user, forcing the allocation
    silently through generic memory instead.

    Signed-off-by: Adrian McMenamin
    Signed-off-by: Paul Mundt

    Adrian McMenamin
     

07 Jan, 2009

3 commits

  • Prevent passing an order to bitmap_find_free_region() that is larger than
    the actual bitmap can represent.

    These requests can come from device drivers that have no idea how big the
    dma region is and need to rely on dma_alloc_from_coherent() to sort it out
    for them.

    Reported-by: Guennadi Liakhovetski
    Signed-off-by: Johannes Weiner
    Cc: Pekka Enberg
    Cc: Dmitry Baryshkov
    Cc: Jesse Barnes
    Cc: Tetsuo Handa
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Johannes Weiner
     
  • This thing was rather stupidly coded. Rework it all prior to making
    changes.

    Also, rename local variable `page': kernel readers expect something called
    `page' to have type `struct page *'.

    Cc: Guennadi Liakhovetski
    Cc: Johannes Weiner
    Cc: Pekka Enberg
    Cc: Dmitry Baryshkov
    Cc: Jesse Barnes
    Cc: Tetsuo Handa
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • If bitmap_find_free_region() fails and DMA_MEMORY_EXCLUSIVE is not set,
    the function will fail to write anything to *ret and will return 1. This will cause dma_alloc_coherent() to return an uninitialised value,
    crashing the kernel, perhaps via DMA to a random address.

    Fix that by changing it to return zero in this case, so the caller will
    proceed to allocate the memory from the generic memory allocator.

    Cc: Tetsuo Handa
    Cc: Dmitry Baryshkov
    Cc: Ingo Molnar
    Cc: Johannes Weiner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     

22 Aug, 2008

1 commit


07 Aug, 2008

1 commit


06 Aug, 2008

1 commit

  • get_order() takes byte-sized input, not a page-granular one.

    Irrespective of this fix I'm inclined to believe that this doesn't work
    right anyway - bitmap_allocate_region() has an implicit assumption of
    'pos' being suitable for 'order', which this function doesn't seem to
    enforce (and since it's being called with a byte-granular value there's no
    reason to believe that the callers would make sure device_addr is passed
    accordingly - it's also not documented that way).

    Signed-off-by: Jan Beulich
    Cc: James E.J. Bottomley
    Cc: Ingo Molnar
    Cc: Dmitry Baryshkov
    Cc: Jesse Barnes
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Beulich
     

21 Jul, 2008

1 commit


19 Jul, 2008

1 commit


30 Jun, 2008

1 commit