From: yi li <yilikernel@gmail.com>
To: kvm@vger.kernel.org
Cc: Alex Williamson <alex.williamson@redhat.com>, weikong.cn@gmail.com
Subject: Re: [PATCH] Maybe avoid a IPI between the cpu cores
Date: Tue, 4 Dec 2012 11:49:13 +0800 [thread overview]
Message-ID: <CAJfdMYBd4Uh_JRmPtroHChZjEOQg2rw+RNXzTYivCdnKdUgSxg@mail.gmail.com> (raw)
In-Reply-To: <CAJfdMYAjHFVVAzekDA_L=q+xYvPeM_mcAU5okgLJedtts0P2jQ@mail.gmail.com>
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@gmail.com>:
> 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@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
next prev parent reply other threads:[~2012-12-04 3:49 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 [this message]
2012-12-04 11:20 ` Gleb Natapov
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=CAJfdMYBd4Uh_JRmPtroHChZjEOQg2rw+RNXzTYivCdnKdUgSxg@mail.gmail.com \
--to=yilikernel@gmail.com \
--cc=alex.williamson@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=weikong.cn@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).