From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: [PATCH V2 24/40] arm: fix locking in create_p2m_entries Date: Tue, 26 Jun 2012 10:29:48 +0000 Message-ID: <1340706604-1313-24-git-send-email-ian.campbell@citrix.com> References: <1340706574.3832.57.camel@zakaz.uk.xensource.com> <1340706604-1313-1-git-send-email-ian.campbell@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1340706604-1313-1-git-send-email-ian.campbell@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Ian Campbell List-Id: xen-devel@lists.xenproject.org For some reason we were holding the lock over only the unmaps at the end of the function, rather than for the whole walk. We might want to be more clever in the future, but for now lets just lock for the whole walk+create process. Signed-off-by: Ian Campbell Acked-by: Tim Deegan --- xen/arch/arm/p2m.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 35bfa2f..5f20246 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -132,6 +132,8 @@ static int create_p2m_entries(struct domain *d, paddr_t addr; unsigned long cur_first_offset = ~0, cur_second_offset = ~0; + spin_lock(&p2m->lock); + /* XXX Don't actually handle 40 bit guest physical addresses */ BUG_ON(start_gpaddr & 0x8000000000ULL); BUG_ON(end_gpaddr & 0x8000000000ULL); @@ -213,8 +215,6 @@ static int create_p2m_entries(struct domain *d, rc = 0; out: - spin_lock(&p2m->lock); - if (third) unmap_domain_page(third); if (second) unmap_domain_page(second); if (first) unmap_domain_page(first); -- 1.7.9.1