From patchwork Fri Jun 1 20:05:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Cline X-Patchwork-Id: 10444331 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A61EE603D7 for ; Fri, 1 Jun 2018 20:06:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9251A289E8 for ; Fri, 1 Jun 2018 20:06:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 86F9228BEE; Fri, 1 Jun 2018 20:06:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 345E0289E8 for ; Fri, 1 Jun 2018 20:06:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 933596E781; Fri, 1 Jun 2018 20:06:23 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt0-f196.google.com (mail-qt0-f196.google.com [209.85.216.196]) by gabe.freedesktop.org (Postfix) with ESMTPS id D13EB6E781 for ; Fri, 1 Jun 2018 20:06:22 +0000 (UTC) Received: by mail-qt0-f196.google.com with SMTP id q6-v6so33662543qtn.3 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=AB2k4bYvDvV0Jgx3Fd5MuSReuJPs+jIM4NHaVHwOeWHI35G8Z8zX6uU4jHJfMt8Gmo tyarsRejDjGtBYuWo40+36F9TnDK8T6BGcfTsWOmewiu8DvBm2XqfX2lAuo4SLs9fGJp F0FR7GyIxxdAg9138jtKfXlYYcX0Ev/JMmzm882g0gsT7iOsOVlfRCv7RN/waVCMGomW khxGTw4WLvSbNlNQD1/SUcSwfhYnWED9UB0FgMsLIvVjokVIXY32C9cITxBJ1gee8Q2i KPKzl6ossmy4J/u4vJPtQB7Rj2LADT4uJKk/mfbuK27S3/K9DQQZ1A5xZTH4aQoSdprV Uxjg== X-Gm-Message-State: APt69E1ByPZdUcIGMhvBrgL0sTD/rVF9odP4GYFveSZM4X84EhY5M2YJ Vl0RAlPuI7vZ41Asuh7WCcWbuA== X-Google-Smtp-Source: ADUXVKLwkHZFNFhJLcTm7bHA6mA4Xl94W2cFY/y5sXERAc6JWWS6mzOgat5XxuNC75IhEnTr+h3sgw== 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 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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ray Strode , linux-kernel@vger.kernel.org, stable@vger.kernel.org, virtualization@lists.linux-foundation.org, Jeremy Cline , dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP "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;