]> Git Repo - linux.git/commitdiff
drm/i915: unpin backing storage in dmabuf_unmap
authorDaniel Vetter <[email protected]>
Thu, 8 Aug 2013 07:10:37 +0000 (09:10 +0200)
committerDave Airlie <[email protected]>
Mon, 19 Aug 2013 03:24:54 +0000 (13:24 +1000)
This fixes a WARN in i915_gem_free_object when the
obj->pages_pin_count isn't 0.

v2: Add locking to unmap, noticed by Chris Wilson. Note that even
though we call unmap with our own dev->struct_mutex held that won't
result in an immediate deadlock since we never go through the dma_buf
interfaces for our own, reimported buffers. But it's still easy to
blow up and anger lockdep, but that's already the case with our ->map
implementation. Fixing this for real will involve per dma-buf ww mutex
locking by the callers. And lots of fun. So go with the duct-tape
approach for now.

Cc: Chris Wilson <[email protected]>
Reported-by: Maarten Lankhorst <[email protected]>
Cc: Maarten Lankhorst <[email protected]>
Tested-by: Armin K. <[email protected]> (v1)
Tested-by: Dave Airlie <[email protected]>
Acked-by: Maarten Lankhorst <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
drivers/gpu/drm/i915/i915_gem_dmabuf.c

index dc53a527126b0569800ff2df3a8a36ebbf904855..9e6578330801638caeb91e7f92e8e0139660eb6f 100644 (file)
@@ -85,9 +85,17 @@ static void i915_gem_unmap_dma_buf(struct dma_buf_attachment *attachment,
                                   struct sg_table *sg,
                                   enum dma_data_direction dir)
 {
+       struct drm_i915_gem_object *obj = attachment->dmabuf->priv;
+
+       mutex_lock(&obj->base.dev->struct_mutex);
+
        dma_unmap_sg(attachment->dev, sg->sgl, sg->nents, dir);
        sg_free_table(sg);
        kfree(sg);
+
+       i915_gem_object_unpin_pages(obj);
+
+       mutex_unlock(&obj->base.dev->struct_mutex);
 }
 
 static void i915_gem_dmabuf_release(struct dma_buf *dma_buf)
This page took 0.052099 seconds and 4 git commands to generate.