diff mbox

[24/50] KVM: PPC: align vcpu_kick with x86

Message ID 1325639448-9494-25-git-send-email-agraf@suse.de
State New, archived
Headers show

Commit Message

Alexander Graf Jan. 4, 2012, 1:10 a.m. UTC
Our vcpu kick implementation differs a bit from x86 which resulted in us not
disabling preemption during the kick. Get it a bit closer to what x86 does.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/kvm/powerpc.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

Comments

Avi Kivity Jan. 8, 2012, 1:24 p.m. UTC | #1
On 01/04/2012 03:10 AM, Alexander Graf wrote:
> Our vcpu kick implementation differs a bit from x86 which resulted in us not
> disabling preemption during the kick. Get it a bit closer to what x86 does.
>
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  arch/powerpc/kvm/powerpc.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
> index c952f13..ef8c990 100644
> --- a/arch/powerpc/kvm/powerpc.c
> +++ b/arch/powerpc/kvm/powerpc.c
> @@ -557,12 +557,17 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
>  
>  void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
>  {
> +        int me;
> +        int cpu = vcpu->cpu;
> +
> +        me = get_cpu();

Whitespace.

>  	if (waitqueue_active(&vcpu->wq)) {
>  		wake_up_interruptible(vcpu->arch.wqp);
>  		vcpu->stat.halt_wakeup++;
> -	} else if (vcpu->cpu != -1) {
> +	} else if (cpu != me && cpu != -1) {
>  		smp_send_reschedule(vcpu->cpu);
>  	}
> +        put_cpu();
>  }
>  
>  int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq)

Eventually, let's move kvm_vcpu_kick() to generic code.
Alexander Graf Jan. 8, 2012, 3:14 p.m. UTC | #2
On 08.01.2012, at 14:24, Avi Kivity wrote:

> On 01/04/2012 03:10 AM, Alexander Graf wrote:
>> Our vcpu kick implementation differs a bit from x86 which resulted in us not
>> disabling preemption during the kick. Get it a bit closer to what x86 does.
>> 
>> Signed-off-by: Alexander Graf <agraf@suse.de>
>> ---
>> arch/powerpc/kvm/powerpc.c |    7 ++++++-
>> 1 files changed, 6 insertions(+), 1 deletions(-)
>> 
>> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
>> index c952f13..ef8c990 100644
>> --- a/arch/powerpc/kvm/powerpc.c
>> +++ b/arch/powerpc/kvm/powerpc.c
>> @@ -557,12 +557,17 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
>> 
>> void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
>> {
>> +        int me;
>> +        int cpu = vcpu->cpu;
>> +
>> +        me = get_cpu();
> 
> Whitespace.
> 
>> 	if (waitqueue_active(&vcpu->wq)) {
>> 		wake_up_interruptible(vcpu->arch.wqp);
>> 		vcpu->stat.halt_wakeup++;
>> -	} else if (vcpu->cpu != -1) {
>> +	} else if (cpu != me && cpu != -1) {
>> 		smp_send_reschedule(vcpu->cpu);
>> 	}
>> +        put_cpu();
>> }
>> 
>> int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq)
> 
> Eventually, let's move kvm_vcpu_kick() to generic code.


Yup :). I think Christoffer is working on that.


Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christoffer Dall Jan. 8, 2012, 3:32 p.m. UTC | #3
On Jan 8, 2012, at 7:14 AM, Alexander Graf wrote:

> 
> On 08.01.2012, at 14:24, Avi Kivity wrote:
> 
>> On 01/04/2012 03:10 AM, Alexander Graf wrote:
>>> Our vcpu kick implementation differs a bit from x86 which resulted in us not
>>> disabling preemption during the kick. Get it a bit closer to what x86 does.
>>> 
>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>> ---
>>> arch/powerpc/kvm/powerpc.c |    7 ++++++-
>>> 1 files changed, 6 insertions(+), 1 deletions(-)
>>> 
>>> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
>>> index c952f13..ef8c990 100644
>>> --- a/arch/powerpc/kvm/powerpc.c
>>> +++ b/arch/powerpc/kvm/powerpc.c
>>> @@ -557,12 +557,17 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
>>> 
>>> void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
>>> {
>>> +        int me;
>>> +        int cpu = vcpu->cpu;
>>> +
>>> +        me = get_cpu();
>> 
>> Whitespace.
>> 
>>> 	if (waitqueue_active(&vcpu->wq)) {
>>> 		wake_up_interruptible(vcpu->arch.wqp);
>>> 		vcpu->stat.halt_wakeup++;
>>> -	} else if (vcpu->cpu != -1) {
>>> +	} else if (cpu != me && cpu != -1) {
>>> 		smp_send_reschedule(vcpu->cpu);
>>> 	}
>>> +        put_cpu();
>>> }
>>> 
>>> int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq)
>> 
>> Eventually, let's move kvm_vcpu_kick() to generic code.
> 
> 
> Yup :). I think Christoffer is working on that.
> 

yes, it's done actually and will be shipped any day now.

-Christoffer--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index c952f13..ef8c990 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -557,12 +557,17 @@  int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
 
 void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
 {
+        int me;
+        int cpu = vcpu->cpu;
+
+        me = get_cpu();
 	if (waitqueue_active(&vcpu->wq)) {
 		wake_up_interruptible(vcpu->arch.wqp);
 		vcpu->stat.halt_wakeup++;
-	} else if (vcpu->cpu != -1) {
+	} else if (cpu != me && cpu != -1) {
 		smp_send_reschedule(vcpu->cpu);
 	}
+        put_cpu();
 }
 
 int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq)