Message ID | 1646814944-51801-1-git-send-email-lirongqing@baidu.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | KVM: x86: fix sending PV IPI | expand |
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@baidu.com> 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,
> > 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@baidu.com> > > 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 Ping thanks -Li
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,
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@baidu.com> --- arch/x86/kernel/kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)