summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorTakuya Yoshikawa2014-02-27 07:08:31 +0100
committerPaolo Bonzini2014-02-27 19:25:39 +0100
commit684851a15744355f294ee3fee4ca2e9108382b47 (patch)
tree55eb91ae4ea918cad66c744bdbb38b57730f908a /arch/x86/kvm/x86.c
parentKVM/s390: Set preempted flag during vcpu wakeup and interrupt delivery (diff)
downloadkernel-qcow2-linux-684851a15744355f294ee3fee4ca2e9108382b47.tar.gz
kernel-qcow2-linux-684851a15744355f294ee3fee4ca2e9108382b47.tar.xz
kernel-qcow2-linux-684851a15744355f294ee3fee4ca2e9108382b47.zip
KVM: x86: Break kvm_for_each_vcpu loop after finding the VP_INDEX
No need to scan the entire VCPU array. Signed-off-by: Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 4cca45853dfe..773eba799c45 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2328,9 +2328,12 @@ static int get_msr_hyperv(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
case HV_X64_MSR_VP_INDEX: {
int r;
struct kvm_vcpu *v;
- kvm_for_each_vcpu(r, v, vcpu->kvm)
- if (v == vcpu)
+ kvm_for_each_vcpu(r, v, vcpu->kvm) {
+ if (v == vcpu) {
data = r;
+ break;
+ }
+ }
break;
}
case HV_X64_MSR_EOI: