Re: [RFC PATCH 8/9] exynos/s3c/s5p: drop VB2_USERPTR

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

 



Hi Hans,

On 21.02.2020 12:54, Hans Verkuil wrote:
> On 2/21/20 9:53 AM, Tomasz Figa wrote:
>> Hi Hans,
>>
>> On Fri, Feb 21, 2020 at 5:46 PM Hans Verkuil <hverkuil-cisco@xxxxxxxxx> wrote:
>>> The combination of VB2_USERPTR and dma-contig makes no sense for
>>> these devices, drop it.
>> Even though I personally don't like user pointers, I believe at least
>> some of those devices are fine with USERPTR in case they are behind an
>> IOMMU, like on the newer Exynos SoCs. +Marek Szyprowski too.
> I would like this to be tested. I always wonder if that has actually
> been tested, especially with regards to the partial first and last pages of
> the malloc()ed memory. I.e., worst case only 8 bytes may have to be written
> to a page if malloc() aligned the pointer poorly. Can the DMA handle that,
> even with an IOMMU?

Frankly, we never used USERPTR to access malloc()'ed memory, although it 
was possible with IOMMU and I remember I tested such case. USERPTR mode 
was mainly used to access buffers allocated and mmaped from different 
devices. In such case the alignment was already correct. Yes, this can 
be replaced with DMABUF, but that required a lots of changes in 
userspace libs/apps and using USERPTR was much simpler.

Afair the video devices had very capable DMA and they were able to 
transfer data to 8-byte aligned buffers. There was however a problem 
with CPU cache line size - the cache can be reliably managed only 
down-to cache line-size units, what means that some freshly modified by 
the CPU data before and after the buffer might be trashed if it was not 
aligned to CPU cache line size.

I won't cry much after that hack...

> Note that I have the same concern for VB2_USERPTR with dma-sg.
>
> This was a good opportunity to improve v4l2-compliance: it adds sentinels at
> the start/end of the buffer, and it checks that those sentinels are never
> overwritten. So if this test passes for a driver, then VB2_USERPTR can stay
> in, but it should probably have a comment that it has been tested with
> v4l2-compliance.
>
>> What makes you believe it makes no sense for them?
> Serious doubts that this has been properly tested :-)
> You really need a test like I wrote today for v4l2-compliance
> in order to be certain that it works.

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux