Re: [PATCH] Maybe avoid a IPI between the cpu cores

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

 



Maybe the patch have a risk to break the process of lapic.just  avoid
a IPI between the cpu core asap.

Thanks
YiLi

2012/12/4 yi li <yilikernel@xxxxxxxxx>:
>     The cpu inject the interrupt to vcpu which vcpu->cpu is the same as it.
>     And it maybe  avoid a IPI between the cpu core.
>
>     Signed-off-by: Yi Li <yilikernel@xxxxxxxxx>
>
> --- linux/virt/kvm/irq_comm.c   2012-12-04 10:14:57.711024619 +0800
> +++ linux/virt/kvm/irq_comm.c   2012-12-04 11:01:27.728859597 +0800
> @@ -64,9 +64,10 @@ inline static bool kvm_is_dm_lowest_prio
>  int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src,
>                 struct kvm_lapic_irq *irq)
>  {
> -       int i, r = -1;
> +       int i, cpu, r = -1;
>         struct kvm_vcpu *vcpu, *lowest = NULL;
>
> +       cpu = get_cpu();
>         if (irq->dest_mode == 0 && irq->dest_id == 0xff &&
>                         kvm_is_dm_lowest_prio(irq)) {
>                 printk(KERN_INFO "kvm: apic: phys broadcast and lowest prio\n");
> @@ -89,13 +90,17 @@ int kvm_irq_delivery_to_apic(struct kvm
>                                 r = 0;
>                         r += kvm_apic_set_irq(vcpu, irq);
>                 } else if (kvm_lapic_enabled(vcpu)) {
> -                       if (!lowest)
> +                       if(vcpu->cpu == cpu) {
> +                               lowest = vcpu;
> +                               break;
> +                       }
> +                       else if (!lowest)
>                                 lowest = vcpu;
>                         else if (kvm_apic_compare_prio(vcpu, lowest) < 0)
>                                 lowest = vcpu;
>                 }
>         }
> -
> +       put_cpu();
>         if (lowest)
>                 r = kvm_apic_set_irq(lowest, irq);
>
>
> YiLi
> Thanks
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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