Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1410609imm; Thu, 5 Jul 2018 22:52:08 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd30CwwSWDiFRi8QtoglWRZepwrT95BOOo7S+k3+h0REPqVrBIvaoSEKoOD6W23+qThv082 X-Received: by 2002:a63:6ecb:: with SMTP id j194-v6mr2317538pgc.158.1530856328939; Thu, 05 Jul 2018 22:52:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530856328; cv=none; d=google.com; s=arc-20160816; b=sYRsCYxeFs/ghTZ0QE68sqjsmHjsHUv70CHyc+GKHJgv3JRWvciLepqgojf+Tl4ze+ ZxyVqk46+iKBJSrXf0VzPHvOMVCmcCceI0noDDpr+mWE9Je6uQzLpA0NiWJ9H+2U8PoA ekYqDxBHTHwR83D/f+SahnaWS+daDhO3aiQX9+wRiqeTA7PAVXpcJk1OFXkdUlwousRh GrCmYPvEp0ZAoqQwkUjy70/Pg8O5MRubedCoZXB/FDoFu7eiXCAv7VRa9i03fP05jfa3 vyRpDP67wcz0us38RsvK1DUT4dUL9q66DTZmHzkYZhJc+sy/AiGM6LQEJYp1hLRlS+gE 2XyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=xi1Sal682HknGms+0Za7HhKGrYs/dKfIO8nMgm65BIQ=; b=Zl4NZ39CS3gRbHnFZ0l49BL/85vGggdrNxBT/qkAvCTer01b+UKgdZ/PjjDxcYv6bq foZGLFwdO1W0hUAUdg/jMjj8oMtSfWh1Db6JoihpkNZrZepSWwMKq+HvReqPPSnSJoDn Ezm19NM/j8gcpqTRZ8oF0KQhwBdg5ScYKvvqVCAp2ChnrBj+wnt4Q4PZ3JpJNug17qLX at9g6ZesML7sHUFellythm+OY8RwLDdAPB15kkdLUq77xF9dvbjMZIOnI9YbvqNyxDvK Araqhg1ojlcxsyT9zLYnd9UHcKak+tvfNh4DExWBY8v0Ab/q/qIfWxHyuNWNyrqUAxr3 trqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c5-v6si7360972pll.75.2018.07.05.22.51.54; Thu, 05 Jul 2018 22:52:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933859AbeGFFuU (ORCPT + 99 others); Fri, 6 Jul 2018 01:50:20 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60500 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933138AbeGFFuQ (ORCPT ); Fri, 6 Jul 2018 01:50:16 -0400 Received: from localhost (D57D388D.static.ziggozakelijk.nl [213.125.56.141]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D78BDBA2; Fri, 6 Jul 2018 05:50:15 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeremy Cline , Gerd Hoffmann Subject: [PATCH 4.14 18/61] drm/qxl: Call qxl_bo_unref outside atomic context Date: Fri, 6 Jul 2018 07:46:42 +0200 Message-Id: <20180706054713.044467838@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180706054712.332416244@linuxfoundation.org> References: <20180706054712.332416244@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jeremy Cline commit 889ad63d41eea20184b0483e7e585e5b20fb6cfe upstream. "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 Link: http://patchwork.freedesktop.org/patch/msgid/20180601200532.13619-1-jcline@redhat.com Signed-off-by: Gerd Hoffmann Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/qxl/qxl_display.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- 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(str struct qxl_cursor_cmd *cmd; struct qxl_cursor *cursor; struct drm_gem_object *obj; - struct qxl_bo *cursor_bo = NULL, *user_bo = NULL; + struct qxl_bo *cursor_bo = NULL, *user_bo = NULL, *old_cursor_bo = NULL; int ret; void *user_ptr; int size = 64*64*4; @@ -684,7 +684,7 @@ static void qxl_cursor_atomic_update(str cursor_bo, 0); cmd->type = QXL_CURSOR_SET; - qxl_bo_unref(&qcrtc->cursor_bo); + old_cursor_bo = qcrtc->cursor_bo; qcrtc->cursor_bo = cursor_bo; cursor_bo = NULL; } else { @@ -704,6 +704,9 @@ static void qxl_cursor_atomic_update(str qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false); qxl_release_fence_buffer_objects(release); + if (old_cursor_bo) + qxl_bo_unref(&old_cursor_bo); + qxl_bo_unref(&cursor_bo); return;