From patchwork Wed Dec 26 01:53:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cho KyongHo X-Patchwork-Id: 1910411 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 4E9B83FE37 for ; Wed, 26 Dec 2012 01:57:58 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TngCg-00015D-DP; Wed, 26 Dec 2012 01:54:43 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TngBl-0000pE-NA for linux-arm-kernel@lists.infradead.org; Wed, 26 Dec 2012 01:53:46 +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 <0MFM00AGB7XJ4930@mailout1.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 26 Dec 2012 10:53:43 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.51]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 35.70.12699.7A85AD05; Wed, 26 Dec 2012 10:53:43 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-9d-50da58a7e9e5 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id B4.70.12699.7A85AD05; Wed, 26 Dec 2012 10:53:43 +0900 (KST) Received: from DOPULLIPCHO06 ([12.23.118.152]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MFM00MY77XI4230@mmp2.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 26 Dec 2012 10:53:42 +0900 (KST) From: Cho KyongHo To: 'Linux ARM Kernel' , 'Linux IOMMU' , 'Linux Kernel' , 'Linux Samsung SOC' Subject: [PATCH v6 04/12] iommu/exynos: change rwlock to spinlock Date: Wed, 26 Dec 2012 10:53:42 +0900 Message-id: <003701cde30b$d5754430$805fcc90$%cho@samsung.com> MIME-version: 1.0 X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac3jC9VV+NlFvJ4iRgOn7s6N9B+qcA== Content-language: ko DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrPIsWRmVeSWpSXmKPExsVy+t8zY93lEbcCDE484rbY9PgaqwOjx+Yl 9QGMUVw2Kak5mWWpRfp2CVwZK7ZvZC24oFixckkHcwPjX+kuRk4OCQETiT+P7rBA2GISF+6t Z+ti5OIQEljGKHFvZRsLTNG66UvZIRLTGSUO3l/KCOEsZ5L4feM5K0gVm4CWxOq5xxlBbBGB u4wSL8/zgBQxC/xllPh05hBQOweHsICjxOWT9SA1LAKqEt1Ln4Ft4BWwlfj0fj8rhC0o8WPy PbA4s4CBxPtZfawQtrzE5jVvmUHGSAioSzz6qwuxSk/i3uo7bBAlIhL7XrxjhBgvIPFt8iEW iHJZiU0HmEGukRDoZpeY//Y81GOSEgdX3GCZwCg2C8nmWUg2z0KyeRaSFQsYWVYxiqYWJBcU J6XnGukVJ+YWl+al6yXn525ihMSK9A7GVQ0WhxgFOBiVeHg5f90MEGJNLCuuzD3EKMHBrCTC 6/wRKMSbklhZlVqUH19UmpNafIjRB+jyicxSosn5wDjOK4k3NDY2MTMxNTG3NDU3xSGsJM7b 7JESICSQnliSmp2aWpBaBDOOiYNTqoHRX++k9dc4c1W5/11dWXY9E6dO8tl3e8/zrKWBrj/2 ar9fWW+0dOflrT7a76bypd3ZtFYvwN/8md99VdnTL/XUDpVkGgUJ1TuLpodteiLSov501aX9 75sMODovtT/wuPbhv6v2uvyVy6KvfYr8bGtSusTvQcGEddp3V778bFRYPG31pZxgJZtzSizF GYmGWsxFxYkAy+s/Q8ICAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrHIsWRmVeSWpSXmKPExsVy+t9jQd3lEbcCDKZdZrfY9PgaqwOjx+Yl 9QGMUQ2MNhmpiSmpRQqpecn5KZl56bZK3sHxzvGmZgaGuoaWFuZKCnmJuam2Si4+AbpumTlA U5UUyhJzSoFCAYnFxUr6dpgmhIa46VrANEbo+oYEwfUYGaCBhHWMGSu2b2QtuKBYsXJJB3MD 41/pLkZODgkBE4l105eyQ9hiEhfurWfrYuTiEBKYzihx8P5SRghnOZPE7xvPWUGq2AS0JFbP Pc4IYosI3GWUeHmeB6SIWeAvo8SnM4eARnFwCAs4Slw+WQ9SwyKgKtG99BkLiM0rYCvx6f1+ VghbUOLH5HtgcWYBA4n3s/pYIWx5ic1r3jKDjJEQUJd49FcXYpWexL3Vd9ggSkQk9r14xziB UWAWkkmzkEyahWTSLCQtCxhZVjGKphYkFxQnpeca6RUn5haX5qXrJefnbmIER+Iz6R2Mqxos DjEKcDAq8fBy/roZIMSaWFZcmXuIUYKDWUmE1/kjUIg3JbGyKrUoP76oNCe1+BCjD9CjE5ml RJPzgUkiryTe0NjEzMjSyMzCyMTcHIewkjhvs0dKgJBAemJJanZqakFqEcw4Jg5OqQbG4G1n l/EW3Zw96c6BfWqO93g1nkhMP1sx74PcnRPlNm93/VRhWbBgvbpGkqnQugjRo8ppBnzp0R65 PeW1Zi8yK88s8uPSZ55rMfvnUXab50zF1z7L9/353H+vsSzffvqc50XySqskQqZNM7kRvX7D cU22ZbsvdkbMNi69uOBctv6N2RcEo2RfKrEUZyQaajEXFScCAOUO8RfxAgAA X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121225_205346_091393_3A59FA97 X-CRM114-Status: UNSURE ( 9.29 ) X-CRM114-Notice: Please train this message. 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' , 'Hyunwoong Kim' , 'Prathyush' , 'Joerg Roedel' , 'Subash Patel' , 'Rahul Sharma' 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 | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 58d2a24..5847508 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -166,7 +166,7 @@ struct sysmmu_drvdata { void __iomem **sfrbases; struct clk *clk[2]; int activations; - rwlock_t lock; + spinlock_t lock; struct iommu_domain *domain; unsigned long pgtable; }; @@ -249,7 +249,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; @@ -279,7 +279,7 @@ void exynos_sysmmu_set_prefbuf(struct device *dev, } } finish: - read_unlock_irqrestore(&data->lock, flags); + spin_unlock_irqrestore(&data->lock, flags); } static void __show_fault_information(unsigned long *pgtable, unsigned long iova, @@ -312,7 +312,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)); @@ -354,7 +354,7 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void *dev_id) sysmmu_unblock(data->sfrbases[i]); - read_unlock(&data->lock); + spin_unlock(&data->lock); return IRQ_HANDLED; } @@ -365,7 +365,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; @@ -382,7 +382,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, "(%s) Disabled\n", data->dbgname); @@ -405,7 +405,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)) { @@ -444,7 +444,7 @@ static int __exynos_sysmmu_enable(struct sysmmu_drvdata *data, dev_dbg(data->sysmmu, "(%s) Enabled\n", data->dbgname); finish: - write_unlock_irqrestore(&data->lock, flags); + spin_unlock_irqrestore(&data->lock, flags); return ret; } @@ -491,7 +491,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; @@ -508,7 +508,7 @@ static void sysmmu_tlb_invalidate_entry(struct device *dev, unsigned long iova) data->dbgname); } - read_unlock_irqrestore(&data->lock, flags); + spin_unlock_irqrestore(&data->lock, flags); } void exynos_sysmmu_tlb_invalidate(struct device *dev) @@ -516,7 +516,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; @@ -532,7 +532,7 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev) data->dbgname); } - read_unlock_irqrestore(&data->lock, flags); + spin_unlock_irqrestore(&data->lock, flags); } static int exynos_sysmmu_probe(struct platform_device *pdev) @@ -629,7 +629,7 @@ static int exynos_sysmmu_probe(struct platform_device *pdev) } data->sysmmu = dev; - rwlock_init(&data->lock); + spin_lock_init(&data->lock); INIT_LIST_HEAD(&data->node); if (dev->parent)