From: Scott Wood <scottwood@freescale.com>
To: Alexander Graf <agraf@suse.de>
Cc: <kvm@vger.kernel.org>, <kvm-ppc@vger.kernel.org>
Subject: Re: [PATCH 3/6] KVM: PPC: booke: Check for MSR[WE] in prepare_to_enter
Date: Mon, 14 Nov 2011 11:22:35 -0600 [thread overview]
Message-ID: <4EC14E5B.5080805@freescale.com> (raw)
In-Reply-To: <4EC1140F.3000307@suse.de>
On 11/14/2011 07:13 AM, Alexander Graf wrote:
> On 11/09/2011 01:23 AM, Scott Wood wrote:
>> +/* Check pending exceptions and deliver one, if possible. */
>> +void kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu)
>> +{
>> + WARN_ON_ONCE(!irqs_disabled());
>> +
>> + kvmppc_core_check_exceptions(vcpu);
>> +
>> + if (vcpu->arch.shared->msr& MSR_WE) {
>> + local_irq_enable();
>> + kvm_vcpu_block(vcpu);
>> + local_irq_disable();
>
> Hrm. This specific irq enable/disable part isn't pretty but I can't
> think of a cleaner way either. Unless you move it out of the prepare
> function, since I don't see a way it could race with an interrupt.
kvmppc_core_check_exceptions can clear MSR_WE, so we need to check after
that. We can't enable interrupts after kvmppc_core_check_exceptions (or
rather, if we do, we need to check again once interrupts are
re-disabled, as in the MSR_WE case) because otherwise we could have an
exception delivered afterward and receive the resched IPI at just the
wrong time to take any action on it (just like the signal check).
>> +
>> + kvmppc_set_exit_type(vcpu, EMULATED_MTMSRWE_EXITS);
>> + kvmppc_core_check_exceptions(vcpu);
>
> Shouldn't
>
> if (msr & MSR_WE) {
> ...
> }
>
> core_check_exceptions(vcpu);
>
>
> work just as well?
That would have us pointlessly checking the exceptions twice in the
non-WE case -- unless you mean only check after, which as described
above means you'll fail to wake up.
-Scott
next prev parent reply other threads:[~2011-11-14 17:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-09 0:22 [PATCH 0/6] KVM: PPC: mostly booke: race and idle fixes, paravirt Scott Wood
2011-11-09 0:23 ` [PATCH 1/6] KVM: PPC: Rename deliver_interrupts to prepare_to_enter Scott Wood
2011-11-09 0:23 ` [PATCH 2/6] KVM: PPC: Move prepare_to_enter call site into subarch code Scott Wood
2011-11-09 0:23 ` [PATCH 3/6] KVM: PPC: booke: Check for MSR[WE] in prepare_to_enter Scott Wood
2011-11-14 13:13 ` Alexander Graf
2011-11-14 17:22 ` Scott Wood [this message]
2011-11-14 18:01 ` Alexander Graf
2011-11-14 18:56 ` Scott Wood
2011-11-09 0:23 ` [PATCH 4/6] KVM: PPC: booke: Fix int_pending calculation for MSR[EE] paravirt Scott Wood
2011-11-09 0:23 ` [PATCH 5/6] KVM: PPC: booke: Paravirtualize wrtee Scott Wood
2011-11-09 0:23 ` [PATCH 6/6] KVM: PPC: Paravirtualize SPRG4-7, ESR, PIR, MASn Scott Wood
2011-11-18 13:12 ` [PATCH 0/6] KVM: PPC: mostly booke: race and idle fixes, paravirt Alexander Graf
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=4EC14E5B.5080805@freescale.com \
--to=scottwood@freescale.com \
--cc=agraf@suse.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).