Pausing the domain can make sure the vCPU is not running and
hence calling the hooks simultaneously when deassigning the
PI hooks. This makes sure that all the appropriate state of
PI descriptor is actually set up for all vCPus before leaving
this function.

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

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 37fa2f1..071c063 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -219,8 +219,19 @@ void vmx_pi_hooks_assign(struct domain *d)
 
     ASSERT(!d->arch.hvm_domain.vmx.vcpu_block);
 
+    /*
+     * Pausing the domain can make sure the vCPU is not
+     * running and hence calling the hooks simultaneously
+     * when deassigning the PI hooks. This makes sure that
+     * all the appropriate state of PI descriptor is actually
+     * set up for all vCPus before leaving this function.
+     */
+    domain_pause(d);
+
     d->arch.hvm_domain.vmx.vcpu_block = vmx_vcpu_block;
     d->arch.hvm_domain.vmx.pi_do_resume = vmx_pi_do_resume;
+
+    domain_unpause(d);
 }
 
 /* This function is called when pcidevs_lock is held */
-- 
2.1.0


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

Reply via email to