aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHaozhong Zhang <haozhong.zhang@intel.com>2017-09-17 21:56:49 -0400
committerRadim Krčmář <rkrcmar@redhat.com>2017-09-19 09:09:11 -0400
commitdc91f2eb1a4021eb6705c15e474942f84ab9b211 (patch)
tree3bc663c9f9e9b058e33dc3e23c3abe3bf49e1bb2
parentd6500149bc4fddc5a91cd1a0c31b38fa36bff3ee (diff)
KVM: VMX: do not change SN bit in vmx_update_pi_irte()
In kvm_vcpu_trigger_posted_interrupt() and pi_pre_block(), KVM assumes that PI notification events should not be suppressed when the target vCPU is not blocked. vmx_update_pi_irte() sets the SN field before changing an interrupt from posting to remapping, but it does not check the vCPU mode. Therefore, the change of SN field may break above the assumption. Besides, I don't see reasons to suppress notification events here, so remove the changes of SN field to avoid race condition. Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com> Reported-by: "Ramamurthy, Venkatesh" <venkatesh.ramamurthy@intel.com> Reported-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Fixes: 28b835d60fcc ("KVM: Update Posted-Interrupts Descriptor when vCPU is preempted") Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
-rw-r--r--arch/x86/kvm/vmx.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 06c0c6d0541e..7328c8c0ea3b 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -11911,12 +11911,8 @@ static int vmx_update_pi_irte(struct kvm *kvm, unsigned int host_irq,
11911 11911
11912 if (set) 11912 if (set)
11913 ret = irq_set_vcpu_affinity(host_irq, &vcpu_info); 11913 ret = irq_set_vcpu_affinity(host_irq, &vcpu_info);
11914 else { 11914 else
11915 /* suppress notification event before unposting */
11916 pi_set_sn(vcpu_to_pi_desc(vcpu));
11917 ret = irq_set_vcpu_affinity(host_irq, NULL); 11915 ret = irq_set_vcpu_affinity(host_irq, NULL);
11918 pi_clear_sn(vcpu_to_pi_desc(vcpu));
11919 }
11920 11916
11921 if (ret < 0) { 11917 if (ret < 0) {
11922 printk(KERN_INFO "%s: failed to update PI IRTE\n", 11918 printk(KERN_INFO "%s: failed to update PI IRTE\n",