Message ID | 20190412201834.10831-8-sean.j.christopherson@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | KVM: lapic: Fix a variety of timer adv issues | expand |
> On 12 Apr 2019, at 23:18, Sean Christopherson <sean.j.christopherson@intel.com> wrote: > > Ten percent of nothin' is... let me do the math here. Nothin' into > nothin', carry the nothin'... > > Cc: Wanpeng Li <wanpengli@tencent.com> > Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> I think you should explicitly state in commit message title that this is an optimisation. A rather small one I must say :) Having said that: Reviewed-by: Liran Alon <liran.alon@oracle.com> -Liran > --- > arch/x86/kvm/vmx/vmx.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index a3211e3ee679..2fec11bc0ac9 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -7050,10 +7050,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; > > /* > -- > 2.21.0 >
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index a3211e3ee679..2fec11bc0ac9 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -7050,10 +7050,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; /*
Ten percent of nothin' is... let me do the math here. Nothin' into nothin', carry the nothin'... Cc: Wanpeng Li <wanpengli@tencent.com> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> --- arch/x86/kvm/vmx/vmx.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)