From: Scott Wood <scottwood@freescale.com>
To: Alexander Graf <agraf@suse.de>
Cc: kvm-ppc@vger.kernel.org, "Jörg Sommer" <joerg@alea.gnuu.de>,
"KVM list" <kvm@vger.kernel.org>
Subject: Re: [PATCH 4/4] KVM: PPC: align vcpu_kick with x86
Date: Fri, 9 Dec 2011 12:19:35 -0600 [thread overview]
Message-ID: <4EE25137.4090402@freescale.com> (raw)
In-Reply-To: <1323444412-18482-5-git-send-email-agraf@suse.de>
On 12/09/2011 09:26 AM, Alexander Graf wrote:
> Our vcpu kick implementation differs a bit from x86 which resulted in us not
> disabling preemption during the kick. Get it a bit closer to what x86 does.
Disabling preemption only matters due to the other bit of functionality
you brought over -- avoiding kicking the current CPU.
Probably doesn't even matter all that much with it, since avoiding that
is just an optimization, and any race that causes us to fail to
reschedule a vcpu of a different thread means that thread just
rescheduled anyway. Not something I feel any great need to rely on,
though. :-)
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
> arch/powerpc/kvm/powerpc.c | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
> index c952f13..ef8c990 100644
> --- a/arch/powerpc/kvm/powerpc.c
> +++ b/arch/powerpc/kvm/powerpc.c
> @@ -557,12 +557,17 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
>
> void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
> {
> + int me;
> + int cpu = vcpu->cpu;
> +
> + me = get_cpu();
> if (waitqueue_active(&vcpu->wq)) {
> wake_up_interruptible(vcpu->arch.wqp);
> vcpu->stat.halt_wakeup++;
> - } else if (vcpu->cpu != -1) {
> + } else if (cpu != me && cpu != -1) {
> smp_send_reschedule(vcpu->cpu);
> }
> + put_cpu();
> }
Whitespace.
-Scott
next prev parent reply other threads:[~2011-12-09 18:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-09 15:26 [PATCH 0/4] Fix book3s-pr KVM with preemption Alexander Graf
2011-12-09 15:26 ` [PATCH 1/4] KVM: PPC: Book3s: PR: Disable preemption in vcpu_run Alexander Graf
2011-12-09 18:19 ` Scott Wood
2011-12-09 23:18 ` Alexander Graf
2011-12-13 21:15 ` Scott Wood
2011-12-09 15:26 ` [PATCH 2/4] KVM: PPC: Book3s: PR: No irq_disable " Alexander Graf
2011-12-09 15:26 ` [PATCH 3/4] KVM: PPC: Use get/set for to_svcpu to help preemption Alexander Graf
2011-12-09 15:26 ` [PATCH 4/4] KVM: PPC: align vcpu_kick with x86 Alexander Graf
2011-12-09 18:19 ` Scott Wood [this message]
2011-12-09 19:10 ` Alexander Graf
2011-12-09 19:15 ` Scott Wood
2011-12-09 23:15 ` Alexander Graf
2011-12-12 17:32 ` Scott Wood
2011-12-23 12:56 ` Alexander Graf
2011-12-23 21:50 ` Benjamin Herrenschmidt
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=4EE25137.4090402@freescale.com \
--to=scottwood@freescale.com \
--cc=agraf@suse.de \
--cc=joerg@alea.gnuu.de \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
/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).