[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v9 0/8] VMX: Properly handle pi descriptor and per-cpu



The current VT-d PI related code may operate incorrectly in the 
following scenarios: 
1. When the last assigned device is dettached from the domain, all 
the PI related hooks are removed then, however, the vCPU can be 
blocked, switched to another pCPU, etc, all without the aware of 
PI. After the next time we attach another device to the domain, 
which makes the PI realted hooks avaliable again, the status 
of the pi descriptor is not true. Beside that, the blocking vcpu 
may still remain in the per-cpu blocking in this case. Patch [1/8] 
and [3/8] handle this. Patch [2/8] rejects self-(de)assignment to
make domain pause in [3/8] safe.

2. In the current code, we didn't mind the assignment sequences
of the four hook functions(ie, vcpu_block, switch_to, switch_from,
do_resume). It caused the last the assertion in vmx_vcpu_block()
failed. Patch [4/8] handles the sequences carefully to make sure
that the assertion will not be triggered again.

3. When IRTE is in posted mode, we don't need to set the irq 
affinity for it, since the destination of these interrupts is 
vCPU and the vCPU affinity is set during vCPU scheduling. Patch 
[5/8] handles this. In order to make the logic clearer, it also
extracts the common part from pi_update_irte() and
msi_msg_to_rte_entry() which two functions update irte to make
the logic clearer.

4. [6/8] is a cleanup patch 

5. When a pCPU is unplugged, and there might be vCPUs on its 
list. Since the pCPU is offline, those vCPUs might not be woken 
up again. [7/8] addresses it. 

6. IRTE is updated through structure assigment or memcpy() which is
unsafe. To resolve this, Patch [8/8] use cmpxchg16b() if supported or
two 64-bit write operations to update irte.

Note that I just took over feng's work and the v9 patch series are based
on feng's v8 patch
(https://lists.xenproject.org/archives/html/xen-devel/2016-11/msg01472.html).
Most of these patches are reviewed or acked by maintainers. Patch [2/8],
Patch [5/8], Patch [8/8] is added by me to address remainly issues.

Chao Gao (3):
  xen/passthrough: Reject self-(de)assignment of devices
  VT-d: Introduce a new function update_irte_for_msi_common
  VT-d: Add copy_irte_{to,from}_irt for updating irte

Feng Wu (5):
  VMX: Permanently assign PI hook vmx_pi_switch_to()
  VMX: Properly handle pi when all the assigned devices are removed
  VMX: Make sure PI is in proper state before install the hooks
  VT-d: Some cleanups
  VMX: Fixup PI descriptor when cpu is offline

 xen/arch/x86/hvm/vmx/vmcs.c            |  14 +-
 xen/arch/x86/hvm/vmx/vmx.c             | 134 +++++++++++++++++-
 xen/drivers/passthrough/pci.c          |  14 ++
 xen/drivers/passthrough/vtd/intremap.c | 252 +++++++++++++++++++--------------
 xen/include/asm-x86/hvm/vmx/vmx.h      |   3 +
 5 files changed, 297 insertions(+), 120 deletions(-)

-- 
1.8.3.1


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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.