Message ID | 20170426155457.10799-2-wei.liu2@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 26/04/17 16:54, Wei Liu wrote: > Signed-off-by: Wei Liu <wei.liu2@citrix.com> > Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: George Dunlap <george.dunlap@citrix.com> > --- > Cc: Tim Deegan <tim@xen.org> > Cc: George Dunlap <george.dunlap@eu.citrix.com> > Cc: Jan Beulich <jbeulich@suse.com> > Cc: Andrew Cooper <andrew.cooper3@citrix.com> > --- > 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 >
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