From patchwork Tue Nov 20 07:30:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cho KyongHo X-Patchwork-Id: 1771541 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 220BBDF2AB for ; Tue, 20 Nov 2012 07:35:23 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TaiK8-00047Y-9S; Tue, 20 Nov 2012 07:32:49 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TaiI3-00037h-CA for linux-arm-kernel@lists.infradead.org; Tue, 20 Nov 2012 07:30:42 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MDR00JGWZHYRQQ0@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 20 Nov 2012 16:30:31 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.47]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id C0.58.01231.7913BA05; Tue, 20 Nov 2012 16:30:31 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-5a-50ab319745b7 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id CF.48.01231.7913BA05; Tue, 20 Nov 2012 16:30:31 +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 <0MDR00AEEZIV7VD0@mmp1.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 20 Nov 2012 16:30:31 +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 v2 07/12] iommu/exynos: change rwlock to spinlock Date: Tue, 20 Nov 2012 16:30:31 +0900 Message-id: <002101cdc6f0$ebcb43b0$c361cb10$%cho@samsung.com> MIME-version: 1.0 X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac3G8OurnLtuWF4ITwa+8XYSwK/XGQ== Content-language: ko DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrPIsWRmVeSWpSXmKPExsVy+t8zfd3phqsDDGZfVLbY9PgaqwOjx+Yl 9QGMUVw2Kak5mWWpRfp2CVwZyzt3MRV8V61Yf9KmgfGmfBcjJ4eEgInEng197BC2mMSFe+vZ uhi5OIQEljFKTHu4mxWm6NHVy1CJRYwSO1qOQznLmSTudi4Ga2cT0JJYPfc4I0hCRKCXUeJC /1cmEIdZ4AejxOI3b5hBqoQFHCX6uuYCzeXgYBFQlfg2sRIkzCtgK/Gi4yEbhC0o8WPyPRYQ mxlo6Pqdx5kgbHmJzWveMoO0SgioSzz6qwsSFhHQk1h/Yw8bRImIxL4X7xhBbBYBAYlvkw+x QJTLSmw6wAxyjYRAN7tE37HrLBCfSUocXHGDZQKj2Cwkm2ch2TwLyeZZSFYsYGRZxSiaWpBc UJyUnmuoV5yYW1yal66XnJ+7iRESK1I7GFc2WBxiFOBgVOLhfZiwKkCINbGsuDL3EKMEB7OS CG9TOVCINyWxsiq1KD++qDQntfgQow/Q5ROZpUST84FxnFcSb2hsbGJmYmpibmlqbopDWEmc t9kjJUBIID2xJDU7NbUgtQhmHBMHp1QDY2nFr2vff+kHqRyfzrbRsNCjnqNbIPzE+p3S+dN2 bn82z0/pkMLJByceS+RECYqH5h344S/WK3DeJPxcW4zVEc2pDasmzfzZ/dQy7uRrJYPrk+78 vHFf9cnnggCVDr7gL2KnopXbXrL4dVlPv1y/YMZcJo7D6TePnRTLiD5mtaYhTyfJZFuipBJL cUaioRZzUXEiAOkP8GLCAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrHIsWRmVeSWpSXmKPExsVy+t9jAd3phqsDDKbtkbfY9PgaqwOjx+Yl 9QGMUQ2MNhmpiSmpRQqpecn5KZl56bZK3sHxzvGmZgaGuoaWFuZKCnmJuam2Si4+AbpumTlA U5UUyhJzSoFCAYnFxUr6dpgmhIa46VrANEbo+oYEwfUYGaCBhHWMGcs7dzEVfFetWH/SpoHx pnwXIyeHhICJxKOrl9kgbDGJC/fWA9lcHEICixgldrQch3KWM0nc7VzMDlLFJqAlsXrucUaQ hIhAL6PEhf6vTCAOs8APRonFb94wg1QJCzhK9HXNZe1i5OBgEVCV+DaxEiTMK2Ar8aLjIRuE LSjxY/I9FhCbGWjo+p3HmSBseYnNa94yg7RKCKhLPPqrCxIWEdCTWH9jDxtEiYjEvhfvGCcw CsxCMmkWkkmzkEyahaRlASPLKkbR1ILkguKk9FxDveLE3OLSvHS95PzcTYzgSHwmtYNxZYPF IUYBDkYlHt6HCasChFgTy4orcw8xSnAwK4nwNpUDhXhTEiurUovy44tKc1KLDzH6AP05kVlK NDkfmCTySuINjU3MjCyNzCyMTMzNcQgrifM2e6QECAmkJ5akZqemFqQWwYxj4uCUamA8oh6c lF92wOjGIsNJLkGX56Q+tlYXmjhtfWjh3i15H0NkfrTc0fI6u8tqvZPl39nvVl2fYx8u4tsv UJP9WL1K1sHjWkPlq9XnxP+u2X7n2yfjPZVT3x9mep10c11Jkd2fK2HsDvvfTzR8V9TztTBj NsMqpt7+HTPnJB868yzNUX71k2bzpugGJZbijERDLeai4kQALNCtj/ECAAA= X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121120_023040_403355_E4838655 X-CRM114-Status: GOOD ( 11.13 ) 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.34 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 0191ab5..bab1bf8 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, @@ -754,7 +754,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);