From patchwork Mon Mar 1 18:34:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maarten Maathuis X-Patchwork-Id: 83025 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 o21IaK3O003001 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 1 Mar 2010 18:36:56 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 1NmASL-0007sC-NU; Mon, 01 Mar 2010 18:35:01 +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 1NmASJ-0007s4-Rx for dri-devel@lists.sourceforge.net; Mon, 01 Mar 2010 18:34:59 +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 1NmASH-000457-Bz for dri-devel@lists.sourceforge.net; Mon, 01 Mar 2010 18:34:59 +0000 Received: by ewy24 with SMTP id 24so114132ewy.27 for ; Mon, 01 Mar 2010 10:34:50 -0800 (PST) Received: by 10.213.39.199 with SMTP id h7mr61836ebe.45.1267468489879; Mon, 01 Mar 2010 10:34:49 -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 24sm7331632eyx.4.2010.03.01.10.34.47 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 01 Mar 2010 10:34:48 -0800 (PST) Received: by madman2003@gmail.com (sSMTP sendmail emulation); Mon, 01 Mar 2010 19:34:46 +0100 From: Maarten Maathuis To: dri-devel@lists.sf.net Subject: [PATCH 1/2] drm/ttm: remove some bo->mutex remains Date: Mon, 1 Mar 2010 19:34:39 +0100 Message-Id: <1267468480-3430-1-git-send-email-madman2003@gmail.com> X-Mailer: git-send-email 1.7.0 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: 1NmASH-000457-Bz 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:36:56 +0000 (UTC) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 2920f9a..f5333d9 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -46,7 +46,6 @@ #include #include -#define TTM_ASSERT_LOCKED(param) #define TTM_DEBUG(fmt, arg...) #define TTM_BO_HASH_ORDER 13 @@ -306,9 +305,6 @@ void ttm_bo_unreserve(struct ttm_buffer_object *bo) } EXPORT_SYMBOL(ttm_bo_unreserve); -/* - * Call bo->mutex locked. - */ static int ttm_bo_add_ttm(struct ttm_buffer_object *bo, bool zero_alloc) { struct ttm_bo_device *bdev = bo->bdev; @@ -316,7 +312,7 @@ static int ttm_bo_add_ttm(struct ttm_buffer_object *bo, bool zero_alloc) int ret = 0; uint32_t page_flags = 0; - TTM_ASSERT_LOCKED(&bo->mutex); + BUG_ON(!atomic_read(&bo->reserved)); bo->ttm = NULL; if (bdev->need_dma32) diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c index 668dbe8..41b0c1e 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c @@ -146,7 +146,7 @@ static int ttm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) * since the mmap_sem is only held in read mode. However, we * modify only the caching bits of vma->vm_page_prot and * consider those bits protected by - * the bo->mutex, as we should be the only writers. + * bo->reserved, as we should be the only writers. * There shouldn't really be any readers of these bits except * within vm_insert_mixed()? fork? * diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index 81eb9f4..c1093ae 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -298,7 +297,7 @@ ttm_bo_reference(struct ttm_buffer_object *bo) * @interruptible: Use interruptible wait. * @no_wait: Return immediately if buffer is busy. * - * This function must be called with the bo::mutex held, and makes + * This function must be called with bo->reserved held, and makes * sure any previous rendering to the buffer is completed. * Note: It might be necessary to block validations before the * wait by reserving the buffer. diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index ff7664e..d3fc5f8 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h @@ -37,6 +37,7 @@ #include "linux/workqueue.h" #include "linux/fs.h" #include "linux/spinlock.h" +#include struct ttm_backend;