1. 17 8月, 2015 1 次提交
    • 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 35 次提交