linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: Bhushan Bharat-R65777 <R65777@freescale.com>
Cc: Wood Scott-B07421 <B07421@freescale.com>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"kvm-ppc@vger.kernel.org" <kvm-ppc@vger.kernel.org>
Subject: Re: [PATCH 24/37] KVM: PPC: booke: rework rescheduling checks
Date: Mon, 27 Feb 2012 19:23:27 +0100	[thread overview]
Message-ID: <4F4BCA1F.5040905@suse.de> (raw)
In-Reply-To: <4F4BBE55.6020204@suse.de>

On 02/27/2012 06:33 PM, Alexander Graf wrote:
> On 02/27/2012 05:34 PM, Bhushan Bharat-R65777 wrote:
>>
>>> +}
>>> +
>>> +/*
>>> + * Common checks before entering the guest world.  Call with 
>>> interrupts
>>> + * disabled.
>>> + *
>>> + * returns !0 if a signal is pending and check_signal is true  */
>>> +static int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu, bool
>>> +check_signal) {
>>> +    int r = 0;
>>> +
>>> +    WARN_ON_ONCE(!irqs_disabled());
>>> +    while (true) {
>>> +        if (need_resched()) {
>>> +            local_irq_enable();
>>> +            cond_resched();
>>> +            local_irq_disable();
>>> +            continue;
>>> +        }
>>> +
>>> +        if (kvmppc_core_prepare_to_enter(vcpu)) {
>> kvmppc_prepare_to_enter() is called even on heavyweight_exit. Should 
>> not this be called only on lightweight_exit?
>
> Yeah, we don't need to call it when exiting anyways. That's a 
> functional change though, which this patch is trying not to introduce. 
> So we should rather do that as a patch on top.

So how about this (warning! broken whitespace)?


diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 7a16b56..616aa2d 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -464,7 +464,7 @@ int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu)
   *
   * returns !0 if a signal is pending and check_signal is true
   */
-static int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu, bool 
check_signal)
+static int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
  {
         int r = 0;

@@ -483,7 +483,7 @@ static int kvmppc_prepare_to_enter(struct kvm_vcpu 
*vcpu, bool check_signal)
                         continue;
                 }

-               if (check_signal && signal_pending(current))
+               if (signal_pending(current))
                         r = 1;

                 break;
@@ -507,7 +507,7 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct 
kvm_vcpu *vcpu)
         }

         local_irq_disable();
-       if (kvmppc_prepare_to_enter(vcpu, true)) {
+       if (kvmppc_prepare_to_enter(vcpu)) {
                 kvm_run->exit_reason = KVM_EXIT_INTR;
                 ret = -EINTR;
                 goto out;
@@ -941,13 +941,16 @@ int kvmppc_handle_exit(struct kvm_run *run, struct 
kvm_vcpu *vcpu,
          * To avoid clobbering exit_reason, only check for signals if we
          * aren't already exiting to userspace for some other reason.
          */
-       local_irq_disable();
-       if (kvmppc_prepare_to_enter(vcpu, !(r & RESUME_HOST))) {
-               run->exit_reason = KVM_EXIT_INTR;
-               r = (-EINTR << 2) | RESUME_HOST | (r & RESUME_FLAG_NV);
-               kvmppc_account_exit(vcpu, SIGNAL_EXITS);
+       if (!(r & RESUME_HOST)) {
+               local_irq_disable();
+               if (kvmppc_prepare_to_enter(vcpu)) {
+                       run->exit_reason = KVM_EXIT_INTR;
+                       r = (-EINTR << 2) | RESUME_HOST | (r & 
RESUME_FLAG_NV);
+                       kvmppc_account_exit(vcpu, SIGNAL_EXITS);
+               }
         }

+out:
         return r;
  }

  reply	other threads:[~2012-02-27 18:23 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-24 14:25 [PATCH 00/37] KVM: PPC: e500mc support v2 Alexander Graf
2012-02-24 14:25 ` [PATCH 01/37] powerpc/booke: Set CPU_FTR_DEBUG_LVL_EXC on 32-bit Alexander Graf
2012-02-24 14:25 ` [PATCH 02/37] powerpc/e500: split CPU_FTRS_ALWAYS/CPU_FTRS_POSSIBLE Alexander Graf
2012-02-24 14:25 ` [PATCH 03/37] KVM: PPC: factor out lpid allocator from book3s_64_mmu_hv Alexander Graf
2012-02-24 14:25 ` [PATCH 04/37] KVM: PPC: booke: add booke-level vcpu load/put Alexander Graf
2012-02-24 14:25 ` [PATCH 05/37] KVM: PPC: booke: Move vm core init/destroy out of booke.c Alexander Graf
2012-02-24 14:26 ` [PATCH 06/37] KVM: PPC: e500: rename e500_tlb.h to e500.h Alexander Graf
2012-02-24 14:26 ` [PATCH 07/37] KVM: PPC: e500: merge <asm/kvm_e500.h> into arch/powerpc/kvm/e500.h Alexander Graf
2012-02-24 14:26 ` [PATCH 08/37] KVM: PPC: e500: clean up arch/powerpc/kvm/e500.h Alexander Graf
2012-02-24 14:26 ` [PATCH 09/37] KVM: PPC: e500: refactor core-specific TLB code Alexander Graf
2012-02-24 14:26 ` [PATCH 10/37] KVM: PPC: e500: Track TLB1 entries with a bitmap Alexander Graf
2012-02-24 14:26 ` [PATCH 11/37] KVM: PPC: e500: emulate tlbilx Alexander Graf
2012-02-24 14:26 ` [PATCH 12/37] powerpc/booke: Provide exception macros with interrupt name Alexander Graf
2012-02-24 14:26 ` [PATCH 13/37] KVM: PPC: booke: category E.HV (GS-mode) support Alexander Graf
2012-02-24 14:26 ` [PATCH 14/37] KVM: PPC: booke: standard PPC floating point support Alexander Graf
2012-02-24 14:26 ` [PATCH 15/37] KVM: PPC: e500mc support Alexander Graf
2012-02-24 14:26 ` [PATCH 16/37] KVM: PPC: e500mc: Add doorbell emulation support Alexander Graf
2012-02-24 14:26 ` [PATCH 17/37] KVM: PPC: e500mc: implicitly set MSR_GS Alexander Graf
2012-02-24 14:26 ` [PATCH 18/37] KVM: PPC: e500mc: Move r1/r2 restoration very early Alexander Graf
2012-02-24 14:26 ` [PATCH 19/37] KVM: PPC: e500mc: add load inst fixup Alexander Graf
2012-02-24 14:26 ` [PATCH 20/37] KVM: PPC: rename CONFIG_KVM_E500 -> CONFIG_KVM_E500V2 Alexander Graf
2012-02-24 14:26 ` [PATCH 21/37] KVM: PPC: make e500v2 kvm and e500mc cpu mutually exclusive Alexander Graf
2012-02-24 14:26 ` [PATCH 22/37] KVM: PPC: booke: remove leftover debugging Alexander Graf
2012-02-24 14:26 ` [PATCH 23/37] KVM: PPC: booke: deliver program int on emulation failure Alexander Graf
2012-02-24 14:26 ` [PATCH 24/37] KVM: PPC: booke: rework rescheduling checks Alexander Graf
2012-02-27 16:34   ` Bhushan Bharat-R65777
2012-02-27 17:33     ` Alexander Graf
2012-02-27 18:23       ` Alexander Graf [this message]
2012-02-27 18:29         ` Bhushan Bharat-R65777
2012-02-27 19:28   ` Scott Wood
2012-02-28 11:03     ` Alexander Graf
2012-02-28 17:21       ` Scott Wood
2012-02-24 14:26 ` [PATCH 25/37] KVM: PPC: booke: BOOKE_IRQPRIO_MAX is n+1 Alexander Graf
2012-02-24 14:26 ` [PATCH 26/37] KVM: PPC: bookehv: fix exit timing Alexander Graf
2012-02-24 14:26 ` [PATCH 27/37] KVM: PPC: bookehv: remove negation for CONFIG_64BIT Alexander Graf
2012-02-24 14:26 ` [PATCH 28/37] KVM: PPC: bookehv: remove SET_VCPU Alexander Graf
2012-02-24 14:26 ` [PATCH 29/37] KVM: PPC: bookehv: disable MAS register updates early Alexander Graf
2012-02-24 14:26 ` [PATCH 30/37] KVM: PPC: bookehv: add comment about shadow_msr Alexander Graf
2012-02-24 14:26 ` [PATCH 31/37] KVM: PPC: booke: Readd debug abort code for machine check Alexander Graf
2012-02-24 14:26 ` [PATCH 32/37] KVM: PPC: booke: add GS documentation for program interrupt Alexander Graf
2012-02-24 14:26 ` [PATCH 33/37] KVM: PPC: bookehv: remove unused code Alexander Graf
2012-02-24 23:31   ` Scott Wood
2012-02-24 14:26 ` [PATCH 34/37] KVM: PPC: e500: fix typo in tlb code Alexander Graf
2012-02-24 14:26 ` [PATCH 35/37] KVM: PPC: booke: Support perfmon interrupts Alexander Graf
2012-02-24 23:33   ` Scott Wood
2012-02-26 11:58     ` Alexander Graf
2012-02-24 14:26 ` [PATCH 36/37] KVM: PPC: booke: expose guest registers on irq reinject Alexander Graf
2012-02-24 23:40   ` Scott Wood
2012-02-26 11:59     ` Alexander Graf
2012-02-27 19:45       ` Scott Wood
2012-02-24 14:26 ` [PATCH 37/37] KVM: PPC: booke: Reinject performance monitor interrupts 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=4F4BCA1F.5040905@suse.de \
    --to=agraf@suse.de \
    --cc=B07421@freescale.com \
    --cc=R65777@freescale.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.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).