diff mbox

[v2,03/10] x86/HVM: Call vlapic_destroy after vcpu_destroy

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

Commit Message

Suravee Suthikulpanit Dec. 31, 2016, 5:45 a.m. UTC
Since vlapic_init() is called before vcpu_initialise().
We should call the destroy functions in the the reverse order here.

Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Jun Nakajima <jun.nakajima@intel.com>
Cc: Kevin Tian <kevin.tian@intel.com>
---
 xen/arch/x86/hvm/hvm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Tian, Kevin Jan. 5, 2017, 2:56 a.m. UTC | #1
> From: Suravee Suthikulpanit [mailto:suravee.suthikulpanit@amd.com]
> Sent: Saturday, December 31, 2016 1:46 PM
> 
> Since vlapic_init() is called before vcpu_initialise().
> We should call the destroy functions in the the reverse order here.
> 
> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Cc: Jun Nakajima <jun.nakajima@intel.com>
> Cc: Kevin Tian <kevin.tian@intel.com>
> ---
>  xen/arch/x86/hvm/hvm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Reviewed-by: Kevin Tian <kevin.tian@intel.com>. btw since it's a general
fix, maybe you can send it separately.

Thanks
Kevin
Jan Beulich Jan. 5, 2017, 3:56 p.m. UTC | #2
>>> On 31.12.16 at 06:45, <suravee.suthikulpanit@amd.com> wrote:
> Since vlapic_init() is called before vcpu_initialise().
> We should call the destroy functions in the the reverse order here.

Double "the". And to quote from my RFC reply:

"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."

Is there anything preventing this?

Jan
Suravee Suthikulpanit Jan. 10, 2017, 8:18 a.m. UTC | #3
On 01/05/2017 10:56 PM, Jan Beulich wrote:
>>>> On 31.12.16 at 06:45, <suravee.suthikulpanit@amd.com> wrote:
>> Since vlapic_init() is called before vcpu_initialise().
>> We should call the destroy functions in the the reverse order here.
>
> Double "the". And to quote from my RFC reply:
>
> "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."
>
> Is there anything preventing this?
>
> Jan
>

Ah, sorry. I didn't get what you tried to say earlier. I see now that 
you want to change the teardown order in hvm_vcpu_destroy() to follow 
the teardown order (i.e. the "failX:") in hvm_vcpu_initialize().

Thanks,
Suravee
diff mbox

Patch

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 25dc759..d573f0f 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1613,10 +1613,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)