[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH for-4.13 v3] x86/passthrough: fix migration of MSI when using posted interrupts
On 11/15/19 6:06 AM, Roger Pau Monné wrote: > On Fri, Nov 15, 2019 at 05:23:51AM +0000, Tian, Kevin wrote: >>> From: Roger Pau Monne [mailto:roger.pau@xxxxxxxxxx] >>> Sent: Friday, November 8, 2019 9:34 PM >>> >>> When using posted interrupts and the guest migrates MSI from vCPUs Xen >>> needs to flush any pending PIRR vectors on the previous vCPU, or else >>> those vectors could get wrongly injected at a later point when the MSI >>> fields are already updated. >> I may overlook but isn't it the guest's responsibility of handling such >> case? Even on bare metal, an in-fly interrupt may be delivered to >> wrong CPU when MSI is being migrated? > According to Joe from Oracle Linux already takes care of that by > checking IRR when migrating interrupts between CPUs, but it seems like > the vector is not pending in IRR (my hypothesis is that it's pending > in PIR but lacking a sync into IRR). > > After digging more into the posted interrupt code, I think there's an > issue somewhere else, and the sync on MSI reconfiguration done by this > patch is just covering that up. > > There shouldn't be any interrupts pending in the PIR when the vCPU is > running, and any pending vectors in the PIR should be synced into IRR > before executing the vCPU. > > AFAICT there's an issue with how PIR is synced into IRR, it relies on > vlapic_find_highest_irr being called from vlapic_has_pending_irq, but > depending on which interrupts are pending it's possible that > vlapic_has_pending_irq is not called by hvm_vcpu_has_pending_irq, thus > leaving IRR stale. > > The patch below should solve that and also simplify > __vmx_deliver_posted_interrupt, there's no reason to raise a softirq > in __vmx_deliver_posted_interrupt: if the vCPU is the one currently > running or if it's not running at all the sync of PIR to IRR will > happen on vmentry, without the need of any softirq being set. Also > note the raise_softirq in __vmx_deliver_posted_interrupt should have > been a cpu_raise_softirq(cpu, VCPU_KICK_SOFTIRQ) instead. > > Joe, can you give a try to the patch below? This patch fixed my issue as well. Thanks, Joe _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |