From patchwork Wed Jul 20 16:10:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 72453 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp66629qga; Wed, 20 Jul 2016 09:14:32 -0700 (PDT) X-Received: by 10.107.183.132 with SMTP id h126mr18481406iof.87.1469031270082; Wed, 20 Jul 2016 09:14:30 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id k198si11941214itb.97.2016.07.20.09.14.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jul 2016 09:14:30 -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 1bPu63-0007iC-FD; Wed, 20 Jul 2016 16:11:43 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPu61-0007fr-Bc for xen-devel@lists.xen.org; Wed, 20 Jul 2016 16:11:42 +0000 Received: from [193.109.254.147] by server-15.bemta-14.messagelabs.com id DE/97-30359-CB2AF875; Wed, 20 Jul 2016 16:11:40 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKLMWRWlGSWpSXmKPExsVysyfVTXf3ov5 wg0M/lC2WfFzM4sDocXT3b6YAxijWzLyk/IoE1ownnZ2MBUf4KlYee8/cwLiau4uRi0NIYBOj RNfnZiYI5zSjxIv2Z0AOJwebgKbEnc+fwGwRAWmJa58vM4IUMQu0M0os3/iPBSQhLGAvMff7N CCbnYNFQFViWi1IlFfAVeLNjT3sILaEgJzEyWOTWUFsTqD4+ZM/GUFsIQEXiU1vvzFPYORewM iwilG9OLWoLLVI10wvqSgzPaMkNzEzR9fQ0EQvN7W4ODE9NScxqVgvOT93EyPQuwxAsIPx7wT nQ4ySHExKoryqor3hQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR4pRb2hwsJFqWmp1akZeYAwwwm LcHBoyTCywWS5i0uSMwtzkyHSJ1iVJQS53UHSQiAJDJK8+DaYKF9iVFWSpiXEegQIZ6C1KLcz BJU+VeM4hyMSsK8gSBTeDLzSuCmvwJazAS0eI4A2OKSRISUVAOjT0HozW7eCyqzju76GGom8v +usUPjnZsW0Tc/rLc/uHDpHLeVH+/xSLe9a//Y1dxYd9bZ1IJ9qlh31/dgj++nFpskNU2ZwcN 3a87B79Mau69Olc3yLwg0OFUZGNW/YdrFyPL7RyW2iijyZHw9F3tla8hibr7dfIIR2dG2L1lS 8zW5XstfqvFXYinOSDTUYi4qTgQAc7Re92gCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-14.tower-27.messagelabs.com!1469031098!42839585!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 9860 invoked from network); 20 Jul 2016 16:11:39 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-14.tower-27.messagelabs.com with SMTP; 20 Jul 2016 16:11:39 -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 43CBABF1; Wed, 20 Jul 2016 09:12:49 -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 988B93F387; Wed, 20 Jul 2016 09:11:37 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 20 Jul 2016 17:10:54 +0100 Message-Id: <1469031064-23344-13-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469031064-23344-1-git-send-email-julien.grall@arm.com> References: <1469031064-23344-1-git-send-email-julien.grall@arm.com> Cc: proskurin@sec.in.tum.de, Julien Grall , sstabellini@kernel.org, wei.chen@linaro.org, steve.capper@arm.com Subject: [Xen-devel] [PATCH 12/22] 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 --- 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 2f50b4f..4c279dc 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1267,8 +1267,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); @@ -1284,8 +1282,6 @@ int p2m_alloc_table(struct domain *d) */ flush_tlb_domain(d); - spin_unlock(&p2m->lock); - return 0; } @@ -1350,8 +1346,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); @@ -1363,8 +1357,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) @@ -1375,12 +1367,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; @@ -1393,9 +1384,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; }