mirror of https://gitee.com/openkylin/linux.git
drm/qxl: fix lockdep issue in qxl_alloc_release_reserved
Call qxl_bo_unpin (which does a reservation) without holding the release_mutex lock. Fixes lockdep (correctly) warning on a possible deadlock. Fixes:e8dd3506dc
("drm/qxl: unpin release objects") Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Link: http://patchwork.freedesktop.org/patch/msgid/20210217123213.2199186-5-kraxel@redhat.com (cherry picked from commit19089b760e
) Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
This commit is contained in:
parent
e8dd3506dc
commit
e998d3c8cb
|
@ -321,7 +321,7 @@ int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size,
|
||||||
int type, struct qxl_release **release,
|
int type, struct qxl_release **release,
|
||||||
struct qxl_bo **rbo)
|
struct qxl_bo **rbo)
|
||||||
{
|
{
|
||||||
struct qxl_bo *bo;
|
struct qxl_bo *bo, *free_bo = NULL;
|
||||||
int idr_ret;
|
int idr_ret;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
union qxl_release_info *info;
|
union qxl_release_info *info;
|
||||||
|
@ -347,8 +347,7 @@ int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size,
|
||||||
|
|
||||||
mutex_lock(&qdev->release_mutex);
|
mutex_lock(&qdev->release_mutex);
|
||||||
if (qdev->current_release_bo_offset[cur_idx] + 1 >= releases_per_bo[cur_idx]) {
|
if (qdev->current_release_bo_offset[cur_idx] + 1 >= releases_per_bo[cur_idx]) {
|
||||||
qxl_bo_unpin(qdev->current_release_bo[cur_idx]);
|
free_bo = qdev->current_release_bo[cur_idx];
|
||||||
qxl_bo_unref(&qdev->current_release_bo[cur_idx]);
|
|
||||||
qdev->current_release_bo_offset[cur_idx] = 0;
|
qdev->current_release_bo_offset[cur_idx] = 0;
|
||||||
qdev->current_release_bo[cur_idx] = NULL;
|
qdev->current_release_bo[cur_idx] = NULL;
|
||||||
}
|
}
|
||||||
|
@ -356,6 +355,10 @@ int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size,
|
||||||
ret = qxl_release_bo_alloc(qdev, &qdev->current_release_bo[cur_idx]);
|
ret = qxl_release_bo_alloc(qdev, &qdev->current_release_bo[cur_idx]);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
mutex_unlock(&qdev->release_mutex);
|
mutex_unlock(&qdev->release_mutex);
|
||||||
|
if (free_bo) {
|
||||||
|
qxl_bo_unpin(free_bo);
|
||||||
|
qxl_bo_unref(&free_bo);
|
||||||
|
}
|
||||||
qxl_release_free(qdev, *release);
|
qxl_release_free(qdev, *release);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -371,6 +374,10 @@ int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size,
|
||||||
*rbo = bo;
|
*rbo = bo;
|
||||||
|
|
||||||
mutex_unlock(&qdev->release_mutex);
|
mutex_unlock(&qdev->release_mutex);
|
||||||
|
if (free_bo) {
|
||||||
|
qxl_bo_unpin(free_bo);
|
||||||
|
qxl_bo_unref(&free_bo);
|
||||||
|
}
|
||||||
|
|
||||||
ret = qxl_release_list_add(*release, bo);
|
ret = qxl_release_list_add(*release, bo);
|
||||||
qxl_bo_unref(&bo);
|
qxl_bo_unref(&bo);
|
||||||
|
|
Loading…
Reference in New Issue