public inbox for kvm-ppc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: PPC: booke: check for signals in kvmppc_vcpu_run
@ 2011-11-08 22:11 Scott Wood
  2011-11-11 14:09 ` Alexander Graf
  0 siblings, 1 reply; 5+ messages in thread
From: Scott Wood @ 2011-11-08 22:11 UTC (permalink / raw)
  To: agraf; +Cc: kvm, kvm-ppc

Currently we check prior to returning from a lightweight exit,
but not prior to initial entry.

book3s already does a similar test.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/kvm/booke.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index b642200..9c78589 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -322,11 +322,19 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
 	}
 
 	local_irq_disable();
+
+	if (signal_pending(current)) {
+		kvm_run->exit_reason = KVM_EXIT_INTR;
+		ret = -EINTR;
+		goto out;
+	}
+
 	kvm_guest_enter();
 	ret = __kvmppc_vcpu_run(kvm_run, vcpu);
 	kvm_guest_exit();
-	local_irq_enable();
 
+out:
+	local_irq_enable();
 	return ret;
 }
 
-- 
1.7.7.rc3.4.g8d714


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] KVM: PPC: booke: check for signals in kvmppc_vcpu_run
  2011-11-08 22:11 [PATCH] KVM: PPC: booke: check for signals in kvmppc_vcpu_run Scott Wood
@ 2011-11-11 14:09 ` Alexander Graf
  2011-11-11 15:32   ` Scott Wood
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Graf @ 2011-11-11 14:09 UTC (permalink / raw)
  To: Scott Wood; +Cc: kvm, kvm-ppc

On 11/08/2011 11:11 PM, Scott Wood wrote:
> Currently we check prior to returning from a lightweight exit,
> but not prior to initial entry.
>
> book3s already does a similar test.
>
> Signed-off-by: Scott Wood<scottwood@freescale.com>
> ---
>   arch/powerpc/kvm/booke.c |   10 +++++++++-
>   1 files changed, 9 insertions(+), 1 deletions(-)
>
> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
> index b642200..9c78589 100644
> --- a/arch/powerpc/kvm/booke.c
> +++ b/arch/powerpc/kvm/booke.c
> @@ -322,11 +322,19 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
>   	}
>
>   	local_irq_disable();
> +
> +	if (signal_pending(current)) {

Any reason you're doing this after irq_disable()?


Alex


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] KVM: PPC: booke: check for signals in kvmppc_vcpu_run
  2011-11-11 14:09 ` Alexander Graf
@ 2011-11-11 15:32   ` Scott Wood
  2011-11-11 15:35     ` Alexander Graf
  0 siblings, 1 reply; 5+ messages in thread
From: Scott Wood @ 2011-11-11 15:32 UTC (permalink / raw)
  To: Alexander Graf; +Cc: kvm, kvm-ppc

On Fri, Nov 11, 2011 at 03:09:17PM +0100, Alexander Graf wrote:
> On 11/08/2011 11:11 PM, Scott Wood wrote:
> >Currently we check prior to returning from a lightweight exit,
> >but not prior to initial entry.
> >
> >book3s already does a similar test.
> >
> >Signed-off-by: Scott Wood<scottwood@freescale.com>
> >---
> >  arch/powerpc/kvm/booke.c |   10 +++++++++-
> >  1 files changed, 9 insertions(+), 1 deletions(-)
> >
> >diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
> >index b642200..9c78589 100644
> >--- a/arch/powerpc/kvm/booke.c
> >+++ b/arch/powerpc/kvm/booke.c
> >@@ -322,11 +322,19 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
> >  	}
> >
> >  	local_irq_disable();
> >+
> >+	if (signal_pending(current)) {
> 
> Any reason you're doing this after irq_disable()?

If we get a signal after the check, we want to be sure that we don't
receive the reschedule IPI until after we're in the guest, so that it
will cause another signal check.

-Scott


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] KVM: PPC: booke: check for signals in kvmppc_vcpu_run
  2011-11-11 15:32   ` Scott Wood
@ 2011-11-11 15:35     ` Alexander Graf
  2011-11-11 19:05       ` Scott Wood
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Graf @ 2011-11-11 15:35 UTC (permalink / raw)
  To: Scott Wood; +Cc: kvm, kvm-ppc

On 11/11/2011 04:32 PM, Scott Wood wrote:
> On Fri, Nov 11, 2011 at 03:09:17PM +0100, Alexander Graf wrote:
>> On 11/08/2011 11:11 PM, Scott Wood wrote:
>>> Currently we check prior to returning from a lightweight exit,
>>> but not prior to initial entry.
>>>
>>> book3s already does a similar test.
>>>
>>> Signed-off-by: Scott Wood<scottwood@freescale.com>
>>> ---
>>>   arch/powerpc/kvm/booke.c |   10 +++++++++-
>>>   1 files changed, 9 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
>>> index b642200..9c78589 100644
>>> --- a/arch/powerpc/kvm/booke.c
>>> +++ b/arch/powerpc/kvm/booke.c
>>> @@ -322,11 +322,19 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
>>>   	}
>>>
>>>   	local_irq_disable();
>>> +
>>> +	if (signal_pending(current)) {
>> Any reason you're doing this after irq_disable()?
> If we get a signal after the check, we want to be sure that we don't
> receive the reschedule IPI until after we're in the guest, so that it
> will cause another signal check.

Makes sense. So the current book3s implementation is wrong?


Alex


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] KVM: PPC: booke: check for signals in kvmppc_vcpu_run
  2011-11-11 15:35     ` Alexander Graf
@ 2011-11-11 19:05       ` Scott Wood
  0 siblings, 0 replies; 5+ messages in thread
From: Scott Wood @ 2011-11-11 19:05 UTC (permalink / raw)
  To: Alexander Graf; +Cc: kvm, kvm-ppc

On 11/11/2011 09:35 AM, Alexander Graf wrote:
> On 11/11/2011 04:32 PM, Scott Wood wrote:
>> On Fri, Nov 11, 2011 at 03:09:17PM +0100, Alexander Graf wrote:
>>> On 11/08/2011 11:11 PM, Scott Wood wrote:
>>>> Currently we check prior to returning from a lightweight exit,
>>>> but not prior to initial entry.
>>>>
>>>> book3s already does a similar test.
>>>>
>>>> Signed-off-by: Scott Wood<scottwood@freescale.com>
>>>> ---
>>>>   arch/powerpc/kvm/booke.c |   10 +++++++++-
>>>>   1 files changed, 9 insertions(+), 1 deletions(-)
>>>>
>>>> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
>>>> index b642200..9c78589 100644
>>>> --- a/arch/powerpc/kvm/booke.c
>>>> +++ b/arch/powerpc/kvm/booke.c
>>>> @@ -322,11 +322,19 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run,
>>>> struct kvm_vcpu *vcpu)
>>>>       }
>>>>
>>>>       local_irq_disable();
>>>> +
>>>> +    if (signal_pending(current)) {
>>> Any reason you're doing this after irq_disable()?
>> If we get a signal after the check, we want to be sure that we don't
>> receive the reschedule IPI until after we're in the guest, so that it
>> will cause another signal check.
> 
> Makes sense. So the current book3s implementation is wrong?

I think so.

-Scott


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-11-11 19:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-08 22:11 [PATCH] KVM: PPC: booke: check for signals in kvmppc_vcpu_run Scott Wood
2011-11-11 14:09 ` Alexander Graf
2011-11-11 15:32   ` Scott Wood
2011-11-11 15:35     ` Alexander Graf
2011-11-11 19:05       ` Scott Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox