Message ID | 20210227114728.44948-1-ann.zhuangyanying@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | KVM: x86: fix Hot-plugged cpu hang when Configured tsc-frequency is not equal to host | expand |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 1b404e4d7dd8..c3c62a9865d3 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -9952,7 +9952,12 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu) else vcpu->arch.mp_state = KVM_MP_STATE_UNINITIALIZED; - kvm_set_tsc_khz(vcpu, max_tsc_khz); + if (vcpu->kvm->arch.last_tsc_khz) + r = kvm_set_tsc_khz(vcpu, vcpu->kvm->arch.last_tsc_khz); + else + r = kvm_set_tsc_khz(vcpu, max_tsc_khz); + if (r < 0) + return r; r = kvm_mmu_create(vcpu); if (r < 0)