All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: yi li <yilikernel@gmail.com>
Cc: kvm@vger.kernel.org, Alex Williamson <alex.williamson@redhat.com>
Subject: Re: [PATCH] Maybe avoid a IPI between the cpu cores
Date: Tue, 4 Dec 2012 13:20:35 +0200	[thread overview]
Message-ID: <20121204112035.GG19514@redhat.com> (raw)
In-Reply-To: <CAJfdMYAjHFVVAzekDA_L=q+xYvPeM_mcAU5okgLJedtts0P2jQ@mail.gmail.com>

On Tue, Dec 04, 2012 at 11:08:41AM +0800, yi li wrote:
>     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.
> 
How often this happens in your testing? Regardless we cannot disable
preemption while iterating over all vcpus. Low latency people will kill
us.

>     Signed-off-by: Yi Li <yilikernel@gmail.com>
> 
> --- 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@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
			Gleb.

  parent reply	other threads:[~2012-12-04 11:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-04  3:08 [PATCH] Maybe avoid a IPI between the cpu cores yi li
2012-12-04  3:49 ` yi li
2012-12-04 11:20 ` Gleb Natapov [this message]
2012-12-04 17:32   ` yi li
2012-12-04 17:48     ` yi li
2012-12-05 10:31     ` Gleb Natapov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121204112035.GG19514@redhat.com \
    --to=gleb@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=yilikernel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.