Commit 684851a1 authored by Takuya Yoshikawa's avatar Takuya Yoshikawa Committed by Paolo Bonzini

KVM: x86: Break kvm_for_each_vcpu loop after finding the VP_INDEX

No need to scan the entire VCPU array.
Signed-off-by: default avatarTakuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 9cac38dd
...@@ -2328,9 +2328,12 @@ static int get_msr_hyperv(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata) ...@@ -2328,9 +2328,12 @@ static int get_msr_hyperv(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
case HV_X64_MSR_VP_INDEX: { case HV_X64_MSR_VP_INDEX: {
int r; int r;
struct kvm_vcpu *v; struct kvm_vcpu *v;
kvm_for_each_vcpu(r, v, vcpu->kvm) kvm_for_each_vcpu(r, v, vcpu->kvm) {
if (v == vcpu) if (v == vcpu) {
data = r; data = r;
break;
}
}
break; break;
} }
case HV_X64_MSR_EOI: case HV_X64_MSR_EOI:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment