Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1425566imm; Thu, 5 Jul 2018 23:12:39 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdiEmaRP5JlmxdYL45vxXEvGNp1OqSjJ4F9CJdttdy/1t6NGPT8LHFRQoWvFFfRoS50Fnb/ X-Received: by 2002:a63:5106:: with SMTP id f6-v6mr8008354pgb.95.1530857559322; Thu, 05 Jul 2018 23:12:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530857559; cv=none; d=google.com; s=arc-20160816; b=mpEsOnPRur/UgZMe3T/Q95KDsLFzgVW/rdbbu8JP9b+Ucd5Enqi7nT0grBU7Nf7UrO CIpG6OpNeNmZ453SVTq1Wl/7XLazpqc0fv4/fxpSjMuuYSngHN+Z3JkcLTnVaUyF77YS NSC4VFhVJ5Kkh/Vo+eIK/TvOi/kDblWVoF/PBES8XXJAyxcro/pSgF9nqDqZMZ5KPZch SRGRdBiKpS2vRNzN081M74Lojqr/PnK56nu7ou7R5guHoygeVhycgBLAl62GNOhBWOGn T2qBS6A7Fa4nVA+32YPhTXbKFLCQmfqroage7oNTQdMorR8bBctb534WZn1NVN0e3T9W AtLg== 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=fjNFhAHMp+ketxuY0ZjncaIIrcOzv9ypESPSiJf6sI4=; b=svPaiG4meS7OJ0pMj9mBYZ5+j3ZLJPahEMhk7on+21vLCRAHqZWPALGDFKFCfod8fs 4jmugfr6oMp1b0Cy/JrXkflNOghBV5BHh68X44OzTyIwh2fDtHgq14nmfQJSaeH9WrdF sNsuoEdfffhmq65So3F8C0CVUg3b7qcQ5s7Q6PspmSRMhnt5bfkHh4y8kdKsDphXdYyb 41KzJxKjmAT8Dx57aieehBknfWaWvtM4EzaDncw47u1nE95UegYRprdISwld0NLHVPm3 DTgq0vwOMTTpiWyLgjAnV+uFcca5e4pFnbWJreIk0HZzOGYJtIC6ZdyAk2A8GJUwIjrU rzBg== 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 t22-v6si7344879plo.263.2018.07.05.23.12.24; Thu, 05 Jul 2018 23:12:39 -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 S933102AbeGFFsK (ORCPT + 99 others); Fri, 6 Jul 2018 01:48:10 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59748 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932726AbeGFFsI (ORCPT ); Fri, 6 Jul 2018 01:48:08 -0400 Received: from localhost (D57D388D.static.ziggozakelijk.nl [213.125.56.141]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D1AC886A; Fri, 6 Jul 2018 05:48:06 +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.17 25/46] drm/qxl: Call qxl_bo_unref outside atomic context Date: Fri, 6 Jul 2018 07:46:46 +0200 Message-Id: <20180706054525.798595965@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180706054524.595521988@linuxfoundation.org> References: <20180706054524.595521988@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.17-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;