From patchwork Tue Dec 18 21:25:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1893711 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 9C55ADF2F6 for ; Tue, 18 Dec 2012 21:33:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8557AE5F06 for ; Tue, 18 Dec 2012 13:33:23 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ee0-f41.google.com (mail-ee0-f41.google.com [74.125.83.41]) by gabe.freedesktop.org (Postfix) with ESMTP id 5D4DAE5D00 for ; Tue, 18 Dec 2012 13:25:32 -0800 (PST) Received: by mail-ee0-f41.google.com with SMTP id d41so652215eek.0 for ; Tue, 18 Dec 2012 13:25:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=7JnX935eVzaZ+BJtt3zy+ljRlCf+KuLQurIRnBgeErY=; b=i9jic6ynMihr/tFbTIYzzgqg+VrdPcD5I24R3TasYpDFs4c4q1T+5ibvLiC0+ROHGA Xda528y8I4vniyzrTKBepJKx3Wae9gtq8T6F/3hVoTckaBCMj+XrD8g2+kYxuTvZRrBe PXhGMon7RWMu4VvsUNldR4tRc3Pn4KBEJJCj8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=7JnX935eVzaZ+BJtt3zy+ljRlCf+KuLQurIRnBgeErY=; b=KTv3+2qYuae9aH7G5PfYddDDvlCUH2ElRry4WY6IsoRBVPNmOhIF5Hp1FFegxbfp1p 8+3Oy6noeepqjHZglincctrEgGrPVW+4zpFktsP2M6rjNumCVBriMOqE7r2ydBz50B3+ 1BWQmcRHzt3oXvYgOsAWQhYJG3H+z+/Ehd+4SjfIFn6MzMConJDoilR29jXb7xmljSVI 7WzVoH/S3uK5WivJdnsRyJj4liRQ24No6+7WW8f0KJuAjng5Tlrd25bYGSKsEU83CKTD uVxBvV8kRaf2lMDgkwI9+FkRvwZoNU9YP+XGnDx5PJZq804iM+022kYVvsMcOpGW7C2s In1g== X-Received: by 10.14.1.195 with SMTP id 43mr8877273eed.31.1355865931506; Tue, 18 Dec 2012 13:25:31 -0800 (PST) Received: from biers.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPS id w3sm5549337eel.17.2012.12.18.13.25.30 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 18 Dec 2012 13:25:30 -0800 (PST) From: Daniel Vetter To: DRI Development Subject: [PATCH 08/10] drm/ttm: fix fence locking in ttm_buffer_object_transfer Date: Tue, 18 Dec 2012 22:25:11 +0100 Message-Id: <1355865913-14858-9-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1355865913-14858-1-git-send-email-daniel.vetter@ffwll.ch> References: <1355865913-14858-1-git-send-email-daniel.vetter@ffwll.ch> X-Gm-Message-State: ALoCoQnkYn3P7ealeqBglUcV7rZkfKc2fvjxbb/EF5BI2tbhqsbA7ELtBjtTzjSpgFcGM50ezAUN Cc: Daniel Vetter X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Noticed while reviewing the fence locking in the radeon pageflip handler. v2: Instead of grabbing the bdev->fence_lock in object_transfer just move the single callsite of that function a few lines, so that it is protected by the fence_lock. Suggested by Jerome Glisse. v3: Fix typo in commit message. Reviewed-by: Jerome Glisse Signed-off-by: Daniel Vetter --- drivers/gpu/drm/ttm/ttm_bo_util.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index 9e9c5d2..d73d6e3 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c @@ -654,11 +654,13 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, */ set_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags); + + /* ttm_buffer_object_transfer accesses bo->sync_obj */ + ret = ttm_buffer_object_transfer(bo, &ghost_obj); spin_unlock(&bdev->fence_lock); if (tmp_obj) driver->sync_obj_unref(&tmp_obj); - ret = ttm_buffer_object_transfer(bo, &ghost_obj); if (ret) return ret;