Skip to content

Commit c15e0ae

Browse files
lrq-maxbonzini
authored andcommitted
KVM: x86: fix sending PV IPI
If apic_id is less than min, and (max - apic_id) is greater than KVM_IPI_CLUSTER_SIZE, then the third check condition is satisfied but the new apic_id does not fit the bitmask. In this case __send_ipi_mask should send the IPI. This is mostly theoretical, but it can happen if the apic_ids on three iterations of the loop are for example 1, KVM_IPI_CLUSTER_SIZE, 0. Fixes: aaffcfd ("KVM: X86: Implement PV IPIs in linux guest") Signed-off-by: Li RongQing <lirongqing@baidu.com> Message-Id: <1646814944-51801-1-git-send-email-lirongqing@baidu.com> Cc: stable@vger.kernel.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 2a8859f commit c15e0ae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kernel/kvm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ static void __send_ipi_mask(const struct cpumask *mask, int vector)
517517
} else if (apic_id < min && max - apic_id < KVM_IPI_CLUSTER_SIZE) {
518518
ipi_bitmap <<= min - apic_id;
519519
min = apic_id;
520-
} else if (apic_id < min + KVM_IPI_CLUSTER_SIZE) {
520+
} else if (apic_id > min && apic_id < min + KVM_IPI_CLUSTER_SIZE) {
521521
max = apic_id < max ? max : apic_id;
522522
} else {
523523
ret = kvm_hypercall4(KVM_HC_SEND_IPI, (unsigned long)ipi_bitmap,

0 commit comments

Comments
 (0)