From patchwork Wed Sep 3 15:11:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maarten Lankhorst X-Patchwork-Id: 4835131 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 45221C0338 for ; Wed, 3 Sep 2014 15:11:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 334D520200 for ; Wed, 3 Sep 2014 15:11:29 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D809820211 for ; Wed, 3 Sep 2014 15:11:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9C58C89FC5; Wed, 3 Sep 2014 08:11:26 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by gabe.freedesktop.org (Postfix) with ESMTP id 6992989FC5 for ; Wed, 3 Sep 2014 08:11:25 -0700 (PDT) Received: from 5ed49945.cm-7-5c.dynamic.ziggo.nl ([94.212.153.69] helo=[192.168.1.128]) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1XPCDU-0004w2-4Q; Wed, 03 Sep 2014 15:11:24 +0000 Message-ID: <54072F9B.7090304@canonical.com> Date: Wed, 03 Sep 2014 17:11:23 +0200 From: Maarten Lankhorst User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: David Airlie Subject: [PATCH 1/3] drm/qxl: Remove release_lock stupidity Cc: "dri-devel@lists.freedesktop.org" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The locking of release_lock was stupid; it should have been be called with fence_lock_irq if it was legitimately used. Unfortunately it never protected anything except the fence implementation correctly. Signed-off-by: Maarten Lankhorst --- drivers/gpu/drm/qxl/qxl_debugfs.c | 2 -- drivers/gpu/drm/qxl/qxl_release.c | 9 +++------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_debugfs.c b/drivers/gpu/drm/qxl/qxl_debugfs.c index a4a63fd84803..6911b8c44492 100644 --- a/drivers/gpu/drm/qxl/qxl_debugfs.c +++ b/drivers/gpu/drm/qxl/qxl_debugfs.c @@ -57,7 +57,6 @@ qxl_debugfs_buffers_info(struct seq_file *m, void *data) struct qxl_device *qdev = node->minor->dev->dev_private; struct qxl_bo *bo; - spin_lock(&qdev->release_lock); list_for_each_entry(bo, &qdev->gem.objects, list) { struct reservation_object_list *fobj; int rel; @@ -71,7 +70,6 @@ qxl_debugfs_buffers_info(struct seq_file *m, void *data) (unsigned long)bo->gem_base.size, bo->pin_count, rel); } - spin_unlock(&qdev->release_lock); return 0; } diff --git a/drivers/gpu/drm/qxl/qxl_release.c b/drivers/gpu/drm/qxl/qxl_release.c index 15158c5a5b3a..828d47e90dce 100644 --- a/drivers/gpu/drm/qxl/qxl_release.c +++ b/drivers/gpu/drm/qxl/qxl_release.c @@ -71,7 +71,7 @@ static long qxl_fence_wait(struct fence *fence, bool intr, signed long timeout) retry: sc++; - if (fence_is_signaled_locked(fence)) + if (fence_is_signaled(fence)) goto signaled; qxl_io_notify_oom(qdev); @@ -80,11 +80,11 @@ retry: if (!qxl_queue_garbage_collect(qdev, true)) break; - if (fence_is_signaled_locked(fence)) + if (fence_is_signaled(fence)) goto signaled; } - if (fence_is_signaled_locked(fence)) + if (fence_is_signaled(fence)) goto signaled; if (have_drawable_releases || sc < 4) { @@ -457,8 +457,6 @@ void qxl_release_fence_buffer_objects(struct qxl_release *release) glob = bo->glob; spin_lock(&glob->lru_lock); - /* acquire release_lock to protect bo->resv->fence and its contents */ - spin_lock(&qdev->release_lock); list_for_each_entry(entry, &release->bos, head) { bo = entry->bo; @@ -468,7 +466,6 @@ void qxl_release_fence_buffer_objects(struct qxl_release *release) ttm_bo_add_to_lru(bo); __ttm_bo_unreserve(bo); } - spin_unlock(&qdev->release_lock); spin_unlock(&glob->lru_lock); ww_acquire_fini(&release->ticket); }