1. 17 8月, 2015 2 次提交
    • J
      [media] mm: Provide new get_vaddr_frames() helper · 8025e5dd
      Jan Kara 提交于
      Provide new function get_vaddr_frames().  This function maps virtual
      addresses from given start and fills given array with page frame numbers of
      the corresponding pages. If given start belongs to a normal vma, the function
      grabs reference to each of the pages to pin them in memory. If start
      belongs to VM_IO | VM_PFNMAP vma, we don't touch page structures. Caller
      must make sure pfns aren't reused for anything else while he is using
      them.
      
      This function is created for various drivers to simplify handling of
      their buffers.
      Signed-off-by: NJan Kara <jack@suse.cz>
      Acked-by: NMel Gorman <mgorman@suse.de>
      Acked-by: NVlastimil Babka <vbabka@suse.cz>
      Acked-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      8025e5dd
    • J
      [media] vb2: Push mmap_sem down to memops · 0f6e2825
      Jan Kara 提交于
      Currently vb2 core acquires mmap_sem just around call to
      __qbuf_userptr(). However since commit f035eb4e (videobuf2: fix
      lockdep warning) it isn't necessary to acquire it so early as we no
      longer have to drop queue mutex before acquiring mmap_sem. So push
      acquisition of mmap_sem down into .get_userptr memop so that the
      semaphore is acquired for a shorter time and it is clearer what it is
      needed for.
      
      Note that we also need mmap_sem in .put_userptr memop since that ends up
      calling vb2_put_vma() which calls vma->vm_ops->close() which should be
      called with mmap_sem held. However we didn't hold mmap_sem in some code
      paths anyway (e.g. when called via vb2_ioctl_reqbufs() ->
      __vb2_queue_free() -> vb2_dma_sg_put_userptr()) and getting mmap_sem in
      put_userptr() introduces a lock inversion with queue->mmap_lock in the
      above mentioned call path.
      
      Luckily this whole locking mess will get resolved once we convert
      videobuf2 core to the new mm helper which avoids the need for mmap_sem
      in .put_userptr memop altogether.
      Signed-off-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      0f6e2825
  2. 16 8月, 2015 4 次提交
  3. 12 8月, 2015 34 次提交