WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 09 of 13] x86/mm/p2m: Fix locking discipline around p

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 09 of 13] x86/mm/p2m: Fix locking discipline around p2m updates
From: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Date: Fri, 13 May 2011 17:28:51 +0100
Delivery-date: Fri, 13 May 2011 09:36:29 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1305304122@xxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1305304122@xxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.6.4
# HG changeset patch
# User Tim Deegan <Tim.Deegan@xxxxxxxxxx>
# Date 1305302439 -3600
# Node ID f2b42201dc1a2fea7f0dbf36c511b780caf55c85
# Parent  6d09021a0e2dfd15816e2c0f62fcc9b01c1a7562
x86/mm/p2m: Fix locking discipline around p2m updates.

Direct callers of the p2m setting functions must hold the p2m lock.

Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxx>

diff -r 6d09021a0e2d -r f2b42201dc1a xen/arch/x86/mm/hap/nested_hap.c
--- a/xen/arch/x86/mm/hap/nested_hap.c  Fri May 13 17:00:39 2011 +0100
+++ b/xen/arch/x86/mm/hap/nested_hap.c  Fri May 13 17:00:39 2011 +0100
@@ -103,9 +103,12 @@ nestedhap_fix_p2m(struct p2m_domain *p2m
     ASSERT(p2m);
     ASSERT(p2m->set_entry);
 
-    rv = p2m->set_entry(p2m, L2_gpa >> PAGE_SHIFT,
+    p2m_lock(p2m);
+    rv = set_p2m_entry(p2m, L2_gpa >> PAGE_SHIFT,
                          page_to_mfn(maddr_to_page(L0_gpa)),
                          0 /*4K*/, p2mt, p2ma);
+    p2m_unlock(p2m);
+
     if (rv == 0) {
         gdprintk(XENLOG_ERR,
                "failed to set entry for 0x%"PRIx64" -> 0x%"PRIx64"\n",
diff -r 6d09021a0e2d -r f2b42201dc1a xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c     Fri May 13 17:00:39 2011 +0100
+++ b/xen/arch/x86/mm/p2m.c     Fri May 13 17:00:39 2011 +0100
@@ -148,6 +148,8 @@ int set_p2m_entry(struct p2m_domain *p2m
     unsigned int order;
     int rc = 1;
 
+    ASSERT(p2m_locked_by_me(p2m));
+
     while ( todo )
     {
         if ( hap_enabled(d) )

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel