Re: [PATCH 4/4] KVM: PPC: align vcpu_kick with x86

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/09/2011 09:26 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.

Disabling preemption only matters due to the other bit of functionality
you brought over -- avoiding kicking the current CPU.

Probably doesn't even matter all that much with it, since avoiding that
is just an optimization, and any race that causes us to fail to
reschedule a vcpu of a different thread means that thread just
rescheduled anyway.  Not something I feel any great need to rely on,
though. :-)

> Signed-off-by: Alexander Graf <agraf@xxxxxxx>
> ---
>  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();
>  	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();
>  }

Whitespace.

-Scott

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


[Index of Archives]     [KVM Development]     [KVM ARM]     [KVM ia64]     [Linux Virtualization]     [Linux USB Devel]     [Linux Video]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux