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 1/4] KVM: PPC: Book3s: PR: Disable preemption in vcpu_run
Date: Fri, 9 Dec 2011 12:19:53 -0600 [thread overview]
Message-ID: <4EE25149.7010109@freescale.com> (raw)
In-Reply-To: <1323444412-18482-2-git-send-email-agraf@suse.de>
On 12/09/2011 09:26 AM, Alexander Graf wrote:
> When entering the guest, we want to make sure we're not getting preempted
> away, so let's disable preemption on entry, but enable it again while handling
> guest exits.
>
> Reported-by: Jörg Sommer <joerg@alea.gnuu.de>
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
> arch/powerpc/kvm/book3s_pr.c | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
> index 726512b..8e4f800 100644
> --- a/arch/powerpc/kvm/book3s_pr.c
> +++ b/arch/powerpc/kvm/book3s_pr.c
> @@ -519,6 +519,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
> run->ready_for_interrupt_injection = 1;
>
> trace_kvm_book3s_exit(exit_nr, vcpu);
> + preempt_enable();
> kvm_resched(vcpu);
> switch (exit_nr) {
> case BOOK3S_INTERRUPT_INST_STORAGE:
> @@ -763,6 +764,8 @@ program_interrupt:
> run->exit_reason = KVM_EXIT_INTR;
> r = -EINTR;
> } else {
> + preempt_disable();
> +
> /* In case an interrupt came in that was triggered
> * from userspace (like DEC), we need to check what
> * to inject now! */
Shouldn't you really have interrupts disabled here, as booke does?
Otherwise an interrupt (including an IPI kick) could send you a signal
or guest exception after you check.
Likewise for other guest entry points.
-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 [this message]
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
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=4EE25149.7010109@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).