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

[Xen-changelog] [xen master] x86/domain: factor out pv_vcpu_destroy



commit 3496fc8fb5cfadaa049796069bc5daf634a00c8d
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Mon Apr 24 14:37:48 2017 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Wed Jun 7 12:15:56 2017 +0100

    x86/domain: factor out pv_vcpu_destroy
    
    The function is made idempotent on purpose. Note that free_compat_l4,
    release_compat_l4 and pv_destroy_gdt_ldt_l1tab are idempotent already.
    
    No functional change.
    
    Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/domain.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 673a6d9..5294146 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -487,17 +487,24 @@ int vcpu_initialise(struct vcpu *v)
     return rc;
 }
 
-void vcpu_destroy(struct vcpu *v)
+static void pv_vcpu_destroy(struct vcpu *v)
 {
-    xfree(v->arch.vm_event);
-    v->arch.vm_event = NULL;
-
     if ( is_pv_32bit_vcpu(v) )
     {
         free_compat_arg_xlat(v);
         release_compat_l4(v);
     }
 
+    pv_destroy_gdt_ldt_l1tab(v);
+    xfree(v->arch.pv_vcpu.trap_ctxt);
+    v->arch.pv_vcpu.trap_ctxt = NULL;
+}
+
+void vcpu_destroy(struct vcpu *v)
+{
+    xfree(v->arch.vm_event);
+    v->arch.vm_event = NULL;
+
     vcpu_destroy_fpu(v);
 
     if ( !is_idle_domain(v->domain) )
@@ -506,10 +513,7 @@ void vcpu_destroy(struct vcpu *v)
     if ( is_hvm_vcpu(v) )
         hvm_vcpu_destroy(v);
     else
-    {
-        pv_destroy_gdt_ldt_l1tab(v);
-        xfree(v->arch.pv_vcpu.trap_ctxt);
-    }
+        pv_vcpu_destroy(v);
 }
 
 static bool emulation_flags_ok(const struct domain *d, uint32_t emflags)
--
generated by git-patchbot for /home/xen/git/xen.git#master

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

 


Rackspace

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