diff mbox

[RFC,3/9] x86/HVM: Call vlapic_destroy after vcpu_destroy

Message ID 1474264368-4104-4-git-send-email-suravee.suthikulpanit@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Suravee Suthikulpanit Sept. 19, 2016, 5:52 a.m. UTC
Since vlapic_init() is called before vcpu_initialise().
We should also follow the same order here.

Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
 xen/arch/x86/hvm/hvm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Konrad Rzeszutek Wilk Oct. 12, 2016, 7:02 p.m. UTC | #1
On Mon, Sep 19, 2016 at 12:52:42AM -0500, Suravee Suthikulpanit wrote:
> Since vlapic_init() is called before vcpu_initialise().
> We should also follow the same order here.
> 
> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

But it would also be good to CC the Intel VMX maintainers in case they
spot something in vmx_vcpu_destroy.

> ---
>  xen/arch/x86/hvm/hvm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
> index 7bad845..fb5bf6c 100644
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -1606,10 +1606,10 @@ void hvm_vcpu_destroy(struct vcpu *v)
>      tasklet_kill(&v->arch.hvm_vcpu.assert_evtchn_irq_tasklet);
>      hvm_vcpu_cacheattr_destroy(v);
>  
> +    hvm_funcs.vcpu_destroy(v);
> +
>      if ( is_hvm_vcpu(v) )
>          vlapic_destroy(v);
> -
> -    hvm_funcs.vcpu_destroy(v);
>  }
>  
>  void hvm_vcpu_down(struct vcpu *v)
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel
Jan Beulich Dec. 22, 2016, 11:09 a.m. UTC | #2
>>> On 19.09.16 at 07:52, <suravee.suthikulpanit@amd.com> wrote:
> Since vlapic_init() is called before vcpu_initialise().
> We should also follow the same order here.

s/same/inverse/?

Also the ordering issue extends to other calls, and I think if at all
possible we should then do all the teardown in reverse order of
init.

Jan
diff mbox

Patch

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 7bad845..fb5bf6c 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1606,10 +1606,10 @@  void hvm_vcpu_destroy(struct vcpu *v)
     tasklet_kill(&v->arch.hvm_vcpu.assert_evtchn_irq_tasklet);
     hvm_vcpu_cacheattr_destroy(v);
 
+    hvm_funcs.vcpu_destroy(v);
+
     if ( is_hvm_vcpu(v) )
         vlapic_destroy(v);
-
-    hvm_funcs.vcpu_destroy(v);
 }
 
 void hvm_vcpu_down(struct vcpu *v)