All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] x86/HVM: Fix teardown ordering in hvm_vcpu_destroy()
@ 2017-01-10 14:03 Suravee Suthikulpanit
  2017-01-10 14:15 ` Andrew Cooper
  0 siblings, 1 reply; 6+ messages in thread
From: Suravee Suthikulpanit @ 2017-01-10 14:03 UTC (permalink / raw)
  To: xen-devel
  Cc: kevin.tian, Suravee Suthikulpanit, andrew.cooper3, jbeulich,
	sherry.hurwitz, boris.ostrovsky

The order of destroy function calls in hvm_vcpu_destroy() should be
the reverse of init calls in hvm_vcpu_initialise().

Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
Note: I separate this out from the previously sent AMD SVM AVIC patch
series since this is a standalone fix.

 xen/arch/x86/hvm/hvm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 25dc759..d465596 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1610,13 +1610,13 @@ void hvm_vcpu_destroy(struct vcpu *v)
 
     free_compat_arg_xlat(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);
+    tasklet_kill(&v->arch.hvm_vcpu.assert_evtchn_irq_tasklet);
+    hvm_vcpu_cacheattr_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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] x86/HVM: Fix teardown ordering in hvm_vcpu_destroy()
  2017-01-10 14:03 [PATCH v3] x86/HVM: Fix teardown ordering in hvm_vcpu_destroy() Suravee Suthikulpanit
@ 2017-01-10 14:15 ` Andrew Cooper
  2017-01-10 14:26   ` Andrew Cooper
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Cooper @ 2017-01-10 14:15 UTC (permalink / raw)
  To: Suravee Suthikulpanit, xen-devel
  Cc: boris.ostrovsky, sherry.hurwitz, kevin.tian, jbeulich

On 10/01/17 14:03, Suravee Suthikulpanit wrote:
> The order of destroy function calls in hvm_vcpu_destroy() should be
> the reverse of init calls in hvm_vcpu_initialise().
>
> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> and queued.

> ---
> Note: I separate this out from the previously sent AMD SVM AVIC patch
> series since this is a standalone fix.
>
>  xen/arch/x86/hvm/hvm.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
> index 25dc759..d465596 100644
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -1610,13 +1610,13 @@ void hvm_vcpu_destroy(struct vcpu *v)
>  
>      free_compat_arg_xlat(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);
> +    tasklet_kill(&v->arch.hvm_vcpu.assert_evtchn_irq_tasklet);
> +    hvm_vcpu_cacheattr_destroy(v);
>  }
>  
>  void hvm_vcpu_down(struct vcpu *v)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] x86/HVM: Fix teardown ordering in hvm_vcpu_destroy()
  2017-01-10 14:15 ` Andrew Cooper
@ 2017-01-10 14:26   ` Andrew Cooper
  2017-01-10 14:42     ` Jan Beulich
  2017-01-10 16:29     ` Suravee Suthikulpanit
  0 siblings, 2 replies; 6+ messages in thread
From: Andrew Cooper @ 2017-01-10 14:26 UTC (permalink / raw)
  To: Suravee Suthikulpanit, xen-devel
  Cc: boris.ostrovsky, kevin.tian, jbeulich, sherry.hurwitz

On 10/01/17 14:15, Andrew Cooper wrote:
> On 10/01/17 14:03, Suravee Suthikulpanit wrote:
>> The order of destroy function calls in hvm_vcpu_destroy() should be
>> the reverse of init calls in hvm_vcpu_initialise().
>>
>> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
>> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
>> Cc: Jan Beulich <jbeulich@suse.com>
>> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> and queued.

Wait no.

The order in vcpu_initialise is

hvm_vcpu_cacheattr_init()
vlapic_init()
hvm_funcs.vcpu_initialise()
softirq_tasklet_init()
setup_compat_arg_xlat()

Therefore, moving the tasklet_kill() is wrong.

The overall delta should be:

andrewcoop@andrewcoop:/local/xen.git/xen$ git diff HEAD^
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 4c0f561..9f74334 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1626,12 +1626,12 @@ void hvm_vcpu_destroy(struct vcpu *v)
     free_compat_arg_xlat(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);
+    hvm_vcpu_cacheattr_destroy(v);
 }
 
IIRC.

If you agree, I will fold this correction in while committing.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] x86/HVM: Fix teardown ordering in hvm_vcpu_destroy()
  2017-01-10 14:26   ` Andrew Cooper
@ 2017-01-10 14:42     ` Jan Beulich
  2017-01-11  5:50       ` Tian, Kevin
  2017-01-10 16:29     ` Suravee Suthikulpanit
  1 sibling, 1 reply; 6+ messages in thread
From: Jan Beulich @ 2017-01-10 14:42 UTC (permalink / raw)
  To: Suravee Suthikulpanit, Andrew Cooper
  Cc: kevin.tian, xen-devel, boris.ostrovsky, sherry.hurwitz

>>> On 10.01.17 at 15:26, <andrew.cooper3@citrix.com> wrote:
> On 10/01/17 14:15, Andrew Cooper wrote:
>> On 10/01/17 14:03, Suravee Suthikulpanit wrote:
>>> The order of destroy function calls in hvm_vcpu_destroy() should be
>>> the reverse of init calls in hvm_vcpu_initialise().
>>>
>>> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
>>> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>>> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
>>> Cc: Jan Beulich <jbeulich@suse.com>
>>> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
>> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> and queued.
> 
> Wait no.

Which clearly suggests that the earlier R-b-s should have been
dropped too.

> The order in vcpu_initialise is
> 
> hvm_vcpu_cacheattr_init()
> vlapic_init()
> hvm_funcs.vcpu_initialise()
> softirq_tasklet_init()
> setup_compat_arg_xlat()
> 
> Therefore, moving the tasklet_kill() is wrong.
> 
> The overall delta should be:
> 
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -1626,12 +1626,12 @@ void hvm_vcpu_destroy(struct vcpu *v)
>      free_compat_arg_xlat(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);
> +    hvm_vcpu_cacheattr_destroy(v);
>  }
>  
> IIRC.
> 
> If you agree, I will fold this correction in while committing.

This variant is
Reviewed-by: Jan Beulich <jbeulich@suse.com>

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] x86/HVM: Fix teardown ordering in hvm_vcpu_destroy()
  2017-01-10 14:26   ` Andrew Cooper
  2017-01-10 14:42     ` Jan Beulich
@ 2017-01-10 16:29     ` Suravee Suthikulpanit
  1 sibling, 0 replies; 6+ messages in thread
From: Suravee Suthikulpanit @ 2017-01-10 16:29 UTC (permalink / raw)
  To: Andrew Cooper, xen-devel
  Cc: boris.ostrovsky, kevin.tian, jbeulich, sherry.hurwitz



On 1/10/17 21:26, Andrew Cooper wrote:
> On 10/01/17 14:15, Andrew Cooper wrote:
>> On 10/01/17 14:03, Suravee Suthikulpanit wrote:
>>> The order of destroy function calls in hvm_vcpu_destroy() should be
>>> the reverse of init calls in hvm_vcpu_initialise().
>>>
>>> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
>>> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>>> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
>>> Cc: Jan Beulich <jbeulich@suse.com>
>>> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
>> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> and queued.
>
> Wait no.
>
> The order in vcpu_initialise is
>
> hvm_vcpu_cacheattr_init()
> vlapic_init()
> hvm_funcs.vcpu_initialise()
> softirq_tasklet_init()
> setup_compat_arg_xlat()
>
> Therefore, moving the tasklet_kill() is wrong.
>
> The overall delta should be:
>
> andrewcoop@andrewcoop:/local/xen.git/xen$ git diff HEAD^
> diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
> index 4c0f561..9f74334 100644
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -1626,12 +1626,12 @@ void hvm_vcpu_destroy(struct vcpu *v)
>      free_compat_arg_xlat(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);
> +    hvm_vcpu_cacheattr_destroy(v);
>  }
>
> IIRC.
>
> If you agree, I will fold this correction in while committing.
>
> ~Andrew
>

Ah, right... sorry I missed the tasklet stuff.

Thanks,
Suravee

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] x86/HVM: Fix teardown ordering in hvm_vcpu_destroy()
  2017-01-10 14:42     ` Jan Beulich
@ 2017-01-11  5:50       ` Tian, Kevin
  0 siblings, 0 replies; 6+ messages in thread
From: Tian, Kevin @ 2017-01-11  5:50 UTC (permalink / raw)
  To: Jan Beulich, Suravee Suthikulpanit, Andrew Cooper
  Cc: boris.ostrovsky, xen-devel, sherry.hurwitz

> From: Jan Beulich [mailto:JBeulich@suse.com]
> Sent: Tuesday, January 10, 2017 10:42 PM
> 
> >>> On 10.01.17 at 15:26, <andrew.cooper3@citrix.com> wrote:
> > On 10/01/17 14:15, Andrew Cooper wrote:
> >> On 10/01/17 14:03, Suravee Suthikulpanit wrote:
> >>> The order of destroy function calls in hvm_vcpu_destroy() should be
> >>> the reverse of init calls in hvm_vcpu_initialise().
> >>>
> >>> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> >>> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> >>> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> >>> Cc: Jan Beulich <jbeulich@suse.com>
> >>> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> >> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> and queued.
> >
> > Wait no.
> 
> Which clearly suggests that the earlier R-b-s should have been
> dropped too.
> 
> > The order in vcpu_initialise is
> >
> > hvm_vcpu_cacheattr_init()
> > vlapic_init()
> > hvm_funcs.vcpu_initialise()
> > softirq_tasklet_init()
> > setup_compat_arg_xlat()
> >
> > Therefore, moving the tasklet_kill() is wrong.
> >
> > The overall delta should be:
> >
> > --- a/xen/arch/x86/hvm/hvm.c
> > +++ b/xen/arch/x86/hvm/hvm.c
> > @@ -1626,12 +1626,12 @@ void hvm_vcpu_destroy(struct vcpu *v)
> >      free_compat_arg_xlat(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);
> > +    hvm_vcpu_cacheattr_destroy(v);
> >  }
> >
> > IIRC.
> >
> > If you agree, I will fold this correction in while committing.
> 
> This variant is
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> 
> Jan

here is my updated Reviewed-by: Kevin Tian <kevin.tian@intel.com>
with Andrew's change.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-01-11  5:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-10 14:03 [PATCH v3] x86/HVM: Fix teardown ordering in hvm_vcpu_destroy() Suravee Suthikulpanit
2017-01-10 14:15 ` Andrew Cooper
2017-01-10 14:26   ` Andrew Cooper
2017-01-10 14:42     ` Jan Beulich
2017-01-11  5:50       ` Tian, Kevin
2017-01-10 16:29     ` Suravee Suthikulpanit

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.