VMX: properly handle pi when all the assigned devices are removed
authorFeng Wu <feng.wu@intel.com>
Fri, 3 Mar 2017 16:07:08 +0000 (17:07 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 3 Mar 2017 16:07:08 +0000 (17:07 +0100)
commit9152b5f8d917cccd811846d5dd48ade70fbae284
treee90af267e0be5a5d235a4b5b5fc3e6324d8d1caf
parent3176aa8a9515dcb7b60c8123f609dc3f84e57b57
VMX: properly handle pi when all the assigned devices are removed

This patch handles some corner cases when the last assigned device
is removed from the domain. In this case we should carefully handle
pi descriptor and the per-cpu blocking list, to make sure:
- all the PI descriptor are in the right state when next time a
devices is assigned to the domain again.
- No remaining vcpus of the domain in the per-cpu blocking list.

Here we call vmx_pi_unblock_vcpu() to remove the vCPU from the blocking list
if it is on the list. However, this could happen when vmx_vcpu_block() is
being called, hence we might incorrectly add the vCPU to the blocking list
while the last devcie is detached from the domain. Consider that the situation
can only occur when detaching the last device from the domain and it is not
a frequent operation, so we use domain_pause before that, which is considered
as an clean and maintainable solution for the situation.

Signed-off-by: Feng Wu <feng.wu@intel.com>
Signed-off-by: Chao Gao <chao.gao@intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
xen/arch/x86/hvm/vmx/vmx.c