Re: [Xen-devel] [PATCH v8 0/7] VMX: Properly handle pi descriptor and per-cpu blocking list
Hi, everyone. Really sorry for digging out this thread. Because feng has left Intel, I will take over this work, address some problems in his v8 patch set and send out a v9 verson later such that VT-d PI can work properly on Xen. Thanks, Chao On Fri, Nov 18, 2016 at 09:57:17AM +0800, Wu, Feng wrote: >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/7] >and [2/7] handle this. > >2. [4/7] unify the code path of PI mode update and remapped mode update > >2. 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/7] handles this. > >4. [6/7] 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/7] addresses it. > > >Feng Wu (7): > 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: Use one function to update both remapped and posted IRTE > VT-d: No need to set irq affinity for posted format IRTE > 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 | 133 ++- > xen/drivers/passthrough/pci.c | 14 +++ > xen/drivers/passthrough/vtd/intremap.c | 193 +++-- > xen/include/asm-x86/hvm/vmx/vmx.h | 3 + > 5 files changed, 240 insertions(+), 117 deletions(-) > >-- >2.1.0 > > >___ >Xen-devel mailing list >Xen-devel@lists.xen.org >https://lists.xen.org/xen-devel ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH v8 0/7] VMX: Properly handle pi descriptor and per-cpu blocking list
> -Original Message- > From: Tian, Kevin > Sent: Friday, November 18, 2016 11:03 AM > To: Wu, Feng; xen-devel@lists.xen.org > Cc: jbeul...@suse.com; andrew.coop...@citrix.com; > george.dun...@eu.citrix.com; dario.faggi...@citrix.com > Subject: RE: [PATCH v8 0/7] VMX: Properly handle pi descriptor and per-cpu > blocking list > > > From: Wu, Feng > > Sent: Friday, November 18, 2016 9:57 AM > > > > 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/7] > > and [2/7] handle this. > > > > 2. [4/7] unify the code path of PI mode update and remapped mode update > > > > 2. 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/7] handles this. > > > > 4. [6/7] 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/7] addresses it. > > > > > > just for completeness you didn't introduce 3/7 here. Okay, maybe I need add it. Thanks, Feng ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH v8 0/7] VMX: Properly handle pi descriptor and per-cpu blocking list
> From: Wu, Feng > Sent: Friday, November 18, 2016 9:57 AM > > 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/7] > and [2/7] handle this. > > 2. [4/7] unify the code path of PI mode update and remapped mode update > > 2. 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/7] handles this. > > 4. [6/7] 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/7] addresses it. > > just for completeness you didn't introduce 3/7 here. > Feng Wu (7): > 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: Use one function to update both remapped and posted IRTE > VT-d: No need to set irq affinity for posted format IRTE > 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 | 133 ++- > xen/drivers/passthrough/pci.c | 14 +++ > xen/drivers/passthrough/vtd/intremap.c | 193 > +++-- > xen/include/asm-x86/hvm/vmx/vmx.h | 3 + > 5 files changed, 240 insertions(+), 117 deletions(-) > > -- > 2.1.0 ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [PATCH v8 0/7] VMX: Properly handle pi descriptor and per-cpu blocking list
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/7] and [2/7] handle this. 2. [4/7] unify the code path of PI mode update and remapped mode update 2. 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/7] handles this. 4. [6/7] 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/7] addresses it. Feng Wu (7): 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: Use one function to update both remapped and posted IRTE VT-d: No need to set irq affinity for posted format IRTE 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 | 133 ++- xen/drivers/passthrough/pci.c | 14 +++ xen/drivers/passthrough/vtd/intremap.c | 193 +++-- xen/include/asm-x86/hvm/vmx/vmx.h | 3 + 5 files changed, 240 insertions(+), 117 deletions(-) -- 2.1.0 ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel