[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH for-next v2 01/10] x86/mm: make free_perdomain_mappings idempotent



Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
Cc: Tim Deegan <tim@xxxxxxx>
Cc: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/mm.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index bd68e56dc7..cdef5c49c4 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -6503,9 +6503,14 @@ void destroy_perdomain_mapping(struct domain *d, 
unsigned long va,
 
 void free_perdomain_mappings(struct domain *d)
 {
-    l3_pgentry_t *l3tab = __map_domain_page(d->arch.perdomain_l3_pg);
+    l3_pgentry_t *l3tab;
     unsigned int i;
 
+    if ( !d->arch.perdomain_l3_pg )
+        return;
+
+    l3tab = __map_domain_page(d->arch.perdomain_l3_pg);
+
     for ( i = 0; i < PERDOMAIN_SLOTS; ++i)
         if ( l3e_get_flags(l3tab[i]) & _PAGE_PRESENT )
         {
@@ -6544,6 +6549,7 @@ void free_perdomain_mappings(struct domain *d)
 
     unmap_domain_page(l3tab);
     free_domheap_page(d->arch.perdomain_l3_pg);
+    d->arch.perdomain_l3_pg = NULL;
 }
 
 #ifdef MEMORY_GUARD
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.