From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoffer Dall Subject: [PATCH 06/37] KVM: arm/arm64: Only load/put VCPU state for KVM_RUN Date: Thu, 12 Oct 2017 12:41:10 +0200 Message-ID: <20171012104141.26902-7-christoffer.dall@linaro.org> References: <20171012104141.26902-1-christoffer.dall@linaro.org> Cc: kvm@vger.kernel.org, Marc Zyngier , Shih-Wei Li , Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Return-path: Received: from mail-wm0-f43.google.com ([74.125.82.43]:53950 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756122AbdJLKlv (ORCPT ); Thu, 12 Oct 2017 06:41:51 -0400 Received: by mail-wm0-f43.google.com with SMTP id q132so12090088wmd.2 for ; Thu, 12 Oct 2017 03:41:50 -0700 (PDT) In-Reply-To: <20171012104141.26902-1-christoffer.dall@linaro.org> Sender: kvm-owner@vger.kernel.org List-ID: We only want to do things like invalidating TLBs or load timer state onto the physical CPU if we really intend to run the VCPU, not if we are simply retrieving some in-kernel value from userspace, for example. Signed-off-by: Christoffer Dall --- virt/kvm/arm/arm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c index 6e9513e..d495453 100644 --- a/virt/kvm/arm/arm.c +++ b/virt/kvm/arm/arm.c @@ -338,6 +338,9 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) { int *last_ran; + if (vcpu->ioctl != KVM_RUN) + return; + last_ran = this_cpu_ptr(vcpu->kvm->arch.last_vcpu_ran); /* @@ -359,6 +362,9 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) { + if (vcpu->ioctl != KVM_RUN) + return; + kvm_timer_vcpu_put(vcpu); kvm_vgic_put(vcpu); -- 2.9.0