浏览代码

drm/qxl: avoid buffer reservation in qxl_crtc_page_flip

This avoid a dependency lock error.
According to https://lwn.net/Articles/548909/ users of WW mutex API
should avoid using different context.
When a buffer is reserved with qxl_bo_reserve a ww_mutex_lock without
context is used. However during qxl_draw_dirty_fb different locks
with specific context are used.
This is detected during a machine booting with a debug kernel with lock
dependency checking enabled.
Like many other function in this file to avoid this problem object
pinning is used. Once the object is pinned is not necessary to keep
the lock so it can be released avoiding the locking problem.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Frediano Ziglio 10 年之前
父节点
当前提交
7eb9974f36
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9 1
      drivers/gpu/drm/qxl/qxl_display.c

+ 9 - 1
drivers/gpu/drm/qxl/qxl_display.c

@@ -242,6 +242,10 @@ static int qxl_crtc_page_flip(struct drm_crtc *crtc,
 	bo->is_primary = true;
 	bo->is_primary = true;
 
 
 	ret = qxl_bo_reserve(bo, false);
 	ret = qxl_bo_reserve(bo, false);
+	if (ret)
+		return ret;
+	ret = qxl_bo_pin(bo, bo->type, NULL);
+	qxl_bo_unreserve(bo);
 	if (ret)
 	if (ret)
 		return ret;
 		return ret;
 
 
@@ -257,7 +261,11 @@ static int qxl_crtc_page_flip(struct drm_crtc *crtc,
 	}
 	}
 	drm_vblank_put(dev, qcrtc->index);
 	drm_vblank_put(dev, qcrtc->index);
 
 
-	qxl_bo_unreserve(bo);
+	ret = qxl_bo_reserve(bo, false);
+	if (!ret) {
+		qxl_bo_unpin(bo);
+		qxl_bo_unreserve(bo);
+	}
 
 
 	return 0;
 	return 0;
 }
 }