[PATCH CFT 0/4] VT-d PI fixes

From: Paolo Bonzini
Date: Tue Jun 06 2017 - 06:57:25 EST


These should fix, or at least help, the kernel panic reported by Longpeng
with VT-d posted interrupts.

CONFIG_DEBUG_LIST reports a double add, meaning that pi_pre_block ran twice
without pi_post_block deleting the vCPU from the blocked_on_vcpu list.
The only possibility that I could think of is that this:

if (!kvm_arch_has_assigned_device(vcpu->kvm) ||
!irq_remapping_cap(IRQ_POSTING_CAP) ||
!kvm_vcpu_apicv_active(vcpu))
return;

was false in pi_post_block. In turn, I can only think of hot-unplug as
the cause of this imbalance, but maybe there is another way to reach it
just via repeated startup and shutdown. Gonglei reported problems with
hot-unplug offlist too, so this is a start.

In any case, patch 2 replaces it with a check on vcpu->pre_pcpu.
A similar change is done in patch 3 to vmx_vcpu_pi_load. I don't
have hardware easily accessible with VT-d PI, so these patches are
compile-tested only. I apologize for any stupid mistakes.

The first three patches are meant for stable versions too.

Paolo

Paolo Bonzini (4):
KVM: VMX: extract __pi_post_block
KVM: VMX: avoid double list add with VT-d posted interrupts
KVM: VMX: simplify and fix vmx_vcpu_pi_load
KVM: VMX: simplify cmpxchg of PI descriptor control field

arch/x86/kvm/vmx.c | 228 ++++++++++++++++++++++++++---------------------------
1 file changed, 110 insertions(+), 118 deletions(-)

--
2.13.0