diff mbox

[2/3] VMX: Make hook pi_do_resume always available

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

Commit Message

Wu, Feng May 20, 2016, 8:53 a.m. UTC
Make hook pi_do_resume always available, so when the last
assigned device is dettached from a domain, the blocked
vcpu can be removed from the per-cpu blocking list properly.

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

Comments

Jan Beulich May 23, 2016, 12:32 p.m. UTC | #1
>>> On 20.05.16 at 10:53, <feng.wu@intel.com> wrote:
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -233,7 +233,6 @@ void vmx_pi_hooks_assign(struct domain *d)
>      d->arch.hvm_domain.vmx.vcpu_block = vmx_vcpu_block;
>      d->arch.hvm_domain.vmx.pi_switch_from = vmx_pi_switch_from;
>      d->arch.hvm_domain.vmx.pi_switch_to = vmx_pi_switch_to;
> -    d->arch.hvm_domain.vmx.pi_do_resume = vmx_pi_do_resume;
>  }
>  
>  /* This function is called when pcidevs_lock is held */
> @@ -247,13 +246,14 @@ void vmx_pi_hooks_deassign(struct domain *d)
>      d->arch.hvm_domain.vmx.vcpu_block = NULL;
>      d->arch.hvm_domain.vmx.pi_switch_from = NULL;
>      d->arch.hvm_domain.vmx.pi_switch_to = NULL;
> -    d->arch.hvm_domain.vmx.pi_do_resume = NULL;
>  }
>  
>  static int vmx_domain_initialise(struct domain *d)
>  {
>      int rc;
>  
> +    d->arch.hvm_domain.vmx.pi_do_resume = vmx_pi_do_resume;
> +
>      if ( !has_vlapic(d) )
>          return 0;

Along the lines of what I said last in for 1/3: There's no need to
always install the hook. For your purpose it ought to suffice to
simply not zap it upon device de-assign (which would still leave
all VMs without passed through devices without such useless to
them hook in place).

Jan
Dario Faggioli May 23, 2016, 12:51 p.m. UTC | #2
On Mon, 2016-05-23 at 06:32 -0600, Jan Beulich wrote:
> > > > On 20.05.16 at 10:53, <feng.wu@intel.com> wrote:
> > @@ -247,13 +246,14 @@ void vmx_pi_hooks_deassign(struct domain *d)
> >      d->arch.hvm_domain.vmx.vcpu_block = NULL;
> >      d->arch.hvm_domain.vmx.pi_switch_from = NULL;
> >      d->arch.hvm_domain.vmx.pi_switch_to = NULL;
> > -    d->arch.hvm_domain.vmx.pi_do_resume = NULL;
> >  }
> >  
> >  static int vmx_domain_initialise(struct domain *d)
> >  {
> >      int rc;
> >  
> > +    d->arch.hvm_domain.vmx.pi_do_resume = vmx_pi_do_resume;
> > +
> >      if ( !has_vlapic(d) )
> >          return 0;
> Along the lines of what I said last in for 1/3: There's no need to
> always install the hook. For your purpose it ought to suffice to
> simply not zap it upon device de-assign (which would still leave
> all VMs without passed through devices without such useless to
> them hook in place).
> 
FWIW, +1 to this.

Dario
diff mbox

Patch

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 3fbc7b1..4862b13 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -233,7 +233,6 @@  void vmx_pi_hooks_assign(struct domain *d)
     d->arch.hvm_domain.vmx.vcpu_block = vmx_vcpu_block;
     d->arch.hvm_domain.vmx.pi_switch_from = vmx_pi_switch_from;
     d->arch.hvm_domain.vmx.pi_switch_to = vmx_pi_switch_to;
-    d->arch.hvm_domain.vmx.pi_do_resume = vmx_pi_do_resume;
 }
 
 /* This function is called when pcidevs_lock is held */
@@ -247,13 +246,14 @@  void vmx_pi_hooks_deassign(struct domain *d)
     d->arch.hvm_domain.vmx.vcpu_block = NULL;
     d->arch.hvm_domain.vmx.pi_switch_from = NULL;
     d->arch.hvm_domain.vmx.pi_switch_to = NULL;
-    d->arch.hvm_domain.vmx.pi_do_resume = NULL;
 }
 
 static int vmx_domain_initialise(struct domain *d)
 {
     int rc;
 
+    d->arch.hvm_domain.vmx.pi_do_resume = vmx_pi_do_resume;
+
     if ( !has_vlapic(d) )
         return 0;