[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 11/13] vmx: Use scaled host TSC to calculate TSC offset
On Tue, Oct 27, 2015 at 07:29:44AM -0600, Jan Beulich wrote: > >>> On 28.09.15 at 09:13, <haozhong.zhang@xxxxxxxxx> wrote: > > --- a/xen/arch/x86/hvm/vmx/vmx.c > > +++ b/xen/arch/x86/hvm/vmx/vmx.c > > @@ -1102,11 +1102,26 @@ static void vmx_handle_cd(struct vcpu *v, unsigned > > long value) > > > > static void vmx_set_tsc_offset(struct vcpu *v, u64 offset, u64 at_tsc) > > { > > + uint64_t host_tsc, guest_tsc; > > + struct domain *d = v->domain; > > + > > + guest_tsc = hvm_get_guest_tsc_fixed(v, at_tsc); > > + > > + if ( cpu_has_vmx_tsc_scaling && !d->arch.vtsc ) > > + { > > + host_tsc = at_tsc ? at_tsc : rdtsc(); > > + offset = guest_tsc - hvm_scale_tsc(v, host_tsc); > > + } > > Considering up to here this is basically the same as SVM's, this > should imo be factored out into a new hvm_set_tsc_offset(), > with the caller of hvm_funcs.set_tsc_offset() - lacking a proper > wrapper anyway - being converted to call that function. > I'll add a new hvm_set_tsc_offset() and move the scaling logic from set_tsc_offset callbacks to it. > > vmx_vmcs_enter(v); > > > > + if ( !nestedhvm_enabled(d) ) > > + goto out; > > + > > if ( nestedhvm_vcpu_in_guestmode(v) ) > > offset += nvmx_get_tsc_offset(v); > > > > +out: > > Instead of using goto and a malformed (coding style wise) label, > please simply extend the if() accordingly. > I'll refactor this piece of code to eliminate goto. Haozhong > Jan > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |