diff mbox

[2/6] drm/i915: dma_buf_vunmap is presumed not to fail, don't let it

Message ID 1396900911-12415-3-git-send-email-rodrigo.vivi@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Rodrigo Vivi April 7, 2014, 8:01 p.m. UTC
From: Chris Wilson <chris@chris-wilson.co.uk>

Since dma_buf_vunmap() procedes blithely on ignorant of whether the
driver failed to actually unmap the backing storage for the dma-buf, we
need to make a best-effort to do so. This involves not allowing
ourselves to be susceptible to signals causing us to leak the storage.

This should have been detectable with the current i-g-t as a misplaced
signal should have left the pages pinned upon freeing the object where
we have a warning in place.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
---
 drivers/gpu/drm/i915/i915_gem_dmabuf.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Daniel Vetter April 9, 2014, 1:03 p.m. UTC | #1
On Mon, Apr 07, 2014 at 05:01:47PM -0300, Rodrigo Vivi wrote:
> From: Chris Wilson <chris@chris-wilson.co.uk>
> 
> Since dma_buf_vunmap() procedes blithely on ignorant of whether the
> driver failed to actually unmap the backing storage for the dma-buf, we
> need to make a best-effort to do so. This involves not allowing
> ourselves to be susceptible to signals causing us to leak the storage.
> 
> This should have been detectable with the current i-g-t as a misplaced
> signal should have left the pages pinned upon freeing the object where
> we have a warning in place.

Apparently QA is asleep, or have I missed the bugzilla?
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>

Queued for -next, thanks for the patch.
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/i915_gem_dmabuf.c
index 9bb533e..321102a 100644
--- a/drivers/gpu/drm/i915/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/i915_gem_dmabuf.c
@@ -161,12 +161,8 @@  static void i915_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr)
 {
 	struct drm_i915_gem_object *obj = dma_buf_to_obj(dma_buf);
 	struct drm_device *dev = obj->base.dev;
-	int ret;
-
-	ret = i915_mutex_lock_interruptible(dev);
-	if (ret)
-		return;
 
+	mutex_lock(&dev->struct_mutex);
 	if (--obj->vmapping_count == 0) {
 		vunmap(obj->dma_buf_vmapping);
 		obj->dma_buf_vmapping = NULL;