From patchwork Mon Mar 1 18:34:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maarten Maathuis X-Patchwork-Id: 83026 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o21IaUip003021 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 1 Mar 2010 18:37:06 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NmASd-0007tn-Tw; Mon, 01 Mar 2010 18:35:19 +0000 Received: from sfi-mx-1.v28.ch3.sourceforge.com ([172.29.28.121] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NmASb-0007tU-5h for dri-devel@lists.sourceforge.net; Mon, 01 Mar 2010 18:35:17 +0000 Received-SPF: pass (sfi-mx-1.v28.ch3.sourceforge.com: domain of gmail.com designates 209.85.219.224 as permitted sender) client-ip=209.85.219.224; envelope-from=madman2003@gmail.com; helo=mail-ew0-f224.google.com; Received: from mail-ew0-f224.google.com ([209.85.219.224]) by sfi-mx-1.v28.ch3.sourceforge.com with esmtp (Exim 4.69) id 1NmASa-000457-AF for dri-devel@lists.sourceforge.net; Mon, 01 Mar 2010 18:35:17 +0000 Received: by mail-ew0-f224.google.com with SMTP id 24so114132ewy.27 for ; Mon, 01 Mar 2010 10:35:15 -0800 (PST) Received: by 10.213.103.134 with SMTP id k6mr105691ebo.2.1267468513443; Mon, 01 Mar 2010 10:35:13 -0800 (PST) Received: from madman2003@gmail.com (82-136-228-38.ip.telfort.nl [82.136.228.38]) by mx.google.com with ESMTPS id 15sm2487636ewy.0.2010.03.01.10.35.11 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 01 Mar 2010 10:35:12 -0800 (PST) Received: by madman2003@gmail.com (sSMTP sendmail emulation); Mon, 01 Mar 2010 19:35:10 +0100 From: Maarten Maathuis To: dri-devel@lists.sf.net Subject: [PATCH 2/2] drm/ttm: don't write to bo->reserved without holding glob->lru_lock Date: Mon, 1 Mar 2010 19:34:40 +0100 Message-Id: <1267468480-3430-2-git-send-email-madman2003@gmail.com> X-Mailer: git-send-email 1.7.0 In-Reply-To: <1267468480-3430-1-git-send-email-madman2003@gmail.com> References: <1267468480-3430-1-git-send-email-madman2003@gmail.com> X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record -0.0 DKIM_VERIFIED Domain Keys Identified Mail: signature passes verification 0.0 DKIM_SIGNED Domain Keys Identified Mail: message has a signature X-Headers-End: 1NmASa-000457-AF X-BeenThere: dri-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.sourceforge.net X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 01 Mar 2010 18:37:06 +0000 (UTC) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index f5333d9..2104885 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -476,9 +476,9 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo, bool remove_all) drm_mm_put_block(bo->mem.mm_node); bo->mem.mm_node = NULL; } - spin_unlock(&glob->lru_lock); atomic_set(&bo->reserved, 0); + spin_unlock(&glob->lru_lock); while (put_count--) kref_put(&bo->list_kref, ttm_bo_ref_bug); @@ -1707,8 +1707,12 @@ EXPORT_SYMBOL(ttm_bo_wait); void ttm_bo_unblock_reservation(struct ttm_buffer_object *bo) { + struct ttm_bo_global *glob = bo->glob; + + spin_lock(&glob->lru_lock); atomic_set(&bo->reserved, 0); wake_up_all(&bo->event_queue); + spin_unlock(&glob->lru_lock); } int ttm_bo_block_reservation(struct ttm_buffer_object *bo, bool interruptible, @@ -1849,8 +1853,10 @@ out: * already swapped buffer. */ + spin_lock(&glob->lru_lock); atomic_set(&bo->reserved, 0); wake_up_all(&bo->event_queue); + spin_unlock(&glob->lru_lock); kref_put(&bo->list_kref, ttm_bo_release_list); return ret; }