From patchwork Thu Nov 22 11:33:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cho KyongHo X-Patchwork-Id: 1783511 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 519E7DF230 for ; Thu, 22 Nov 2012 11:36:46 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TbV2O-0006df-VQ; Thu, 22 Nov 2012 11:33:45 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TbV23-0006XI-Bx for linux-arm-kernel@lists.infradead.org; Thu, 22 Nov 2012 11:33:26 +0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MDW0006C03FL360@mailout1.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 22 Nov 2012 20:33:22 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.47]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 29.F7.12699.28D0EA05; Thu, 22 Nov 2012 20:33:22 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-cf-50ae0d823edf Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 78.F7.12699.28D0EA05; Thu, 22 Nov 2012 20:33:22 +0900 (KST) Received: from DOPULLIPCHO06 ([12.23.118.152]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MDW00ICC03LQS20@mmp1.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 22 Nov 2012 20:33:22 +0900 (KST) From: Cho KyongHo To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 07/12] iommu/exynos: change rwlock to spinlock Date: Thu, 22 Nov 2012 20:33:21 +0900 Message-id: <002801cdc8a5$2d68bbd0$883a3370$%cho@samsung.com> MIME-version: 1.0 X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac3IpS1JCVrvc+Q4QlOeIKUxzXb2vw== Content-language: ko DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrHIsWRmVeSWpSXmKPExsVy+t8zfd0m3nUBBl29IhabHl9jdWD02Lyk PoAxissmJTUnsyy1SN8ugSvj+NmrLAXfVSsOdz1mamC8Kd/FyMEhIWAi8bLBv4uRE8gUk7hw bz1bFyMXh5DAMkaJ7y9esMLUPJpoChFfxCgxa2IvM4SznEni69J1zCDdbAJaEqvnHmcESYgI 9DJKXOj/ygTiMAv8YJSYvvkXC0iVsICjxO+VrSwgY1kEVCVmfi0CCfMK2Epsf/KbHcIWlPgx +R5YOTPQ0PU7jzNB2PISm9e8ZYa4SF3i0V9dkLCIgJ7Euw97WSFKRCT2vXjHCGKzCAhIfJt8 iAWiXFZi0wGwmyUEutklPv5cwArxsaTEwRU3WCYwis1CsnkWks2zkGyehWTFAkaWVYyiqQXJ BcVJ6blGesWJucWleel6yfm5mxghkSK9g3FVg8UhRgEORiUe3gyDtQFCrIllxZW5hxglOJiV RHjvca8LEOJNSaysSi3Kjy8qzUktPsToA3T5RGYp0eR8YBTnlcQbGhubmJmYmphbmpqb4hBW Eudt9kgJEBJITyxJzU5NLUgtghnHxMEp1cBou2tS96wbGvE2k4+9cuoK/Bog9pF16SwZo4rP R6cqa5RFr3ignbpF80YgZx3HF788xx1G8Zs+ych/fXalcLXO21ubfDc6LM5heSkWKfyq90uh VJGu3Ky9PoX1U28FJ+5g+Z2wZf7aLH2vm7yT+9X7FnLqHm2z1V6wkXNpxhWfefncMVviHB2V WIozEg21mIuKEwHRYjoywQIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrHIsWRmVeSWpSXmKPExsVy+t9jAd0m3nUBBh/6+Cw2Pb7G6sDosXlJ fQBjVAOjTUZqYkpqkUJqXnJ+SmZeuq2Sd3C8c7ypmYGhrqGlhbmSQl5ibqqtkotPgK5bZg7Q VCWFssScUqBQQGJxsZK+HaYJoSFuuhYwjRG6viFBcD1GBmggYR1jxvGzV1kKvqtWHO56zNTA eFO+i5GDQ0LAROLRRNMuRk4gU0ziwr31bF2MXBxCAosYJWZN7GWGcJYzSXxduo4ZpIpNQEti 9dzjjCAJEYFeRokL/V+ZQBxmgR+MEtM3/2IBqRIWcJT4vbKVBWQFi4CqxMyvRSBhXgFbie1P frND2IISPybfAytnBhq6fudxJghbXmLzmrfMENepSzz6qwsSFhHQk3j3YS8rRImIxL4X7xgn MArMQjJpFpJJs5BMmoWkZQEjyypG0dSC5ILipPRcI73ixNzi0rx0veT83E2M4Eh8Jr2DcVWD xSFGAQ5GJR7eDIO1AUKsiWXFlbmHGCU4mJVEeO9xrwsQ4k1JrKxKLcqPLyrNSS0+xOgD9OdE ZinR5HxgksgriTc0NjEzsjQyszAyMTfHIawkztvskRIgJJCeWJKanZpakFoEM46Jg1OqgTF2 6W2z36pBLs+v/jc+flGwZVZz9Yubh6IPHXk/tX9qGcfcaVzMN+Oe3NGQmRJrUuVg19+rds6v xUCtgyvPzDL4q880b8W7hqtqC1ecM1rCrno25Q1nWOq1q17WUnvlxDSDmRdz/z5WtfGQwD0d 16LfmxnMV7mzvE40K/fX+v5H7qm13GfpHCWW4oxEQy3mouJEAGXw//jxAgAA X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121122_063324_005872_BB672DEE X-CRM114-Status: GOOD ( 10.24 ) X-Spam-Score: -7.5 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.24 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 HDRS_LCASE Odd capitalization of message header 0.0 T_MANY_HDRS_LCASE Odd capitalization of multiple message headers Cc: 'Kukjin Kim' , prathyush.k@samsung.com, 'Joerg Roedel' , sw0312.kim@samsung.com, 'Subash Patel' , 'Sanghyun Lee' , rahul.sharma@samsung.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Since acquiring read_lock is not more frequent than write_lock, it is not beneficial to use rwlock, this commit changes rwlock to spinlock. Signed-off-by: KyongHo Cho --- drivers/iommu/exynos-iommu.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 0bb194e..e39ddac 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -184,7 +184,7 @@ struct sysmmu_drvdata { struct clk *clk; int activations; struct sysmmu_version ver; - rwlock_t lock; + spinlock_t lock; struct iommu_domain *domain; sysmmu_fault_handler_t fault_handler; unsigned long pgtable; @@ -288,7 +288,7 @@ void exynos_sysmmu_set_prefbuf(struct device *dev, BUG_ON((base0 + size0) <= base0); BUG_ON((size1 > 0) && ((base1 + size1) <= base1)); - read_lock_irqsave(&data->lock, flags); + spin_lock_irqsave(&data->lock, flags); if (!is_sysmmu_active(data)) goto finish; @@ -318,7 +318,7 @@ void exynos_sysmmu_set_prefbuf(struct device *dev, } } finish: - read_unlock_irqrestore(&data->lock, flags); + spin_unlock_irqrestore(&data->lock, flags); } static void __set_fault_handler(struct sysmmu_drvdata *data, @@ -326,9 +326,9 @@ static void __set_fault_handler(struct sysmmu_drvdata *data, { unsigned long flags; - write_lock_irqsave(&data->lock, flags); + spin_lock_irqsave(&data->lock, flags); data->fault_handler = handler; - write_unlock_irqrestore(&data->lock, flags); + spin_unlock_irqrestore(&data->lock, flags); } void exynos_sysmmu_set_fault_handler(struct device *dev, @@ -376,7 +376,7 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void *dev_id) int i, ret = -ENOSYS; - read_lock(&data->lock); + spin_lock(&data->lock); WARN_ON(!is_sysmmu_active(data)); @@ -420,7 +420,7 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void *dev_id) if (itype != SYSMMU_FAULT_UNKNOWN) sysmmu_unblock(data->sfrbases[i]); - read_unlock(&data->lock); + spin_unlock(&data->lock); return IRQ_HANDLED; } @@ -431,7 +431,7 @@ static bool __exynos_sysmmu_disable(struct sysmmu_drvdata *data) bool disabled = false; int i; - write_lock_irqsave(&data->lock, flags); + spin_lock_irqsave(&data->lock, flags); if (!set_sysmmu_inactive(data)) goto finish; @@ -446,7 +446,7 @@ static bool __exynos_sysmmu_disable(struct sysmmu_drvdata *data) data->pgtable = 0; data->domain = NULL; finish: - write_unlock_irqrestore(&data->lock, flags); + spin_unlock_irqrestore(&data->lock, flags); if (disabled) dev_dbg(data->sysmmu, "Disabled\n"); @@ -469,7 +469,7 @@ static int __exynos_sysmmu_enable(struct sysmmu_drvdata *data, int i, ret = 0; unsigned long flags; - write_lock_irqsave(&data->lock, flags); + spin_lock_irqsave(&data->lock, flags); if (!set_sysmmu_active(data)) { if (WARN_ON(pgtable != data->pgtable)) { @@ -506,7 +506,7 @@ static int __exynos_sysmmu_enable(struct sysmmu_drvdata *data, dev_dbg(data->sysmmu, "Enabled\n"); finish: - write_unlock_irqrestore(&data->lock, flags); + spin_unlock_irqrestore(&data->lock, flags); return ret; } @@ -553,7 +553,7 @@ static void sysmmu_tlb_invalidate_entry(struct device *dev, unsigned long iova) unsigned long flags; struct sysmmu_drvdata *data = dev_get_drvdata(dev->archdata.iommu); - read_lock_irqsave(&data->lock, flags); + spin_lock_irqsave(&data->lock, flags); if (is_sysmmu_active(data)) { int i; @@ -569,7 +569,7 @@ static void sysmmu_tlb_invalidate_entry(struct device *dev, unsigned long iova) "Disabled. Skipping invalidating TLB.\n"); } - read_unlock_irqrestore(&data->lock, flags); + spin_unlock_irqrestore(&data->lock, flags); } void exynos_sysmmu_tlb_invalidate(struct device *dev) @@ -577,7 +577,7 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev) unsigned long flags; struct sysmmu_drvdata *data = dev_get_drvdata(dev->archdata.iommu); - read_lock_irqsave(&data->lock, flags); + spin_lock_irqsave(&data->lock, flags); if (is_sysmmu_active(data)) { int i; @@ -592,7 +592,7 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev) "Disabled. Skipping invalidating TLB.\n"); } - read_unlock_irqrestore(&data->lock, flags); + spin_unlock_irqrestore(&data->lock, flags); } static int __init __sysmmu_init_clock(struct device *sysmmu, @@ -748,7 +748,7 @@ static int __init exynos_sysmmu_probe(struct platform_device *pdev) ret = __sysmmu_setup(dev, data); if (!ret) { data->sysmmu = dev; - rwlock_init(&data->lock); + spin_lock_init(&data->lock); INIT_LIST_HEAD(&data->node); __set_fault_handler(data, &default_fault_handler);