From: Scott Wood <scottwood@freescale.com>
To: Alexander Graf <agraf@suse.de>
Cc: kvm-ppc@vger.kernel.org, KVM list <kvm@vger.kernel.org>
Subject: Re: [PATCH 1/4] KVM: PPC: BookE: Allow irq deliveries to inject requests
Date: Fri, 04 Jan 2013 19:40:50 +0000 [thread overview]
Message-ID: <1357328450.666.13@snotra> (raw)
In-Reply-To: <1357321000-31008-2-git-send-email-agraf@suse.de> (from agraf@suse.de on Fri Jan 4 11:36:37 2013)
On 01/04/2013 11:36:37 AM, Alexander Graf wrote:
> When injecting an interrupt into guest context, we usually don't need
> to check for requests anymore. At least not until today.
>
> With the introduction of EPR, we will have to create a request when
> the
> guest has successfully accepted an external interrupt though.
>
> So we need to prepare the interrupt delivery to abort guest entry
> gracefully. Otherwise we'd delay the EPR request.
>
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
> arch/powerpc/kvm/booke.c | 14 ++++++++++----
> 1 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
> index 69f1140..4ae83f9 100644
> --- a/arch/powerpc/kvm/booke.c
> +++ b/arch/powerpc/kvm/booke.c
> @@ -554,14 +554,16 @@ static void update_timer_ints(struct kvm_vcpu
> *vcpu)
> kvmppc_core_dequeue_watchdog(vcpu);
> }
>
> -static void kvmppc_core_check_exceptions(struct kvm_vcpu *vcpu)
> +static int kvmppc_core_check_exceptions(struct kvm_vcpu *vcpu)
> {
> unsigned long *pending = &vcpu->arch.pending_exceptions;
> unsigned int priority;
> + int r = 0;
>
> priority = __ffs(*pending);
> while (priority < BOOKE_IRQPRIO_MAX) {
> - if (kvmppc_booke_irqprio_deliver(vcpu, priority))
> + r = kvmppc_booke_irqprio_deliver(vcpu, priority);
> + if (r)
> break;
>
> priority = find_next_bit(pending,
> @@ -571,15 +573,19 @@ static void kvmppc_core_check_exceptions(struct
> kvm_vcpu *vcpu)
>
> /* Tell the guest about our interrupt status */
> vcpu->arch.shared->int_pending = !!*pending;
> +
> + return r > 1;
> }
It isn't until patch 3/4 that the reason for "r > 1" appears...
Why not just:
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 69f1140..964f447 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -581,6 +581,11 @@ int kvmppc_core_prepare_to_enter(struct kvm_vcpu
*vcpu)
kvmppc_core_check_exceptions(vcpu);
+ if (vcpu->requests) {
+ /* Exception delivery raised request; start over */
+ return 1;
+ }
+
if (vcpu->arch.shared->msr & MSR_WE) {
local_irq_enable();
kvm_vcpu_block(vcpu);
...or if you really want to do it through return values, make it an
enum rather than a magic "2".
-Scott
WARNING: multiple messages have this Message-ID (diff)
From: Scott Wood <scottwood@freescale.com>
To: Alexander Graf <agraf@suse.de>
Cc: <kvm-ppc@vger.kernel.org>, KVM list <kvm@vger.kernel.org>
Subject: Re: [PATCH 1/4] KVM: PPC: BookE: Allow irq deliveries to inject requests
Date: Fri, 4 Jan 2013 13:40:50 -0600 [thread overview]
Message-ID: <1357328450.666.13@snotra> (raw)
In-Reply-To: <1357321000-31008-2-git-send-email-agraf@suse.de> (from agraf@suse.de on Fri Jan 4 11:36:37 2013)
On 01/04/2013 11:36:37 AM, Alexander Graf wrote:
> When injecting an interrupt into guest context, we usually don't need
> to check for requests anymore. At least not until today.
>
> With the introduction of EPR, we will have to create a request when
> the
> guest has successfully accepted an external interrupt though.
>
> So we need to prepare the interrupt delivery to abort guest entry
> gracefully. Otherwise we'd delay the EPR request.
>
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
> arch/powerpc/kvm/booke.c | 14 ++++++++++----
> 1 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
> index 69f1140..4ae83f9 100644
> --- a/arch/powerpc/kvm/booke.c
> +++ b/arch/powerpc/kvm/booke.c
> @@ -554,14 +554,16 @@ static void update_timer_ints(struct kvm_vcpu
> *vcpu)
> kvmppc_core_dequeue_watchdog(vcpu);
> }
>
> -static void kvmppc_core_check_exceptions(struct kvm_vcpu *vcpu)
> +static int kvmppc_core_check_exceptions(struct kvm_vcpu *vcpu)
> {
> unsigned long *pending = &vcpu->arch.pending_exceptions;
> unsigned int priority;
> + int r = 0;
>
> priority = __ffs(*pending);
> while (priority < BOOKE_IRQPRIO_MAX) {
> - if (kvmppc_booke_irqprio_deliver(vcpu, priority))
> + r = kvmppc_booke_irqprio_deliver(vcpu, priority);
> + if (r)
> break;
>
> priority = find_next_bit(pending,
> @@ -571,15 +573,19 @@ static void kvmppc_core_check_exceptions(struct
> kvm_vcpu *vcpu)
>
> /* Tell the guest about our interrupt status */
> vcpu->arch.shared->int_pending = !!*pending;
> +
> + return r > 1;
> }
It isn't until patch 3/4 that the reason for "r > 1" appears...
Why not just:
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 69f1140..964f447 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -581,6 +581,11 @@ int kvmppc_core_prepare_to_enter(struct kvm_vcpu
*vcpu)
kvmppc_core_check_exceptions(vcpu);
+ if (vcpu->requests) {
+ /* Exception delivery raised request; start over */
+ return 1;
+ }
+
if (vcpu->arch.shared->msr & MSR_WE) {
local_irq_enable();
kvm_vcpu_block(vcpu);
...or if you really want to do it through return values, make it an
enum rather than a magic "2".
-Scott
next prev parent reply other threads:[~2013-01-04 19:40 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-04 17:36 [PATCH 0/4] KVM: PPC: BookE: Add EPR user space support Alexander Graf
2013-01-04 17:36 ` Alexander Graf
2013-01-04 17:36 ` [PATCH 1/4] KVM: PPC: BookE: Allow irq deliveries to inject requests Alexander Graf
2013-01-04 17:36 ` Alexander Graf
2013-01-04 19:40 ` Scott Wood [this message]
2013-01-04 19:40 ` Scott Wood
2013-01-04 23:02 ` Alexander Graf
2013-01-04 23:02 ` Alexander Graf
2013-01-04 17:36 ` [PATCH 2/4] KVM: PPC: BookE: Emulate mfspr on EPR Alexander Graf
2013-01-04 17:36 ` Alexander Graf
2013-01-04 19:50 ` Scott Wood
2013-01-04 19:50 ` Scott Wood
2013-01-04 23:11 ` Alexander Graf
2013-01-04 23:11 ` Alexander Graf
2013-01-04 17:36 ` [PATCH 3/4] KVM: PPC: BookE: Implement EPR exit Alexander Graf
2013-01-04 17:36 ` Alexander Graf
2013-01-04 20:19 ` Scott Wood
2013-01-04 20:19 ` Scott Wood
2013-01-04 17:36 ` [PATCH 4/4] KVM: PPC: BookE: Add EPR ONE_REG sync Alexander Graf
2013-01-04 17:36 ` Alexander Graf
2013-01-04 20:08 ` Scott Wood
2013-01-04 20:08 ` Scott Wood
2013-01-04 22:55 ` Alexander Graf
2013-01-04 22:55 ` Alexander Graf
2013-01-04 23:03 ` Scott Wood
2013-01-04 23:03 ` Scott Wood
2013-01-04 23:06 ` Alexander Graf
2013-01-04 23:06 ` Alexander Graf
2013-01-04 23:41 ` [PATCH 0/4] KVM: PPC: BookE: Add EPR user space support v2 Alexander Graf
2013-01-04 23:41 ` Alexander Graf
2013-01-04 23:41 ` [PATCH 1/4] KVM: PPC: BookE: Allow irq deliveries to inject requests Alexander Graf
2013-01-04 23:41 ` Alexander Graf
2013-01-04 23:41 ` [PATCH 2/4] KVM: PPC: BookE: Emulate mfspr on EPR Alexander Graf
2013-01-04 23:41 ` Alexander Graf
2013-01-04 23:41 ` [PATCH 3/4] KVM: PPC: BookE: Implement EPR exit Alexander Graf
2013-01-04 23:41 ` Alexander Graf
2013-01-07 17:47 ` Scott Wood
2013-01-07 17:47 ` Scott Wood
2013-01-07 17:50 ` Alexander Graf
2013-01-07 17:50 ` Alexander Graf
2013-01-04 23:41 ` [PATCH 4/4] KVM: PPC: BookE: Add EPR ONE_REG sync Alexander Graf
2013-01-04 23:41 ` Alexander Graf
2013-01-07 19:38 ` [PATCH 0/4] KVM: PPC: BookE: Add EPR user space support v3 Alexander Graf
2013-01-07 19:38 ` Alexander Graf
2013-01-07 19:38 ` [PATCH 1/4] KVM: PPC: BookE: Allow irq deliveries to inject requests Alexander Graf
2013-01-07 19:38 ` Alexander Graf
2013-01-07 19:38 ` [PATCH 2/4] KVM: PPC: BookE: Emulate mfspr on EPR Alexander Graf
2013-01-07 19:38 ` Alexander Graf
2013-01-07 19:38 ` [PATCH 3/4] KVM: PPC: BookE: Implement EPR exit Alexander Graf
2013-01-07 19:38 ` Alexander Graf
2013-01-07 19:39 ` [PATCH 4/4] KVM: PPC: BookE: Add EPR ONE_REG sync Alexander Graf
2013-01-07 19:39 ` 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=1357328450.666.13@snotra \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.