From: Christoffer Dall Date: Thu, 12 Dec 2013 04:29:11 +0000 (-0800) Subject: arm/arm64: kvm: Set vcpu->cpu to -1 on vcpu_put X-Git-Tag: v3.12.42~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9ae6f03a85a4108027dc764eeb9625b59f58b0c;p=thirdparty%2Fkernel%2Fstable.git arm/arm64: kvm: Set vcpu->cpu to -1 on vcpu_put commit e9b152cb957cb194437f37e79f0f3c9d34fe53d6 upstream. The arch-generic KVM code expects the cpu field of a vcpu to be -1 if the vcpu is no longer assigned to a cpu. This is used for the optimized make_all_cpus_request path and will be used by the vgic code to check that no vcpus are running. Acked-by: Marc Zyngier Signed-off-by: Christoffer Dall Signed-off-by: Shannon Zhao Signed-off-by: Jiri Slaby --- diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index 9cf07789337fe..d45c36c31e8c4 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -340,6 +340,13 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) { + /* + * The arch-generic KVM code expects the cpu field of a vcpu to be -1 + * if the vcpu is no longer assigned to a cpu. This is used for the + * optimized make_all_cpus_request path. + */ + vcpu->cpu = -1; + kvm_arm_set_running_vcpu(NULL); }