Re: OMAPFB: CMA allocation failures

From: Tomi Valkeinen
Date: Mon Oct 14 2013 - 02:04:58 EST


Hi,

On 12/10/13 17:43, ÐÐÐÐÐÐ ÐÐÐÐÑÑÐÐ wrote:
> Hi Tomi,
>
> patch http://lists.infradead.org/pipermail/linux-arm-kernel/2012-November/131269.html modifies
> omapfb driver to use DMA API to allocate framebuffer memory instead of preallocating VRAM.
>
> With this patch I see a lot of:
>
> Jan 1 06:33:27 Nokia-N900 kernel: [ 2054.879577] cma: dma_alloc_from_contiguous(cma c05f5844, count 192, align 8)
> Jan 1 06:33:27 Nokia-N900 kernel: [ 2054.914215] cma: dma_alloc_from_contiguous(): memory range at c07df000 is busy, retrying
> Jan 1 06:33:27 Nokia-N900 kernel: [ 2054.933502] cma: dma_alloc_from_contiguous(): memory range at c07e1000 is busy, retrying
> Jan 1 06:33:27 Nokia-N900 kernel: [ 2054.940032] cma: dma_alloc_from_contiguous(): memory range at c07e3000 is busy, retrying
> Jan 1 06:33:27 Nokia-N900 kernel: [ 2054.966644] cma: dma_alloc_from_contiguous(): memory range at c07e5000 is busy, retrying
> Jan 1 06:33:27 Nokia-N900 kernel: [ 2054.976867] cma: dma_alloc_from_contiguous(): memory range at c07e7000 is busy, retrying
> Jan 1 06:33:27 Nokia-N900 kernel: [ 2055.038055] cma: dma_alloc_from_contiguous(): memory range at c07e9000 is busy, retrying
> Jan 1 06:33:27 Nokia-N900 kernel: [ 2055.038116] cma: dma_alloc_from_contiguous(): returned (null)
> Jan 1 06:33:27 Nokia-N900 kernel: [ 2055.038146] omapfb omapfb: failed to allocate framebuffer
>
> errors while trying to play a video on N900 with Maemo 5 (Fremantle) on top of linux-3.12rc1.
> It is deffinitely the CMA that fails to allocate the memory most of the times, but I wonder
> how reliable CMA is to be used in omapfb. I even reserved 64MB for CMA, but that made no
> difference. If CMA is disabled, the memory allocation still fails as obviously it is highly
> unlikely there will be such a big chunk of continuous free memory on RAM limited device like
> N900.
>
> One obvious solution is to just revert the removal of VRAM memory allocator, but that would
> mean I'll have to maintain a separate tree with all the implications that brings.
>
> What would you advise on how to deal with the issue?

I've not seen such errors, and I'm no expert on CMA. But I guess the
contiguous memory area can get fragmented enough no matter how hard one
tries to avoid it. The old VRAM system had the same issue, although it
was quite difficult to hit it.

64MB does sound quite a lot, though. I wonder what other drivers are
using CMA, and how do they manage to allocate so much memory and
fragment it so badly... With double buffering, N900 should only need
something like 3MB for the frame buffer.

With a quick glance I didn't find any debugfs or such files to show
information about the CMA area. It'd be helpful to find out what's going
on there. Or maybe normal allocations are fragmenting the CMA area, but
for some reason they cannot be moved? Just guessing.

There's also dma_declare_contiguous() that could be used to reserve
memory for omapfb. I have not used it, and I have no idea if it would
help here. But it's something you could try.

Tomi


Attachment: signature.asc
Description: OpenPGP digital signature