Re: [PATCH] KVM: x86: fix sending PV IPI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/9/22 09:35, Li RongQing wrote:
if apic_id is less than min, and (max - apic_id) is greater than
KVM_IPI_CLUSTER_SIZE, then third check condition is satisfied,

but it should enter last branch, send IPI directly

Fixes: aaffcfd1e82 ("KVM: X86: Implement PV IPIs in linux guest")
Signed-off-by: Li RongQing <lirongqing@xxxxxxxxx>

So an example is

   apic_id on first iteration = 1
   apic_id on second iteration = KVM_IPI_CLUSTER_SIZE
   apic_id on third iteration = 0

Thanks, this looks good.

Paolo

---
  arch/x86/kernel/kvm.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index 959f919..8915c93 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -517,7 +517,7 @@ static void __send_ipi_mask(const struct cpumask *mask, int vector)
  		} else if (apic_id < min && max - apic_id < KVM_IPI_CLUSTER_SIZE) {
  			ipi_bitmap <<= min - apic_id;
  			min = apic_id;
-		} else if (apic_id < min + KVM_IPI_CLUSTER_SIZE) {
+		} else if (apic_id > min && apic_id < min + KVM_IPI_CLUSTER_SIZE) {
  			max = apic_id < max ? max : apic_id;
  		} else {
  			ret = kvm_hypercall4(KVM_HC_SEND_IPI, (unsigned long)ipi_bitmap,




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux