From: Subash Patel <subashrp@gmail.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Tomasz Stanislawski <t.stanislaws@samsung.com>,
linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
airlied@redhat.com, m.szyprowski@samsung.com,
kyungmin.park@samsung.com, sumit.semwal@ti.com,
daeinki@gmail.com, daniel.vetter@ffwll.ch, robdclark@gmail.com,
pawel@osciak.com, linaro-mm-sig@lists.linaro.org,
hverkuil@xs4all.nl, remi@remlab.net, mchehab@redhat.com,
g.liakhovetski@gmx.de
Subject: Re: [PATCH 04/12] v4l: vb2-dma-contig: add setup of sglist for MMAP buffers
Date: Mon, 11 Jun 2012 15:38:54 -0700 [thread overview]
Message-ID: <4FD6737E.1040905@gmail.com> (raw)
In-Reply-To: <2352272.JbolkA93P4@avalon>
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
>
next prev parent reply other threads:[~2012-06-11 22:38 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-23 13:07 [PATCH 00/12] Support for dmabuf exporting for videobuf2 Tomasz Stanislawski
2012-05-23 13:07 ` [PATCH 01/12] v4l: vb2-dma-contig: let mmap method to use dma_mmap_coherent call Tomasz Stanislawski
2012-06-06 7:53 ` Laurent Pinchart
2012-05-23 13:07 ` [PATCH 02/12] v4l: add buffer exporting via dmabuf Tomasz Stanislawski
2012-06-06 7:55 ` Laurent Pinchart
2012-05-23 13:07 ` [PATCH 03/12] v4l: vb2: " Tomasz Stanislawski
2012-06-06 7:42 ` Laurent Pinchart
2012-05-23 13:07 ` [PATCH 04/12] v4l: vb2-dma-contig: add setup of sglist for MMAP buffers Tomasz Stanislawski
2012-06-06 8:06 ` Laurent Pinchart
2012-06-06 11:56 ` Tomasz Stanislawski
2012-06-07 0:36 ` Laurent Pinchart
2012-06-07 14:28 ` Subash Patel
2012-06-08 14:31 ` Tomasz Stanislawski
2012-06-11 6:28 ` Laurent Pinchart
2012-06-11 22:38 ` Subash Patel [this message]
2012-05-23 13:07 ` [PATCH 05/12] v4l: vb2-dma-contig: add support for DMABUF exporting Tomasz Stanislawski
2012-05-23 13:07 ` [PATCH 06/12] v4l: vb2-dma-contig: add vmap/kmap for dmabuf exporting Tomasz Stanislawski
2012-05-23 13:07 ` [PATCH 07/12] v4l: s5p-fimc: support " Tomasz Stanislawski
2012-05-23 13:07 ` [PATCH 08/12] v4l: s5p-tv: mixer: " Tomasz Stanislawski
2012-05-23 13:07 ` [PATCH 09/12] v4l: s5p-mfc: " Tomasz Stanislawski
2012-05-23 13:07 ` [PATCH 10/12] v4l: vb2: remove vb2_mmap_pfn_range function Tomasz Stanislawski
2012-05-23 13:07 ` [PATCH 11/12] v4l: vb2-dma-contig: use sg_alloc_table_from_pages function Tomasz Stanislawski
2012-06-06 8:05 ` Laurent Pinchart
2012-05-23 13:07 ` [PATCH 12/12] v4l: vb2-dma-contig: Move allocation of dbuf attachment to attach cb Tomasz Stanislawski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FD6737E.1040905@gmail.com \
--to=subashrp@gmail.com \
--cc=airlied@redhat.com \
--cc=daeinki@gmail.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=g.liakhovetski@gmx.de \
--cc=hverkuil@xs4all.nl \
--cc=kyungmin.park@samsung.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-media@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mchehab@redhat.com \
--cc=pawel@osciak.com \
--cc=remi@remlab.net \
--cc=robdclark@gmail.com \
--cc=sumit.semwal@ti.com \
--cc=t.stanislaws@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).