Re: [Xen-devel] [PATCH v3 08/13] x86/hvm: Setup TSC scaling ratio

2016-01-08 Thread Haozhong Zhang
On 01/08/16 07:04, Jan Beulich wrote: > >>> On 08.01.16 at 14:55, wrote: > > On 01/08/16 02:44, Jan Beulich wrote: > >> >>> On 31.12.15 at 04:03, wrote: > >> > +ratio = mul_u64_u32_div(1ULL << > >> > hvm_funcs.tsc_scaling_ratio_frac_bits, > >> > +gtsc_khz, cpu_khz

Re: [Xen-devel] [PATCH v3 08/13] x86/hvm: Setup TSC scaling ratio

2016-01-08 Thread Jan Beulich
>>> On 08.01.16 at 14:55, wrote: > On 01/08/16 02:44, Jan Beulich wrote: >> >>> On 31.12.15 at 04:03, wrote: >> > +ratio = mul_u64_u32_div(1ULL << hvm_funcs.tsc_scaling_ratio_frac_bits, >> > +gtsc_khz, cpu_khz); >> > + >> > +return (!ratio || ratio > hvm_funcs.

Re: [Xen-devel] [PATCH v3 08/13] x86/hvm: Setup TSC scaling ratio

2016-01-08 Thread Haozhong Zhang
On 01/08/16 02:44, Jan Beulich wrote: > >>> On 31.12.15 at 04:03, wrote: > > @@ -301,6 +302,42 @@ int hvm_set_guest_pat(struct vcpu *v, u64 guest_pat) > > return 1; > > } > > > > +bool_t hvm_validate_tsc_scaling_ratio(uint32_t gtsc_khz) > > +{ > > +u64 ratio; > > + > > +if ( !hvm_f

Re: [Xen-devel] [PATCH v3 08/13] x86/hvm: Setup TSC scaling ratio

2016-01-08 Thread Jan Beulich
>>> On 31.12.15 at 04:03, wrote: > @@ -301,6 +302,42 @@ int hvm_set_guest_pat(struct vcpu *v, u64 guest_pat) > return 1; > } > > +bool_t hvm_validate_tsc_scaling_ratio(uint32_t gtsc_khz) > +{ > +u64 ratio; > + > +if ( !hvm_funcs.tsc_scaling_supported ) > +return FALSE; We

Re: [Xen-devel] [PATCH v3 08/13] x86/hvm: Setup TSC scaling ratio

2016-01-04 Thread Haozhong Zhang
On 01/04/16 13:40, Boris Ostrovsky wrote: > On 12/30/2015 10:03 PM, Haozhong Zhang wrote: > >This patch adds a field tsc_scaling_ratio in struct hvm_vcpu to > >record the TSC scaling ratio, and sets it up when tsc_set_info() is > >called for a vcpu or when a vcpu is restored or reset. > > > >Before

Re: [Xen-devel] [PATCH v3 08/13] x86/hvm: Setup TSC scaling ratio

2016-01-04 Thread Boris Ostrovsky
On 12/30/2015 10:03 PM, Haozhong Zhang wrote: This patch adds a field tsc_scaling_ratio in struct hvm_vcpu to record the TSC scaling ratio, and sets it up when tsc_set_info() is called for a vcpu or when a vcpu is restored or reset. Before applying the TSC scaling ratio to CPU, we check its vali

[Xen-devel] [PATCH v3 08/13] x86/hvm: Setup TSC scaling ratio

2015-12-30 Thread Haozhong Zhang
This patch adds a field tsc_scaling_ratio in struct hvm_vcpu to record the TSC scaling ratio, and sets it up when tsc_set_info() is called for a vcpu or when a vcpu is restored or reset. Before applying the TSC scaling ratio to CPU, we check its validity in tsc_set_info(). If an invalid ratio is g