Thread (127 messages) 127 messages, 11 authors, 2017-12-06
STALE3107d
Revisions (3)
  1. v1 current
  2. v3 [diff vs current]
  3. v4 [diff vs current]

[PATCH 06/37] KVM: arm/arm64: Only load/put VCPU state for KVM_RUN

From: Christoffer Dall <hidden>
Date: 2017-10-12 10:41:10
Also in: kvm, kvmarm
Subsystem: kernel virtual machine (kvm), the rest · Maintainers: Paolo Bonzini, Linus Torvalds

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help