From patchwork Thu Jul 28 14:20:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 72952 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp880126qga; Thu, 28 Jul 2016 07:23:47 -0700 (PDT) X-Received: by 10.107.59.7 with SMTP id i7mr40386088ioa.190.1469715827018; Thu, 28 Jul 2016 07:23:47 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id h65si33474069ite.106.2016.07.28.07.23.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jul 2016 07:23:47 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bSmBN-0007lV-VA; Thu, 28 Jul 2016 14:21:05 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bSmBM-0007kK-Um for xen-devel@lists.xen.org; Thu, 28 Jul 2016 14:21:05 +0000 Received: from [85.158.139.211] by server-5.bemta-5.messagelabs.com id 3D/93-30284-0D41A975; Thu, 28 Jul 2016 14:21:04 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTfe8yKx wg+kbdS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oyntz6wFuzkr7jzajNLA2M7TxcjF4eQwCZG ib5715i6GDmBnNOMEnd/c4HYbAKaEnc+fwKLiwhIS1z7fJkRpIFZoJ1RYm1/L3MXIweHsICTx LHlBiA1LAKqEp/mvWIDsXkFnCX6D11jBLElBOQkTh6bzApicwq4SNxr+84KsctZ4vTd7ewTGL kXMDKsYtQoTi0qSy3SNTLWSyrKTM8oyU3MzNE1NDDVy00tLk5MT81JTCrWS87P3cQI9G89AwP jDsYd7X6HGCU5mJREecNCZ4YL8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuB1E54VLiRYlJqeWpGW mQMMNJi0BAePkghvJEiat7ggMbc4Mx0idYpRUUqc95cQUEIAJJFRmgfXBgvuS4yyUsK8jAwMD EI8BalFuZklqPKvGMU5GJWEeXNBxvNk5pXATX8FtJgJaHFx7AyQxSWJCCmpBkb712V/dQ9JzB V+MHkF3/LXzxzZRJn7VWr9Ex6tSGCa4OyYVit3unhha5To+tLv/IYN32XLcxwtH+nbb3lwd3m f3YeyiNdR3ze/5Y7Nt7qmkWvnWjl1wTZWB51zaUn2ri6qT5Z+0cyTM9kYH606ycbD5o7oBsXq Fk3FaYWGrR8OBt3Tfh/fr8RSnJFoqMVcVJwIABH61ThpAgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-5.tower-206.messagelabs.com!1469715663!50195193!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 46692 invoked from network); 28 Jul 2016 14:21:03 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-5.tower-206.messagelabs.com with SMTP; 28 Jul 2016 14:21:03 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 171C4BA6; Thu, 28 Jul 2016 07:21:50 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.218.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DD5023F21A; Thu, 28 Jul 2016 07:20:31 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Thu, 28 Jul 2016 15:20:10 +0100 Message-Id: <1469715620-4670-6-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469715620-4670-1-git-send-email-julien.grall@arm.com> References: <1469715620-4670-1-git-send-email-julien.grall@arm.com> Cc: proskurin@sec.in.tum.de, Julien Grall , sstabellini@kernel.org, steve.capper@arm.com, wei.chen@linaro.org Subject: [Xen-devel] [PATCH v2 05/15] xen/arm: p2m: Remove unnecessary locking X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" The p2m is not yet in use when p2m_init and p2m_allocate_table are called. Furthermore the p2m is not used anymore when p2m_teardown is called. So taking the p2m lock is not necessary. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- Changes in v2: - Add Stefano's reviewed-by --- xen/arch/arm/p2m.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 08f3f17..bcccaa4 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1266,8 +1266,6 @@ int p2m_alloc_table(struct domain *d) if ( page == NULL ) return -ENOMEM; - spin_lock(&p2m->lock); - /* Clear both first level pages */ for ( i = 0; i < P2M_ROOT_PAGES; i++ ) clear_and_clean_page(page + i); @@ -1283,8 +1281,6 @@ int p2m_alloc_table(struct domain *d) */ flush_tlb_domain(d); - spin_unlock(&p2m->lock); - return 0; } @@ -1349,8 +1345,6 @@ void p2m_teardown(struct domain *d) struct p2m_domain *p2m = &d->arch.p2m; struct page_info *pg; - spin_lock(&p2m->lock); - while ( (pg = page_list_remove_head(&p2m->pages)) ) free_domheap_page(pg); @@ -1362,8 +1356,6 @@ void p2m_teardown(struct domain *d) p2m_free_vmid(d); radix_tree_destroy(&p2m->mem_access_settings, NULL); - - spin_unlock(&p2m->lock); } int p2m_init(struct domain *d) @@ -1374,12 +1366,11 @@ int p2m_init(struct domain *d) spin_lock_init(&p2m->lock); INIT_PAGE_LIST_HEAD(&p2m->pages); - spin_lock(&p2m->lock); p2m->vmid = INVALID_VMID; rc = p2m_alloc_vmid(d); if ( rc != 0 ) - goto err; + return rc; d->arch.vttbr = 0; @@ -1392,9 +1383,6 @@ int p2m_init(struct domain *d) p2m->mem_access_enabled = false; radix_tree_init(&p2m->mem_access_settings); -err: - spin_unlock(&p2m->lock); - return rc; }