From patchwork Wed Dec 12 13:07:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1867441 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id C88923FC81 for ; Wed, 12 Dec 2012 14:38:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BB2DAE6621 for ; Wed, 12 Dec 2012 06:38:49 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com [74.125.83.49]) by gabe.freedesktop.org (Postfix) with ESMTP id 68BFFE614E for ; Wed, 12 Dec 2012 05:15:44 -0800 (PST) Received: by mail-ee0-f49.google.com with SMTP id c4so430865eek.36 for ; Wed, 12 Dec 2012 05:15:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=vjaWmH7+JVv1Ea+wrdw0MiNcv/QalRhKVkfgzvmPtK0=; b=NjrTnP27K+Pu+dWW+fO6K117mVN+9gKEnIT4/GnVfKjJe/7SFZZWluLe6r/b3xE+iQ m87udhEuvh2mLf7TBA5X/+oN+0AqBPswD8s607CJ/2efYMofRxoj+U6IEa2Vq56DZhgY on3NvVoLWaO4lYoKhPTQccknVtzjVDRZ9WIg4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=vjaWmH7+JVv1Ea+wrdw0MiNcv/QalRhKVkfgzvmPtK0=; b=CLrvbC5yYQ+LmgMIu1rWklryqX4uE6T4PO7dzoGm0XR4JVMZYv/ibz9vuL9y4KN3ol UpaEafaIUmnwUPiOMQpAJmHEJHAohXBB1OIB2nkR319qR2nNFUZaPpgz7siaJb7QLozy Ca1iTNTWqqgY4y7akzXkNrf1jZ35sHXfOszYwWTu/cta65StRUvRjZOEXV8+qaafqAda FxAU19FwBZTxZvZ+cqAi4N7BY9dqN2LS2Qf2hOKbijoZldCLLP07nShi95nViwyV/XLu 1eQqirCJ407sklsn/6a4TM6/GzPfdm/5WOnWXqhByjhbhBHAl8kTHJRDq4M1NG5gPgaI F7sw== Received: by 10.14.214.132 with SMTP id c4mr2705645eep.18.1355317677429; Wed, 12 Dec 2012 05:07:57 -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 r1sm55868541eeo.2.2012.12.12.05.07.56 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 12 Dec 2012 05:07:56 -0800 (PST) From: Daniel Vetter To: DRI Development Subject: [PATCH 35/37] drm/radeon: fix fence locking in the pageflip callback Date: Wed, 12 Dec 2012 14:07:15 +0100 Message-Id: <1355317637-16742-36-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1355317637-16742-1-git-send-email-daniel.vetter@ffwll.ch> References: <1355317637-16742-1-git-send-email-daniel.vetter@ffwll.ch> X-Gm-Message-State: ALoCoQl2Yihzm0R8Kpq3/QehfhdJCdqMNMOp5UaQa3rE/3voM6DdzYwKnWFiwFiKo7JMzBZvJIhr Cc: Nouveau Dev , Intel Graphics Development , Radeon Dev , 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 We need to hold bdev->fence_lock while grabbing a reference to the fence, to prevent concurrent clearing/changing of the ttm_bo->sync_obj field. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/radeon/radeon_display.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 8724196..069d5cc 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c @@ -378,8 +378,12 @@ static int radeon_crtc_page_flip(struct drm_crtc *crtc, work->old_rbo = rbo; obj = new_radeon_fb->obj; rbo = gem_to_radeon_bo(obj); + + spin_lock(&rbo->tbo.bdev->fence_lock); if (rbo->tbo.sync_obj) work->fence = radeon_fence_ref(rbo->tbo.sync_obj); + spin_unlock(&rbo->tbo.bdev->fence_lock); + INIT_WORK(&work->work, radeon_unpin_work_func); /* We borrow the event spin lock for protecting unpin_work */