diff options
author | Jeremy Cline <jcline@redhat.com> | 2018-06-01 16:05:32 -0400 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2018-06-04 03:31:39 -0400 |
commit | 889ad63d41eea20184b0483e7e585e5b20fb6cfe (patch) | |
tree | 3ba6dd6621a23c7f944c1e134ac7ab021da32d07 | |
parent | c32048d9e93a5ab925d745396c63e7b912147f0a (diff) |
drm/qxl: Call qxl_bo_unref outside atomic context
"qxl_bo_unref" may sleep, but calling "qxl_release_map" causes
"preempt_disable()" to be called and "preempt_enable()" isn't called
until "qxl_release_unmap" is used. Move the call to "qxl_bo_unref" out
from in between the two to avoid sleeping from an atomic context.
This issue can be demonstrated on a kernel with CONFIG_LOCKDEP=y by
creating a VM using QXL, using a desktop environment using Xorg, then
moving the cursor on or off a window.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1571128
Fixes: 9428088c90b6 ("drm/qxl: reapply cursor after resetting primary")
Cc: stable@vger.kernel.org
Signed-off-by: Jeremy Cline <jcline@redhat.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20180601200532.13619-1-jcline@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r-- | drivers/gpu/drm/qxl/qxl_display.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c index ecb35ed0eac8..61e51516fec5 100644 --- a/drivers/gpu/drm/qxl/qxl_display.c +++ b/drivers/gpu/drm/qxl/qxl_display.c | |||
@@ -630,7 +630,7 @@ static void qxl_cursor_atomic_update(struct drm_plane *plane, | |||
630 | struct qxl_cursor_cmd *cmd; | 630 | struct qxl_cursor_cmd *cmd; |
631 | struct qxl_cursor *cursor; | 631 | struct qxl_cursor *cursor; |
632 | struct drm_gem_object *obj; | 632 | struct drm_gem_object *obj; |
633 | struct qxl_bo *cursor_bo = NULL, *user_bo = NULL; | 633 | struct qxl_bo *cursor_bo = NULL, *user_bo = NULL, *old_cursor_bo = NULL; |
634 | int ret; | 634 | int ret; |
635 | void *user_ptr; | 635 | void *user_ptr; |
636 | int size = 64*64*4; | 636 | int size = 64*64*4; |
@@ -684,7 +684,7 @@ static void qxl_cursor_atomic_update(struct drm_plane *plane, | |||
684 | cursor_bo, 0); | 684 | cursor_bo, 0); |
685 | cmd->type = QXL_CURSOR_SET; | 685 | cmd->type = QXL_CURSOR_SET; |
686 | 686 | ||
687 | qxl_bo_unref(&qcrtc->cursor_bo); | 687 | old_cursor_bo = qcrtc->cursor_bo; |
688 | qcrtc->cursor_bo = cursor_bo; | 688 | qcrtc->cursor_bo = cursor_bo; |
689 | cursor_bo = NULL; | 689 | cursor_bo = NULL; |
690 | } else { | 690 | } else { |
@@ -704,6 +704,9 @@ static void qxl_cursor_atomic_update(struct drm_plane *plane, | |||
704 | qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false); | 704 | qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false); |
705 | qxl_release_fence_buffer_objects(release); | 705 | qxl_release_fence_buffer_objects(release); |
706 | 706 | ||
707 | if (old_cursor_bo) | ||
708 | qxl_bo_unref(&old_cursor_bo); | ||
709 | |||
707 | qxl_bo_unref(&cursor_bo); | 710 | qxl_bo_unref(&cursor_bo); |
708 | 711 | ||
709 | return; | 712 | return; |