diff options
author | Sean Christopherson <sean.j.christopherson@intel.com> | 2019-04-16 13:32:48 -0700 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2019-04-30 21:32:18 +0200 |
commit | 0967fa1cd3769207cf74ae84144ce47fec65a317 (patch) | |
tree | f14d9ba73b5dd415a16b71e96c2314a7da087a69 /arch/x86/kvm/vmx/vmx.c | |
parent | 4ca88b3f86cd03deecd48ca9880a7c2e7c6fb788 (diff) | |
download | linux-stable-0967fa1cd3769207cf74ae84144ce47fec65a317.tar.gz linux-stable-0967fa1cd3769207cf74ae84144ce47fec65a317.tar.bz2 linux-stable-0967fa1cd3769207cf74ae84144ce47fec65a317.zip |
KVM: VMX: Skip delta_tsc shift-and-divide if the dividend is zero
Ten percent of nothin' is... let me do the math here. Nothin' into
nothin', carry the nothin'...
Cc: Wanpeng Li <wanpengli@tencent.com>
Reviewed-by: Liran Alon <liran.alon@oracle.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx/vmx.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 60e2f0afa4d6..d8f101b58ab8 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -7063,10 +7063,9 @@ static int vmx_set_hv_timer(struct kvm_vcpu *vcpu, u64 guest_deadline_tsc, /* Convert to host delta tsc if tsc scaling is enabled */ if (vcpu->arch.tsc_scaling_ratio != kvm_default_tsc_scaling_ratio && - u64_shl_div_u64(delta_tsc, + delta_tsc && u64_shl_div_u64(delta_tsc, kvm_tsc_scaling_ratio_frac_bits, - vcpu->arch.tsc_scaling_ratio, - &delta_tsc)) + vcpu->arch.tsc_scaling_ratio, &delta_tsc)) return -ERANGE; /* |