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>
This commit is contained in:
parent
9cac38dd5d
commit
684851a157
1 changed files with 5 additions and 2 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue