diff mbox

[v2,2/4] VMX: Cleanup PI per-cpu blocking list when vcpu is destroyed

Message ID 1464269954-8056-3-git-send-email-feng.wu@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wu, Feng May 26, 2016, 1:39 p.m. UTC
We should remove the vCPU from the per-cpu blocking list
if it is going to be destroyed.

Signed-off-by: Feng Wu <feng.wu@intel.com>
---
 xen/arch/x86/hvm/vmx/vmx.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Jan Beulich May 27, 2016, 1:49 p.m. UTC | #1
>>> On 26.05.16 at 15:39, <feng.wu@intel.com> wrote:
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -366,6 +366,7 @@ static void vmx_vcpu_destroy(struct vcpu *v)
>      vmx_destroy_vmcs(v);
>      vpmu_destroy(v);
>      passive_domain_destroy(v);
> +    vmx_pi_blocking_cleanup(v);
>  }

Isn't this redundant with the cleanup done when the last device
gets removed (via pci_release_devices()) during domain cleanup?

Jan
Wu, Feng May 31, 2016, 10:22 a.m. UTC | #2
> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@suse.com]
> Sent: Friday, May 27, 2016 9:49 PM
> To: Wu, Feng <feng.wu@intel.com>
> Cc: andrew.cooper3@citrix.com; dario.faggioli@citrix.com;
> george.dunlap@eu.citrix.com; Tian, Kevin <kevin.tian@intel.com>; xen-
> devel@lists.xen.org; konrad.wilk@oracle.com; keir@xen.org
> Subject: Re: [PATCH v2 2/4] VMX: Cleanup PI per-cpu blocking list when vcpu is
> destroyed
> 
> >>> On 26.05.16 at 15:39, <feng.wu@intel.com> wrote:
> > --- a/xen/arch/x86/hvm/vmx/vmx.c
> > +++ b/xen/arch/x86/hvm/vmx/vmx.c
> > @@ -366,6 +366,7 @@ static void vmx_vcpu_destroy(struct vcpu *v)
> >      vmx_destroy_vmcs(v);
> >      vpmu_destroy(v);
> >      passive_domain_destroy(v);
> > +    vmx_pi_blocking_cleanup(v);
> >  }
> 
> Isn't this redundant with the cleanup done when the last device
> gets removed (via pci_release_devices()) during domain cleanup?

We need to handle the following two cases:
- the last device gets removed (via 'xl pci-detach ...'), and the guest
is running after that. The logical in vmx_pi_hooks_deassign() cover
this case.
- the guest is shutting down. It is covered here.

Thanks,
Feng

> 
> Jan
Jan Beulich May 31, 2016, 11:54 a.m. UTC | #3
>>> On 31.05.16 at 12:22, <feng.wu@intel.com> wrote:

> 
>> -----Original Message-----
>> From: Jan Beulich [mailto:JBeulich@suse.com]
>> Sent: Friday, May 27, 2016 9:49 PM
>> To: Wu, Feng <feng.wu@intel.com>
>> Cc: andrew.cooper3@citrix.com; dario.faggioli@citrix.com;
>> george.dunlap@eu.citrix.com; Tian, Kevin <kevin.tian@intel.com>; xen-
>> devel@lists.xen.org; konrad.wilk@oracle.com; keir@xen.org 
>> Subject: Re: [PATCH v2 2/4] VMX: Cleanup PI per-cpu blocking list when vcpu 
> is
>> destroyed
>> 
>> >>> On 26.05.16 at 15:39, <feng.wu@intel.com> wrote:
>> > --- a/xen/arch/x86/hvm/vmx/vmx.c
>> > +++ b/xen/arch/x86/hvm/vmx/vmx.c
>> > @@ -366,6 +366,7 @@ static void vmx_vcpu_destroy(struct vcpu *v)
>> >      vmx_destroy_vmcs(v);
>> >      vpmu_destroy(v);
>> >      passive_domain_destroy(v);
>> > +    vmx_pi_blocking_cleanup(v);
>> >  }
>> 
>> Isn't this redundant with the cleanup done when the last device
>> gets removed (via pci_release_devices()) during domain cleanup?
> 
> We need to handle the following two cases:
> - the last device gets removed (via 'xl pci-detach ...'), and the guest
> is running after that. The logical in vmx_pi_hooks_deassign() cover
> this case.
> - the guest is shutting down. It is covered here.

Exactly. Yet that latter case is already being taken care of by the
former: When the guest is shutting down, its last device will get
removed anyway.

Jan
diff mbox

Patch

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 65f5288..b01128a 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -366,6 +366,7 @@  static void vmx_vcpu_destroy(struct vcpu *v)
     vmx_destroy_vmcs(v);
     vpmu_destroy(v);
     passive_domain_destroy(v);
+    vmx_pi_blocking_cleanup(v);
 }
 
 static DEFINE_PER_CPU(struct vmx_msr_state, host_msr_state);