Re: [PATCH v3] media: vb2: Allow reqbufs(0) with "in use" MMAP buffers

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

 



On Thu, Nov 15, 2018 at 11:29:35AM +0100, Hans Verkuil wrote:
> On 11/14/18 20:59, Laurent Pinchart wrote:
> > Hi Philipp,
> > 
> > Thank you for the patch.
> > 
> > On Wednesday, 14 November 2018 17:04:49 EET Philipp Zabel wrote:
> >> From: John Sheu <sheu@xxxxxxxxxxxx>
> >>
> >> Videobuf2 presently does not allow VIDIOC_REQBUFS to destroy outstanding
> >> buffers if the queue is of type V4L2_MEMORY_MMAP, and if the buffers are
> >> considered "in use".  This is different behavior than for other memory
> >> types and prevents us from deallocating buffers in following two cases:
> >>
> >> 1) There are outstanding mmap()ed views on the buffer. However even if
> >>    we put the buffer in reqbufs(0), there will be remaining references,
> >>    due to vma .open/close() adjusting vb2 buffer refcount appropriately.
> >>    This means that the buffer will be in fact freed only when the last
> >>    mmap()ed view is unmapped.
> > 
> > While I agree that we should remove this restriction, it has helped me in the 
> > past to find missing munmap() in userspace. This patch thus has the potential 
> > of causing memory leaks in userspace. Is there a way we could assist 
> > application developers with this ?
> 
> Should we just keep the debug message? (rephrased of course)
> 
> That way you can enable debugging and see that this happens.
> 
> It sounds reasonable to me.

Makes sense IMO.

-- 
Sakari Ailus
e-mail: sakari.ailus@xxxxxx



[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