Re: [PATCH 04/12] v4l: vb2-dma-contig: add setup of sglist for MMAP buffers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Laurent, Tomasz,

On 06/10/2012 11:28 PM, Laurent Pinchart wrote:
Hi Tomasz,

On Friday 08 June 2012 16:31:31 Tomasz Stanislawski wrote:
Hi Laurent and Subash,

I confirm the issue found by Subash. The function vb2_dc_kaddr_to_pages does
fail for some occasions. The failures are rather strange like 'got 95 of
150 pages'. It took me some time to find the reason of the problem.

I found that dma_alloc_coherent for iommu an ARM does use ioremap_page_range
to map a buffer to the kernel space. The mapping is done by updating the
page-table.

The problem is that any process has a different first-level page-table. The
ioremap_page_range updates only the table for init process. The PT present
in current->mm shares a majority of entries of 1st-level PT at kernel range
(above 0xc0000000) but *not all*. That is why vb2_dc_kaddr_to_pages worked
for small buffers and occasionally failed for larger buffers.

I found two ways to fix this problem.
a) use&init_mm instead of current->mm while creating an artificial vma
b) access the dma memory by calling
    *((volatile int *)kaddr) = 0;
    before calling follow_pfn
    This way a fault is generated and the PT is
    updated by copying entries from init_mm.

What do you think about presented solutions?

Just to be sure, this is a hack until dma_get_sgtable is available, and it
won't make it to mainline, right ?  In that case using init_mm seem easier.
Although I agree adding a hack for timebeing, why not use the dma_get_sgtable() RFC itself to solve this in clean way? The hacks anyways cannot go into mainline when vb2 patches get merged.

Regards,
Subash

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux