Message ID | 20230406160637.541702-2-dmitry.osipenko@collabora.com |
---|---|
State | Superseded |
Headers | show |
Series | Move dma-buf mmap() reservation locking down to exporters | expand |
On 06/04/2023 18:06, Dmitry Osipenko wrote: > Don't assert held dma-buf reservation lock on memory mapping of exported > buffer. > > We're going to change dma-buf mmap() locking policy such that exporters > will have to handle the lock. The previous locking policy caused deadlock > problem for DRM drivers in a case of self-imported dma-bufs once these > drivers are moved to use reservation lock universally. The problem is > solved by moving the lock down to exporters. This patch prepares videobuf2 > for the locking policy update. > > Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> > Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Regards, Hans > --- > drivers/media/common/videobuf2/videobuf2-dma-contig.c | 3 --- > drivers/media/common/videobuf2/videobuf2-dma-sg.c | 3 --- > drivers/media/common/videobuf2/videobuf2-vmalloc.c | 3 --- > 3 files changed, 9 deletions(-) > > diff --git a/drivers/media/common/videobuf2/videobuf2-dma-contig.c b/drivers/media/common/videobuf2/videobuf2-dma-contig.c > index 205d3cac425c..2fa455d4a048 100644 > --- a/drivers/media/common/videobuf2/videobuf2-dma-contig.c > +++ b/drivers/media/common/videobuf2/videobuf2-dma-contig.c > @@ -11,7 +11,6 @@ > */ > > #include <linux/dma-buf.h> > -#include <linux/dma-resv.h> > #include <linux/module.h> > #include <linux/refcount.h> > #include <linux/scatterlist.h> > @@ -456,8 +455,6 @@ static int vb2_dc_dmabuf_ops_vmap(struct dma_buf *dbuf, struct iosys_map *map) > static int vb2_dc_dmabuf_ops_mmap(struct dma_buf *dbuf, > struct vm_area_struct *vma) > { > - dma_resv_assert_held(dbuf->resv); > - > return vb2_dc_mmap(dbuf->priv, vma); > } > > diff --git a/drivers/media/common/videobuf2/videobuf2-dma-sg.c b/drivers/media/common/videobuf2/videobuf2-dma-sg.c > index 183037fb1273..28f3fdfe23a2 100644 > --- a/drivers/media/common/videobuf2/videobuf2-dma-sg.c > +++ b/drivers/media/common/videobuf2/videobuf2-dma-sg.c > @@ -10,7 +10,6 @@ > * the Free Software Foundation. > */ > > -#include <linux/dma-resv.h> > #include <linux/module.h> > #include <linux/mm.h> > #include <linux/refcount.h> > @@ -498,8 +497,6 @@ static int vb2_dma_sg_dmabuf_ops_vmap(struct dma_buf *dbuf, > static int vb2_dma_sg_dmabuf_ops_mmap(struct dma_buf *dbuf, > struct vm_area_struct *vma) > { > - dma_resv_assert_held(dbuf->resv); > - > return vb2_dma_sg_mmap(dbuf->priv, vma); > } > > diff --git a/drivers/media/common/videobuf2/videobuf2-vmalloc.c b/drivers/media/common/videobuf2/videobuf2-vmalloc.c > index a6c6d2fcaaa4..7c635e292106 100644 > --- a/drivers/media/common/videobuf2/videobuf2-vmalloc.c > +++ b/drivers/media/common/videobuf2/videobuf2-vmalloc.c > @@ -10,7 +10,6 @@ > * the Free Software Foundation. > */ > > -#include <linux/dma-resv.h> > #include <linux/io.h> > #include <linux/module.h> > #include <linux/mm.h> > @@ -319,8 +318,6 @@ static int vb2_vmalloc_dmabuf_ops_vmap(struct dma_buf *dbuf, > static int vb2_vmalloc_dmabuf_ops_mmap(struct dma_buf *dbuf, > struct vm_area_struct *vma) > { > - dma_resv_assert_held(dbuf->resv); > - > return vb2_vmalloc_mmap(dbuf->priv, vma); > } >
diff --git a/drivers/media/common/videobuf2/videobuf2-dma-contig.c b/drivers/media/common/videobuf2/videobuf2-dma-contig.c index 205d3cac425c..2fa455d4a048 100644 --- a/drivers/media/common/videobuf2/videobuf2-dma-contig.c +++ b/drivers/media/common/videobuf2/videobuf2-dma-contig.c @@ -11,7 +11,6 @@ */ #include <linux/dma-buf.h> -#include <linux/dma-resv.h> #include <linux/module.h> #include <linux/refcount.h> #include <linux/scatterlist.h> @@ -456,8 +455,6 @@ static int vb2_dc_dmabuf_ops_vmap(struct dma_buf *dbuf, struct iosys_map *map) static int vb2_dc_dmabuf_ops_mmap(struct dma_buf *dbuf, struct vm_area_struct *vma) { - dma_resv_assert_held(dbuf->resv); - return vb2_dc_mmap(dbuf->priv, vma); } diff --git a/drivers/media/common/videobuf2/videobuf2-dma-sg.c b/drivers/media/common/videobuf2/videobuf2-dma-sg.c index 183037fb1273..28f3fdfe23a2 100644 --- a/drivers/media/common/videobuf2/videobuf2-dma-sg.c +++ b/drivers/media/common/videobuf2/videobuf2-dma-sg.c @@ -10,7 +10,6 @@ * the Free Software Foundation. */ -#include <linux/dma-resv.h> #include <linux/module.h> #include <linux/mm.h> #include <linux/refcount.h> @@ -498,8 +497,6 @@ static int vb2_dma_sg_dmabuf_ops_vmap(struct dma_buf *dbuf, static int vb2_dma_sg_dmabuf_ops_mmap(struct dma_buf *dbuf, struct vm_area_struct *vma) { - dma_resv_assert_held(dbuf->resv); - return vb2_dma_sg_mmap(dbuf->priv, vma); } diff --git a/drivers/media/common/videobuf2/videobuf2-vmalloc.c b/drivers/media/common/videobuf2/videobuf2-vmalloc.c index a6c6d2fcaaa4..7c635e292106 100644 --- a/drivers/media/common/videobuf2/videobuf2-vmalloc.c +++ b/drivers/media/common/videobuf2/videobuf2-vmalloc.c @@ -10,7 +10,6 @@ * the Free Software Foundation. */ -#include <linux/dma-resv.h> #include <linux/io.h> #include <linux/module.h> #include <linux/mm.h> @@ -319,8 +318,6 @@ static int vb2_vmalloc_dmabuf_ops_vmap(struct dma_buf *dbuf, static int vb2_vmalloc_dmabuf_ops_mmap(struct dma_buf *dbuf, struct vm_area_struct *vma) { - dma_resv_assert_held(dbuf->resv); - return vb2_vmalloc_mmap(dbuf->priv, vma); }