Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp985244imm; Fri, 1 Jun 2018 13:07:10 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLSkkZSvCLIynPB8Id98cNlIVf1OSYgHm/n6vsXsQKPkv0fpk4yus5VAHFVzGJhLdscrbFv X-Received: by 2002:a63:b543:: with SMTP id u3-v6mr4714095pgo.365.1527883630194; Fri, 01 Jun 2018 13:07:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527883630; cv=none; d=google.com; s=arc-20160816; b=bfnA+EeOZj2udgi006ddadN8sLMHUEeS+tNOXXms3LU0WI/ICnUDP5wNu/Z9I0She5 38HkZDnGLv2p4nYZ2XdlW6CHWb1czm3Yj1r42ojw0r3JPLyLZLMpJ/6cScgXP3fjtDDp TjUqlu/CXnujM31k8fmW/ZVJW+F0frzrU5VNp3R3m2ELqIicpg6R+BB2h4124MYXwY2Z 3BLJcKNNnOhnKvfryimejyM+vTpET6k2Y3lKuWC6WxLF5XYroL7PoiWOJeX3Yxg3+vAp VD5JNkANiSVWd/wnypAbGdps91h0hdk3frdmSzgsEFvyodo2u7UlvreLDW3F4rqvU958 g+nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=uvLxcYtPt49CbUMPOnYptpC8Xu+S7LAM/MgO/uNoQB0=; b=t/yp9ybGrM7ufGdOGklyiXi3gMLVr73q1gsJeaoSAjFFLPGOwBU/Q4a3wbExvrtrFk pNqSgxcZUn4O2sqnD/jH6mRh/wOpeTV4qnjWtJLl6x3aYcrOVil53HfS8Iqe99leva/c stXwA8hcjl+SVNFSKM3i2vIaK+eXJCxhpUfecA//zVgowdUKR4oONvkkfykmhR9O+7u1 7N3UWh53APLLXytc7EVFNs/X8kewhXSoq6JnJLrXvmn0JMYaIf/yzbM1CXJEzj+Ig/zl cvCf6hwvnOUYpuasT3SasmxeHNtKCw7WlTXg2A2h8BZpswM4amzNCkEu1n8qebimsLd7 wg2A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m26-v6si2165417pfe.306.2018.06.01.13.06.55; Fri, 01 Jun 2018 13:07:10 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753359AbeFAUGZ (ORCPT + 99 others); Fri, 1 Jun 2018 16:06:25 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:33243 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752360AbeFAUGW (ORCPT ); Fri, 1 Jun 2018 16:06:22 -0400 Received: by mail-qt0-f195.google.com with SMTP id e8-v6so33689801qth.0 for ; Fri, 01 Jun 2018 13:06:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=uvLxcYtPt49CbUMPOnYptpC8Xu+S7LAM/MgO/uNoQB0=; b=JfvC7zUTM1q4ogt/OozAkdUQhcci+6fSMT/qZSMWUUiNNahif7gVxtii2YSIIjL8XK cJ6pn4ZWsMdd4eqVb0xXNJxqnUMBi38qjZFqesStClXsl8LSBWOOWKAEfmJuxh4rjT6R 9FsswOCsE6qBpdx+ATOEsCscWfxKK3F8NY8ehAEnCCeiTEXVp0u4Fk55KjL9LE4+lbiR gT1fGWoZ1tZ24deXmueikhDsjdWyGBrEFRPJ+yUsxV0TnU2hSBus0sNVC87IF1fo152/ T1yIZllzkoi5CkY595biL2UvQRPcOr8EDt3TmRruntW3j5CqHz8Vfgb9Cfbvqsxhpk6Z X3lg== X-Gm-Message-State: APt69E0rmKM/zRuYX0+dVom654sX+bcRJpwWFm9U9K2/Bj0aV1ErZasA wx62wYxzdOxmKIkKSuL0s5HECXJ4lesWTw== X-Received: by 2002:ac8:2a87:: with SMTP id b7-v6mr12735563qta.215.1527883582017; Fri, 01 Jun 2018 13:06:22 -0700 (PDT) Received: from laptop.jcline.org.com (cpe-2606-A000-1127-D1-82A4-FE7D-5832-CB87.dyn6.twc.com. [2606:a000:1127:d1:82a4:fe7d:5832:cb87]) by smtp.gmail.com with ESMTPSA id f99-v6sm16320478qkh.85.2018.06.01.13.06.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Jun 2018 13:06:21 -0700 (PDT) From: Jeremy Cline To: Dave Airlie , Gerd Hoffmann Cc: Ray Strode , virtualization@lists.linux-foundation.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jeremy Cline , stable@vger.kernel.org Subject: [PATCH] drm/qxl: Call qxl_bo_unref outside atomic context Date: Fri, 1 Jun 2018 16:05:32 -0400 Message-Id: <20180601200532.13619-1-jcline@redhat.com> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "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 --- drivers/gpu/drm/qxl/qxl_display.c | 7 +++++-- 1 file 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, 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(struct drm_plane *plane, 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(struct drm_plane *plane, 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; -- 2.17.0