|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/domain: factor out pv_domain_destroy
commit 85dd07f8dee54d4947d9893d58122b8f727e6bb8
Author: Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Fri Apr 7 15:49:42 2017 +0100
Commit: Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Wed Jun 7 12:15:56 2017 +0100
x86/domain: factor out pv_domain_destroy
Now this function also frees the perdomain mapping. It is safe to do so
because destroy_perdomain_mapping is idempotent.
Move free_perdomain_mappings after pv_domain_destroy. It is safe to do
so because both destroy_perdomain_mapping and free_perdomain_mappings
are idempotent.
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
xen/arch/x86/domain.c | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 0f92224..0046661 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -538,6 +538,18 @@ static bool emulation_flags_ok(const struct domain *d,
uint32_t emflags)
return true;
}
+static void pv_domain_destroy(struct domain *d)
+{
+ destroy_perdomain_mapping(d, GDT_LDT_VIRT_START,
+ GDT_LDT_MBYTES << (20 - PAGE_SHIFT));
+
+ xfree(d->arch.pv_domain.cpuidmasks);
+ d->arch.pv_domain.cpuidmasks = NULL;
+
+ free_xenheap_page(d->arch.pv_domain.gdt_ldt_l1tab);
+ d->arch.pv_domain.gdt_ldt_l1tab = NULL;
+}
+
int arch_domain_create(struct domain *d, unsigned int domcr_flags,
struct xen_arch_domainconfig *config)
{
@@ -717,12 +729,10 @@ int arch_domain_create(struct domain *d, unsigned int
domcr_flags,
xfree(d->arch.cpuid);
if ( paging_initialised )
paging_final_teardown(d);
- free_perdomain_mappings(d);
if ( is_pv_domain(d) )
- {
- xfree(d->arch.pv_domain.cpuidmasks);
- free_xenheap_page(d->arch.pv_domain.gdt_ldt_l1tab);
- }
+ pv_domain_destroy(d);
+ free_perdomain_mappings(d);
+
return rc;
}
@@ -740,12 +750,9 @@ void arch_domain_destroy(struct domain *d)
paging_final_teardown(d);
- free_perdomain_mappings(d);
if ( is_pv_domain(d) )
- {
- free_xenheap_page(d->arch.pv_domain.gdt_ldt_l1tab);
- xfree(d->arch.pv_domain.cpuidmasks);
- }
+ pv_domain_destroy(d);
+ free_perdomain_mappings(d);
free_xenheap_page(d->shared_info);
cleanup_domain_irq_mapping(d);
--
generated by git-patchbot for /home/xen/git/xen.git#master
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |