From patchwork Thu Aug 8 09:41:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cho KyongHo X-Patchwork-Id: 2840933 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 245039F961 for ; Thu, 8 Aug 2013 09:42:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B4CF220483 for ; Thu, 8 Aug 2013 09:42:17 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6E7F32047E for ; Thu, 8 Aug 2013 09:42:16 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V7MjR-0003xR-Ow; Thu, 08 Aug 2013 09:42:10 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V7MjL-0005KB-Fk; Thu, 08 Aug 2013 09:42:03 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V7MjI-0005ID-Lg for linux-arm-kernel@lists.infradead.org; Thu, 08 Aug 2013 09:42:01 +0000 Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MR7000K4HLFLKI0@mailout3.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 08 Aug 2013 18:41:39 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.47]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id 39.B9.29708.3D763025; Thu, 08 Aug 2013 18:41:39 +0900 (KST) X-AuditID: cbfee690-b7f6f6d00000740c-68-520367d33530 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id F7.A8.32250.3D763025; Thu, 08 Aug 2013 18:41:39 +0900 (KST) Received: from DOPULLIPCHO07 ([12.23.118.94]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MR700831HLFXX40@mmp2.samsung.com>; Thu, 08 Aug 2013 18:41:39 +0900 (KST) From: Cho KyongHo To: 'Linux ARM Kernel' , 'Linux IOMMU' , 'Linux Kernel' , 'Linux Samsung SOC' , devicetree@vger.kernel.org Subject: [PATCH v9 15/16] iommu/exynos: change rwlock to spinlock Date: Thu, 08 Aug 2013 18:41:39 +0900 Message-id: <003301ce941b$7b4fd3a0$71ef7ae0$@samsung.com> MIME-version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-index: Ac6UF8JBa1cRarXLRx+c9/G/OEm8jg== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkleLIzCtJLcpLzFFi42I5/e+Zvu7ldOYgg9WTNCzu3D3HajH/CJB4 deQHk8WC/dYWnbM3sFv0LrjKZvHx1HF2i02Pr7FaXN41h81ixvl9TBYXVmxkt5iy6DCrxck/ vYwWLdd7mRz4PJ4cnMfkMbvhIovHnWt72DzOb1rD7LF5Sb3H5BvLGT36tqxi9Pi8Sc7jytEz TAGcUVw2Kak5mWWpRfp2CVwZ797OZS5o16o4fiS5gfG7UhcjJ4eEgInE/1+nWSFsMYkL99az dTFycQgJLGOU6Hn8jwmmaNbMY8wQiemMEj/ntkNV/WWUmDL1GTNIFZuAlsTquccZQRIiAr8Z JW49m8MK4jAL/GeS2Hq7iR2kSljAUWJG9xM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qBoRiX0v3jFOYBSYhWTU LCSjZiEZNQtJywJGllWMoqkFyQXFSem5hnrFibnFpXnpesn5uZsYwanlmdQOxpUNFocYBTgY lXh4OwKYgoRYE8uKK3MPMUpwMCuJ8F4sBgrxpiRWVqUW5ccXleakFh9iTAb6dCKzlGhyPjDt 5ZXEGxqbmBlZGplZGJmYm5MmrCTOe6DVOlBIID2xJDU7NbUgtQhmCxMHp1QD48Lmx+vWPwiQ Vp/qxynPuczPTHfPl+nsuccNLu7k//XxuanS/yMVL/f9FLeZueb91EOn7nhPZ/+jdqhl219z yY3Xlq5K15mp9+sWq3adpO+vW9cW1018YDwtXWzLu83LVh55P6eQ523a9Vv/yk24VI/vuZR/ PcB/zb+6f9IHiy33ch/3UHFXkN2nxFKckWioxVxUnAgASRlBUnEDAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130808_054201_161284_630C883D X-CRM114-Status: GOOD ( 10.23 ) X-Spam-Score: -5.1 (-----) Cc: 'Kukjin Kim' , 'Prathyush' , 'Grant Grundler' , 'Joerg Roedel' , 'Subash Patel' , 'Sachin Kamat' , 'Antonios Motakis' , kvmarm@lists.cs.columbia.edu, 'Rahul Sharma' X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,KHOP_BIG_TO_CC, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since acquiring read_lock is not more frequent than write_lock, it is not beneficial to use rwlock, this commit changes rwlock to spinlock. Reviewed-by: Grant Grundler Signed-off-by: Cho KyongHo --- drivers/iommu/exynos-iommu.c | 36 ++++++++++++++++++------------------ 1 files changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 56aead9..2d16fc0 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -185,7 +185,7 @@ struct sysmmu_drvdata { struct clk *clk; struct clk *clk_master; int activations; - rwlock_t lock; + spinlock_t lock; struct iommu_domain *domain; bool runtime_active; unsigned long pgtable; @@ -285,7 +285,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; @@ -319,7 +319,7 @@ void exynos_sysmmu_set_prefbuf(struct device *dev, clk_disable(data->clk_master); finish: - read_unlock_irqrestore(&data->lock, flags); + spin_unlock_irqrestore(&data->lock, flags); } static void show_fault_information(const char *name, @@ -372,7 +372,7 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void *dev_id) clk_enable(data->clk_master); if (client) spin_lock(&client->lock); - read_lock(&data->lock); + spin_lock(&data->lock); if (i == data->nsfrs) { itype = SYSMMU_FAULT_UNKNOWN; @@ -405,7 +405,7 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void *dev_id) clk_disable(data->clk_master); - read_unlock(&data->lock); + spin_unlock(&data->lock); if (client) spin_unlock(&client->lock); @@ -432,7 +432,7 @@ static bool __sysmmu_disable(struct sysmmu_drvdata *data) bool disabled; unsigned long flags; - write_lock_irqsave(&data->lock, flags); + spin_lock_irqsave(&data->lock, flags); disabled = set_sysmmu_inactive(data); @@ -449,7 +449,7 @@ static bool __sysmmu_disable(struct sysmmu_drvdata *data) data->activations); } - write_unlock_irqrestore(&data->lock, flags); + spin_unlock_irqrestore(&data->lock, flags); return disabled; } @@ -503,7 +503,7 @@ static int __sysmmu_enable(struct sysmmu_drvdata *data, int ret = 0; unsigned long flags; - write_lock_irqsave(&data->lock, flags); + spin_lock_irqsave(&data->lock, flags); if (set_sysmmu_active(data)) { data->pgtable = pgtable; data->domain = domain; @@ -521,7 +521,7 @@ static int __sysmmu_enable(struct sysmmu_drvdata *data, if (WARN_ON(ret < 0)) set_sysmmu_inactive(data); /* decrement count */ - write_unlock_irqrestore(&data->lock, flags); + spin_unlock_irqrestore(&data->lock, flags); return ret; } @@ -612,7 +612,7 @@ static void sysmmu_tlb_invalidate_entry(struct device *dev, unsigned long iova) data = dev_get_drvdata(client->sysmmu[i]); - read_lock_irqsave(&data->lock, flags); + spin_lock_irqsave(&data->lock, flags); if (is_sysmmu_active(data) && data->runtime_active) { int i; clk_enable(data->clk_master); @@ -625,7 +625,7 @@ static void sysmmu_tlb_invalidate_entry(struct device *dev, unsigned long iova) "disabled. Skipping TLB invalidation @ %#lx\n", iova); } - read_unlock_irqrestore(&data->lock, flags); + spin_unlock_irqrestore(&data->lock, flags); } } @@ -640,7 +640,7 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev) data = dev_get_drvdata(client->sysmmu[i]); - read_lock_irqsave(&data->lock, flags); + spin_lock_irqsave(&data->lock, flags); if (is_sysmmu_active(data) && data->runtime_active) { int i; @@ -656,7 +656,7 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev) } else { dev_dbg(dev, "disabled. Skipping TLB invalidation\n"); } - read_unlock_irqrestore(&data->lock, flags); + spin_unlock_irqrestore(&data->lock, flags); } } @@ -745,7 +745,7 @@ static int __init exynos_sysmmu_probe(struct platform_device *pdev) data->runtime_active = !pm_runtime_enabled(dev); - rwlock_init(&data->lock); + spin_lock_init(&data->lock); platform_set_drvdata(pdev, data); dev_dbg(dev, "Probed and initialized\n"); @@ -758,11 +758,11 @@ static int sysmmu_suspend(struct device *dev) { struct sysmmu_drvdata *data = dev_get_drvdata(dev); unsigned long flags; - read_lock_irqsave(&data->lock, flags); + spin_lock_irqsave(&data->lock, flags); if (is_sysmmu_active(data) && (!pm_runtime_enabled(dev) || data->runtime_active)) __sysmmu_disable_nocount(data); - read_unlock_irqrestore(&data->lock, flags); + spin_unlock_irqrestore(&data->lock, flags); return 0; } @@ -770,11 +770,11 @@ static int sysmmu_resume(struct device *dev) { struct sysmmu_drvdata *data = dev_get_drvdata(dev); unsigned long flags; - read_lock_irqsave(&data->lock, flags); + spin_lock_irqsave(&data->lock, flags); if (is_sysmmu_active(data) && (!pm_runtime_enabled(dev) || data->runtime_active)) __sysmmu_enable_nocount(data); - read_unlock_irqrestore(&data->lock, flags); + spin_unlock_irqrestore(&data->lock, flags); return 0; } #endif