[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF6AEGsfC-BM2DvFn457pMhE-b_Mr5O4RgaP5WVO78QwRBe-5g@mail.gmail.com>
Date: Fri, 2 Mar 2012 15:26:16 -0600
From: Rob Clark <rob.clark@...aro.org>
To: Daniel Vetter <daniel.vetter@...ll.ch>
Cc: linaro-mm-sig@...ts.linaro.org,
LKML <linux-kernel@...r.kernel.org>,
DRI Development <dri-devel@...ts.freedesktop.org>,
linux-media@...r.kernel.org
Subject: Re: [PATCH 1/3] dma-buf: don't hold the mutex around map/unmap calls
On Thu, Mar 1, 2012 at 9:35 AM, Daniel Vetter <daniel.vetter@...ll.ch> wrote:
> The mutex protects the attachment list and hence needs to be held
> around the callbakc to the exporters (optional) attach/detach
> functions.
>
> Holding the mutex around the map/unmap calls doesn't protect any
> dma_buf state. Exporters need to properly protect any of their own
> state anyway (to protect against calls from their own interfaces).
> So this only makes the locking messier (and lockdep easier to anger).
>
> Therefore let's just drop this.
>
> Signed-off-by: Daniel Vetter <daniel.vetter@...ll.ch>
Reviewed-by: Rob Clark <rob.clark@...aro.org>
> ---
> drivers/base/dma-buf.c | 4 ----
> include/linux/dma-buf.h | 2 +-
> 2 files changed, 1 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/base/dma-buf.c b/drivers/base/dma-buf.c
> index e38ad24..1b11192 100644
> --- a/drivers/base/dma-buf.c
> +++ b/drivers/base/dma-buf.c
> @@ -258,10 +258,8 @@ struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach,
> if (WARN_ON(!attach || !attach->dmabuf || !attach->dmabuf->ops))
> return ERR_PTR(-EINVAL);
>
> - mutex_lock(&attach->dmabuf->lock);
> if (attach->dmabuf->ops->map_dma_buf)
> sg_table = attach->dmabuf->ops->map_dma_buf(attach, direction);
> - mutex_unlock(&attach->dmabuf->lock);
>
> return sg_table;
> }
> @@ -282,10 +280,8 @@ void dma_buf_unmap_attachment(struct dma_buf_attachment *attach,
> || !attach->dmabuf->ops))
> return;
>
> - mutex_lock(&attach->dmabuf->lock);
> if (attach->dmabuf->ops->unmap_dma_buf)
> attach->dmabuf->ops->unmap_dma_buf(attach, sg_table);
> - mutex_unlock(&attach->dmabuf->lock);
>
> }
> EXPORT_SYMBOL_GPL(dma_buf_unmap_attachment);
> diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
> index f8ac076..f7ad2ca 100644
> --- a/include/linux/dma-buf.h
> +++ b/include/linux/dma-buf.h
> @@ -86,7 +86,7 @@ struct dma_buf {
> struct file *file;
> struct list_head attachments;
> const struct dma_buf_ops *ops;
> - /* mutex to serialize list manipulation and other ops */
> + /* mutex to serialize list manipulation and attach/detach */
> struct mutex lock;
> void *priv;
> };
> --
> 1.7.7.5
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@...ts.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists