Re: [Xen-devel] [PATCH 00/13] Add VMX TSC scaling support

2015-11-24 Thread Haozhong Zhang
On 11/24/15 21:05, Haozhong Zhang wrote: [...] > > > > > > This bug can be fixed either later by patch 5 which introduces a > > > common function hvm_scale_tsc() to scale TSC, or by replacing above > > > underlined code with a simplified and inli

Re: [Xen-devel] [PATCH 00/13] Add VMX TSC scaling support

2015-11-24 Thread Haozhong Zhang
On 11/23/15 10:37, Boris Ostrovsky wrote: > On 11/22/2015 12:54 PM, Haozhong Zhang wrote: > >Hi Jan, Boris and Aravind, > > > >(Sorry for sending such a long email and thanks for your patience) > > First, thank you very much for doing this. > > > &

Re: [Xen-devel] [PATCH 00/13] Add VMX TSC scaling support

2015-11-22 Thread Haozhong Zhang
Hi Jan, Boris and Aravind, (Sorry for sending such a long email and thanks for your patience) Because this patchset also touches the existing SVM TSC ratio code, I tested it on an AMD machine with an AMD A10-7700K CPU (3.4 GHz) that supports SVM TSC ratio. There are two goals of the test: (1)

Re: [Xen-devel] Xen 4.7 Development Update

2015-11-11 Thread Haozhong Zhang
On 11/09/15 16:15, Wei Liu wrote: [...] > * VMX TSC scaling support > - Haozhong Zhang I'm working on this feature and would like to see it in 4.7 Thanks, Haozhong [...] ___ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.o

Re: [Xen-devel] [PATCH v2] symbols.c: Avoid warn_unused_result build failure on fgets().

2015-11-09 Thread Haozhong Zhang
<jbeul...@suse.com> > Signed-off-by: Riku Voipio <riku.voi...@linaro.org> Tested on Ubuntu 14.04.3 with GCC 4.8.4 and no 'warn_unused_result' warnings any more. Tested-by: Haozhong Zhang <haozhong.zh...@intel.com> > --- > xen/tools/symbols.c | 4 ++-- > 1 file change

Re: [Xen-devel] [PATCH] symbols.c: Avoid warn_unused_result build failure on fgets().

2015-11-08 Thread Haozhong Zhang
On 11/04/15 07:04, Jan Beulich wrote: > >>> On 04.11.15 at 12:39, wrote: > > In commit: > > > > d37d63d symbols: prefix static symbols with their source file names > > > > An unchecked fgets was added. This causes a compile error: > > > > symbols.c: In function

Re: [Xen-devel] [PATCH 06/13] x86/hvm: Scale host TSC when setting/getting guest TSC

2015-11-08 Thread Haozhong Zhang
On 10/27/15 15:16, Aravind Gopalakrishnan wrote: [...] > > Haozhong, Boris- > > I am planning to use a Fam10h system (older processor) and Fam15h Model 60h > (newer processor) for the test case. > > Shall try to run the test on a single system as Haozhong mentioned on a > different reply. > I

Re: [Xen-devel] [PATCH 06/13] x86/hvm: Scale host TSC when setting/getting guest TSC

2015-10-27 Thread Haozhong Zhang
On Thu, Oct 22, 2015 at 08:17:29AM -0600, Jan Beulich wrote: > >>> On 28.09.15 at 09:13, wrote: > > The existing hvm_set_guest_tsc_fixed() and hvm_get_guest_tsc_fixed() > > calculate the guest TSC by adding the TSC offset to the host TSC. When > > the TSC scaling is

Re: [Xen-devel] [PATCH 06/13] x86/hvm: Scale host TSC when setting/getting guest TSC

2015-10-27 Thread Haozhong Zhang
On Tue, Oct 27, 2015 at 02:15:53AM -0600, Jan Beulich wrote: > >>> On 27.10.15 at 02:54, wrote: > > On Thu, Oct 22, 2015 at 08:17:29AM -0600, Jan Beulich wrote: > >> >>> On 28.09.15 at 09:13, wrote: > >> > The existing hvm_set_guest_tsc_fixed()

Re: [Xen-devel] [PATCH 06/13] x86/hvm: Scale host TSC when setting/getting guest TSC

2015-10-27 Thread haozhong . zhang
On Tue, Oct 27, 2015 at 09:10:19AM -0400, Boris Ostrovsky wrote: > On 10/27/2015 04:44 AM, Haozhong Zhang wrote: > >On Thu, Oct 22, 2015 at 08:17:29AM -0600, Jan Beulich wrote: > >>>>>On 28.09.15 at 09:13, <haozhong.zh...@intel.com> wrote: > >

Re: [Xen-devel] [PATCH 11/13] vmx: Use scaled host TSC to calculate TSC offset

2015-10-27 Thread Haozhong Zhang
On Tue, Oct 27, 2015 at 07:29:44AM -0600, Jan Beulich wrote: > >>> On 28.09.15 at 09:13, 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) > >

Re: [Xen-devel] [PATCH 10/13] vmx: Detect and initialize VMX RDTSC(P) scaling

2015-10-27 Thread Haozhong Zhang
On Tue, Oct 27, 2015 at 07:19:04AM -0600, Jan Beulich wrote: > >>> On 28.09.15 at 09:13, wrote: > > @@ -1805,6 +1810,8 @@ void vmcs_dump_vcpu(struct vcpu *v) > > printk("IDTVectoring: info=%08x errcode=%08x\n", > > vmr32(IDT_VECTORING_INFO),

Re: [Xen-devel] [PATCH 06/13] x86/hvm: Scale host TSC when setting/getting guest TSC

2015-10-27 Thread Haozhong Zhang
ITING) > > but the *_VMWRITE_ALL define is missing on your diff for Patch 10.. > > Maybe I am missing something? > > Thanks, > -Aravind. Hi Aravind, This patchset has been sent out for quite a while and is based on commit 9cc1346. Something has changed in master and broken the

Re: [Xen-devel] [PATCH 12/13] vmx: Add a call-back to apply TSC scaling ratio to hardware

2015-10-27 Thread Haozhong Zhang
> it writes the TSC scaling ratio to VMCS field TSC_MULTIPLIER. > > > > Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> > > Looking at this (last non-tools one) patch, I wonder how if this is > needed things can be correct at the point of the series prior t

Re: [Xen-devel] [PATCH 06/13] x86/hvm: Scale host TSC when setting/getting guest TSC

2015-10-26 Thread Haozhong Zhang
On Thu, Oct 22, 2015 at 08:17:29AM -0600, Jan Beulich wrote: > >>> On 28.09.15 at 09:13, wrote: > > The existing hvm_set_guest_tsc_fixed() and hvm_get_guest_tsc_fixed() > > calculate the guest TSC by adding the TSC offset to the host TSC. When > > the TSC scaling is

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

2015-10-23 Thread Haozhong Zhang
On Thu, Oct 22, 2015 at 07:13:07AM -0600, Jan Beulich wrote: > >>> On 28.09.15 at 09:13, wrote: > > This patch adds a field tsc_scaling_ratio in struct arch_vcpu to > > Why not in struct hvm_vcpu? Are you intending any use for PV guests? > > > ---

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

2015-10-23 Thread Haozhong Zhang
On Fri, Oct 23, 2015 at 01:59:46AM -0600, Jan Beulich wrote: > >>> On 23.10.15 at 09:44, wrote: > > On Thu, Oct 22, 2015 at 07:13:07AM -0600, Jan Beulich wrote: > >> >>> On 28.09.15 at 09:13, wrote: > > Please remember to trim your replies. >

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

2015-10-23 Thread Haozhong Zhang
On Fri, Oct 23, 2015 at 02:31:11AM -0600, Jan Beulich wrote: > >>> On 23.10.15 at 10:18, wrote: > > On Fri, Oct 23, 2015 at 01:59:46AM -0600, Jan Beulich wrote: > >> >>> On 23.10.15 at 09:44, wrote: > >> > On Thu, Oct 22, 2015 at 07:13:07AM

Re: [Xen-devel] [PATCH 11/13] vmx: Use scaled host TSC to calculate TSC offset

2015-10-22 Thread Haozhong Zhang
On Thu, Oct 22, 2015 at 03:19:19PM -0400, Boris Ostrovsky wrote: > On 10/22/2015 01:12 PM, Haozhong Zhang wrote: > >On Thu, Oct 22, 2015 at 11:55:00AM -0400, Boris Ostrovsky wrote: > >>On 09/28/2015 03:13 AM, Haozhong Zhang wrote: > >>>If VMX TSC scaling is enable

Re: [Xen-devel] [PATCH 03/13] x86/hvm: Collect information of TSC scaling ratio

2015-10-22 Thread Haozhong Zhang
ferent between VMX > > and SVM. This patch makes the architecture code to collect the number of > > fractional bits and other related information into fields of struct > > hvm_function_table so that they can be used in the common code. > > > > Signed-off-by: Haozhong Zhang <ha

Re: [Xen-devel] [PATCH 09/13] x86/time.c: Scale host TSC in pvclock properly

2015-10-22 Thread Haozhong Zhang
On Thu, Oct 22, 2015 at 11:50:18AM -0400, Boris Ostrovsky wrote: > On 09/28/2015 03:13 AM, Haozhong Zhang wrote: > >This patch makes the pvclock return the scaled host TSC and > >corresponding scaling parameters to HVM domains if guest TSC is not > >emulated and T

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

2015-10-22 Thread Haozhong Zhang
On Thu, Oct 22, 2015 at 10:05:39AM -0600, Jan Beulich wrote: > >>> On 22.10.15 at 17:55, wrote: > > On Thu, Oct 22, 2015 at 07:13:07AM -0600, Jan Beulich wrote: > >> >>> On 28.09.15 at 09:13, wrote: > >> > +{ > >> > +

Re: [Xen-devel] [PATCH 03/13] x86/hvm: Collect information of TSC scaling ratio

2015-10-22 Thread Haozhong Zhang
On Thu, Oct 22, 2015 at 08:51:13AM -0600, Jan Beulich wrote: > >>> On 22.10.15 at 16:40, wrote: > > On Thu, Oct 22, 2015 at 06:53:27AM -0600, Jan Beulich wrote: > >> >>> On 28.09.15 at 09:13, wrote: > >> > ---

Re: [Xen-devel] [PATCH 06/13] x86/hvm: Scale host TSC when setting/getting guest TSC

2015-10-22 Thread Haozhong Zhang
On Thu, Oct 22, 2015 at 08:17:29AM -0600, Jan Beulich wrote: > >>> On 28.09.15 at 09:13, wrote: > > The existing hvm_set_guest_tsc_fixed() and hvm_get_guest_tsc_fixed() > > calculate the guest TSC by adding the TSC offset to the host TSC. When > > the TSC scaling is

Re: [Xen-devel] [PATCH 06/13] x86/hvm: Scale host TSC when setting/getting guest TSC

2015-10-22 Thread Haozhong Zhang
On Thu, Oct 22, 2015 at 11:44:52AM -0400, Boris Ostrovsky wrote: > On 10/22/2015 10:17 AM, Jan Beulich wrote: > On 28.09.15 at 09:13, wrote: > >>The existing hvm_set_guest_tsc_fixed() and hvm_get_guest_tsc_fixed() > >>calculate the guest TSC by adding the TSC offset

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

2015-10-22 Thread Haozhong Zhang
On Thu, Oct 22, 2015 at 07:13:07AM -0600, Jan Beulich wrote: > >>> On 28.09.15 at 09:13, wrote: > > This patch adds a field tsc_scaling_ratio in struct arch_vcpu to > > Why not in struct hvm_vcpu? Are you intending any use for PV guests? > No, I'll move

Re: [Xen-devel] [PATCH 11/13] vmx: Use scaled host TSC to calculate TSC offset

2015-10-22 Thread Haozhong Zhang
On Thu, Oct 22, 2015 at 11:55:00AM -0400, Boris Ostrovsky wrote: > On 09/28/2015 03:13 AM, Haozhong Zhang wrote: > >If VMX TSC scaling is enabled and no TSC emulation is used, > >vmx_set_tsc_offset() will calculate the TSC offset by substracting the > >scaled host TSC from

Re: [Xen-devel] [PATCH 01/13] x86/time.c: Use system time to calculate elapsed_nsec in tsc_get_info()

2015-10-14 Thread Haozhong Zhang
On Wed, Oct 14, 2015 at 03:40:01AM -0600, Jan Beulich wrote: > >>> On 14.10.15 at 04:45, wrote: > > However, patch 2 is still necessary. The existing tsc_get_info() uses > > the host TSC frequency as the guest TSC frequency for a domain in > > TSC_MODE_DEFAULT, which

Re: [Xen-devel] [PATCH 01/13] x86/time.c: Use system time to calculate elapsed_nsec in tsc_get_info()

2015-10-14 Thread Haozhong Zhang
On Wed, Oct 14, 2015 at 04:20:57AM -0600, Jan Beulich wrote: > >>> On 14.10.15 at 12:00, wrote: > > Sounds reasonable. A better patch 2 may look like > > > > - *gtsc_khz = cpu_khz; > > + if ( is_hvm_domain(d) && cpu_has_tsc_ratio ) > > + *gtsc_khz = d->arch.tsc_khz;

Re: [Xen-devel] [PATCH 01/13] x86/time.c: Use system time to calculate elapsed_nsec in tsc_get_info()

2015-10-13 Thread Haozhong Zhang
On Fri, Oct 09, 2015 at 12:51:32AM -0600, Jan Beulich wrote: > >>> On 28.09.15 at 09:13, wrote: > > When the TSC mode of a domain is TSC_MODE_DEFAULT and no TSC emulation > > is used, the existing tsc_get_info() calculates elapsed_nsec by scaling > > the host TSC with a

Re: [Xen-devel] [PATCH 01/13] x86/time.c: Use system time to calculate elapsed_nsec in tsc_get_info()

2015-10-09 Thread Haozhong Zhang
On Fri, Oct 09, 2015 at 11:37:06AM -0400, Boris Ostrovsky wrote: > On 10/09/2015 10:39 AM, Jan Beulich wrote: > On 09.10.15 at 15:41, wrote: > >>On 10/09/2015 02:51 AM, Jan Beulich wrote: > >>On 28.09.15 at 09:13, wrote: > When

Re: [Xen-devel] [PATCH 01/13] x86/time.c: Use system time to calculate elapsed_nsec in tsc_get_info()

2015-10-09 Thread Haozhong Zhang
On Fri, Oct 09, 2015 at 12:51:32AM -0600, Jan Beulich wrote: > >>> On 28.09.15 at 09:13, wrote: > > When the TSC mode of a domain is TSC_MODE_DEFAULT and no TSC emulation > > is used, the existing tsc_get_info() calculates elapsed_nsec by scaling > > the host TSC with a

Re: [Xen-devel] [PATCH 01/13] x86/time.c: Use system time to calculate elapsed_nsec in tsc_get_info()

2015-10-09 Thread Haozhong Zhang
On Fri, Oct 09, 2015 at 12:31:53PM -0400, Boris Ostrovsky wrote: > On 10/09/2015 12:19 PM, Jan Beulich wrote: > On 09.10.15 at 18:09, wrote: > >>On 10/09/2015 11:11 AM, Jan Beulich wrote: > >>On 09.10.15 at 16:00, wrote: > On Fri,

Re: [Xen-devel] [PATCH 01/13] x86/time.c: Use system time to calculate elapsed_nsec in tsc_get_info()

2015-10-09 Thread Haozhong Zhang
On Fri, Oct 09, 2015 at 09:41:36AM -0400, Boris Ostrovsky wrote: > On 10/09/2015 02:51 AM, Jan Beulich wrote: > On 28.09.15 at 09:13, wrote: > >>When the TSC mode of a domain is TSC_MODE_DEFAULT and no TSC emulation > >>is used, the existing tsc_get_info() calculates

Re: [Xen-devel] [PATCH 13/13] tools/libxl: Add 'vtsc_khz' option to set guest TSC rate

2015-09-29 Thread Haozhong Zhang
On Tue, Sep 29, 2015 at 11:07:17AM +0100, Ian Campbell wrote: > On Tue, 2015-09-29 at 08:40 +0800, Haozhong Zhang wrote: > > > > @@ -1462,6 +1462,28 @@ static void parse_config_data(const char > > > > *config_source, > > > > } > > > >

Re: [Xen-devel] [PATCH 13/13] tools/libxl: Add 'vtsc_khz' option to set guest TSC rate

2015-09-29 Thread Haozhong Zhang
On Tue, Sep 29, 2015 at 11:28:38AM +0100, Ian Campbell wrote: > On Tue, 2015-09-29 at 11:24 +0100, Andrew Cooper wrote: > > On 29/09/15 11:13, Haozhong Zhang wrote: > > > On Tue, Sep 29, 2015 at 11:04:14AM +0100, Ian Campbell wrote: > > > > On Mon, 2015-09-28 at 15:

Re: [Xen-devel] [PATCH 12/13] vmx: Add a call-back to apply TSC scaling ratio to hardware

2015-09-29 Thread Haozhong Zhang
On Tue, Sep 29, 2015 at 11:25:56AM +0100, Andrew Cooper wrote: > On 29/09/15 11:02, Haozhong Zhang wrote: > > On Tue, Sep 29, 2015 at 10:33:14AM +0100, Andrew Cooper wrote: > >> On 29/09/15 02:07, Haozhong Zhang wrote: > >>> On Mon, Sep 28, 2015 at 12:02:08P

Re: [Xen-devel] [PATCH 13/13] tools/libxl: Add 'vtsc_khz' option to set guest TSC rate

2015-09-29 Thread Haozhong Zhang
On Tue, Sep 29, 2015 at 10:20:21AM +0100, Wei Liu wrote: > On Tue, Sep 29, 2015 at 08:40:23AM +0800, Haozhong Zhang wrote: > > On Mon, Sep 28, 2015 at 03:19:25PM +0100, Wei Liu wrote: > > > On Mon, Sep 28, 2015 at 03:13:58PM +0800, Haozhong Zhang wrote: > > > > This

Re: [Xen-devel] [PATCH 13/13] tools/libxl: Add 'vtsc_khz' option to set guest TSC rate

2015-09-29 Thread Haozhong Zhang
On Tue, Sep 29, 2015 at 11:04:14AM +0100, Ian Campbell wrote: > On Mon, 2015-09-28 at 15:13 +0800, Haozhong Zhang wrote: > > This patch adds an option 'vtsc_khz' to allow users to set vcpu's TSC > > rate in KHz. In the case that tsc_mode = 'default', the default value of > &

Re: [Xen-devel] [PATCH 12/13] vmx: Add a call-back to apply TSC scaling ratio to hardware

2015-09-29 Thread Haozhong Zhang
On Tue, Sep 29, 2015 at 10:33:14AM +0100, Andrew Cooper wrote: > On 29/09/15 02:07, Haozhong Zhang wrote: > > On Mon, Sep 28, 2015 at 12:02:08PM -0400, Boris Ostrovsky wrote: > >> On 09/28/2015 03:13 AM, Haozhong Zhang wrote: > >>> This patch adds a new call-ba

Re: [Xen-devel] [PATCH 13/13] tools/libxl: Add 'vtsc_khz' option to set guest TSC rate

2015-09-29 Thread Haozhong Zhang
On Tue, Sep 29, 2015 at 03:37:06PM +0100, Ian Campbell wrote: > On Tue, 2015-09-29 at 22:01 +0800, Haozhong Zhang wrote: > > On Tue, Sep 29, 2015 at 02:56:12PM +0100, Andrew Cooper wrote: > > > On 29/09/15 14:53, Haozhong Zhang wrote: > > > > On Tue, Sep 29, 2015 at

[Xen-devel] [PATCH 10/13] vmx: Detect and initialize VMX RDTSC(P) scaling

2015-09-28 Thread Haozhong Zhang
This patch adds the detection and initialization code for VMX TSC scaling. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- xen/arch/x86/hvm/vmx/vmcs.c| 11 +-- xen/arch/x86/hvm/vmx/vmx.c | 9 + xen/include/asm-x86/hvm/vmx/vmcs.h | 7 +++ 3

[Xen-devel] [PATCH 12/13] vmx: Add a call-back to apply TSC scaling ratio to hardware

2015-09-28 Thread Haozhong Zhang
This patch adds a new call-back setup_tsc_scaling in struct hvm_function_table to apply the TSC scaling ratio to hardware. For VMX, it writes the TSC scaling ratio to VMCS field TSC_MULTIPLIER. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- xen/arch/x86/hvm/hvm.c| 1

[Xen-devel] [PATCH 09/13] x86/time.c: Scale host TSC in pvclock properly

2015-09-28 Thread Haozhong Zhang
This patch makes the pvclock return the scaled host TSC and corresponding scaling parameters to HVM domains if guest TSC is not emulated and TSC scaling is enabled. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- xen/arch/x86/time.c | 15 --- 1 file chang

[Xen-devel] [PATCH 11/13] vmx: Use scaled host TSC to calculate TSC offset

2015-09-28 Thread Haozhong Zhang
If VMX TSC scaling is enabled and no TSC emulation is used, vmx_set_tsc_offset() will calculate the TSC offset by substracting the scaled host TSC from the current guest TSC. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- xen/arch/x86/hvm/vmx/vmx.c | 15 +++

[Xen-devel] [PATCH 05/13] x86/hvm: Replace architecture TSC scaling by a common function

2015-09-28 Thread Haozhong Zhang
This patch implements a common function hvm_scale_tsc() to calculate the scaling of TSC by using TSC scaling information which is collected by architecture code. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- xen/arch/x86/hvm/hvm.c

[Xen-devel] [PATCH 06/13] x86/hvm: Scale host TSC when setting/getting guest TSC

2015-09-28 Thread Haozhong Zhang
The existing hvm_set_guest_tsc_fixed() and hvm_get_guest_tsc_fixed() calculate the guest TSC by adding the TSC offset to the host TSC. When the TSC scaling is enabled, the host TSC should be scaled first. This patch adds the scaling logic to those two functions. Signed-off-by: Haozhong Zhang

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

2015-09-28 Thread Haozhong Zhang
This patch adds a field tsc_scaling_ratio in struct arch_vcpu to represent the TSC scaling ratio, and sets it up when tsc_set_info() is called for a vcpu or a vcpu is restored or reset. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- xen/arch/x86/hvm/hvm.c

[Xen-devel] [PATCH 00/13] Add VMX TSC scaling support

2015-09-28 Thread Haozhong Zhang
MX TSC scaling (as well as SVM TSC ratio). Haozhong Zhang (13): x86/time.c: Use system time to calculate elapsed_nsec in tsc_get_info() x86/time.c: Get the correct guest TSC rate in tsc_get_info() x86/hvm: Collect information of TSC scaling ratio x86/hvm: Setup TSC scaling ratio x

[Xen-devel] [PATCH 01/13] x86/time.c: Use system time to calculate elapsed_nsec in tsc_get_info()

2015-09-28 Thread Haozhong Zhang
rate. This patch fixes this problem by using the system time as elapsed_nsec. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- xen/arch/x86/time.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index bbb7e6c..a345efb

[Xen-devel] [PATCH 02/13] x86/time.c: Get the correct guest TSC rate in tsc_get_info()

2015-09-28 Thread Haozhong Zhang
. In order to keep consistent to tsc_set_info(), this patch make tsc_get_info() use the value set by tsc_set_info() as the guest TSC rate. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- xen/arch/x86/time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/ar

[Xen-devel] [PATCH 08/13] x86/hvm: Detect TSC scaling through hvm_funcs in tsc_set_info()

2015-09-28 Thread Haozhong Zhang
This patch uses hvm_funcs.tsc_scaling_supported instead of the architecture code to detect the TSC scaling support. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- xen/arch/x86/time.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xen/arch/x86/time.c

[Xen-devel] [PATCH 03/13] x86/hvm: Collect information of TSC scaling ratio

2015-09-28 Thread Haozhong Zhang
hvm_function_table so that they can be used in the common code. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- xen/arch/x86/hvm/svm/svm.c| 9 + xen/arch/x86/hvm/vmx/vmx.c| 2 ++ xen/include/asm-x86/hvm/hvm.h | 13 + xen/include/asm-x86/hvm/svm/svm.

[Xen-devel] [PATCH 07/13] x86/hvm: Move saving/loading vcpu's TSC to common code

2015-09-28 Thread Haozhong Zhang
Both VMX and SVM saves/loads vcpu's TSC when saving/loading vcpu's context, so this patch moves saving/loading vcpu's TSC to the common function hvm_save_cpu_ctxt()/hvm_load_cpu_ctxt(). Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- xen/arch/x86/hvm/hvm.c | 4 xen/ar

Re: [Xen-devel] [PATCH 13/13] tools/libxl: Add 'vtsc_khz' option to set guest TSC rate

2015-09-28 Thread Haozhong Zhang
Hi Julien, Thank you for the comments! On Mon, Sep 28, 2015 at 12:47:24PM +0100, Julien Grall wrote: > Hi, > > On 28/09/15 08:13, Haozhong Zhang wrote: > > This patch adds an option 'vtsc_khz' to allow users to set vcpu's TSC > > rate in KHz. In the case that tsc_mode = '

Re: [Xen-devel] [PATCH 09/13] x86/time.c: Scale host TSC in pvclock properly

2015-09-28 Thread Haozhong Zhang
On Mon, Sep 28, 2015 at 12:36:51PM -0400, Boris Ostrovsky wrote: > On 09/28/2015 03:13 AM, Haozhong Zhang wrote: > >This patch makes the pvclock return the scaled host TSC and > >corresponding scaling parameters to HVM domains if guest TSC is not > >emulated and T

Re: [Xen-devel] [PATCH 13/13] tools/libxl: Add 'vtsc_khz' option to set guest TSC rate

2015-09-28 Thread Haozhong Zhang
On Mon, Sep 28, 2015 at 03:19:25PM +0100, Wei Liu wrote: > On Mon, Sep 28, 2015 at 03:13:58PM +0800, Haozhong Zhang wrote: > > This patch adds an option 'vtsc_khz' to allow users to set vcpu's TSC > > rate in KHz. In the case that tsc_mode = 'default', the default value of > &

Re: [Xen-devel] [PATCH 12/13] vmx: Add a call-back to apply TSC scaling ratio to hardware

2015-09-28 Thread Haozhong Zhang
On Mon, Sep 28, 2015 at 12:02:08PM -0400, Boris Ostrovsky wrote: > On 09/28/2015 03:13 AM, Haozhong Zhang wrote: > >This patch adds a new call-back setup_tsc_scaling in struct > >hvm_function_table to apply the TSC scaling ratio to hardware. For VMX, > >it writes the TSC

Re: [Xen-devel] [PATCH v2 2/4] tools/xen-mceinj: Fix code style

2015-09-16 Thread Haozhong Zhang
On Wed, Sep 16, 2015 at 08:45:58AM +0100, Wei Liu wrote: > On Wed, Sep 16, 2015 at 01:35:13PM +0800, Haozhong Zhang wrote: > > Remove trailing whitespaces in xen-mceinj.c. > > > > Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> > > Acked-by: Wei Liu &l

Re: [Xen-devel] [PATCH v2 2/4] tools/xen-mceinj: Fix code style

2015-09-16 Thread Haozhong Zhang
On Wed, Sep 16, 2015 at 08:58:41AM +0100, Wei Liu wrote: > On Wed, Sep 16, 2015 at 03:52:39PM +0800, Haozhong Zhang wrote: > > On Wed, Sep 16, 2015 at 08:45:58AM +0100, Wei Liu wrote: > > > On Wed, Sep 16, 2015 at 01:35:13PM +0800, Haozhong Zhang wrote: > > > > Remo

Re: [Xen-devel] [PATCH 3/4] x86/mce: Translate passed-in GPA to host machine address

2015-09-15 Thread Haozhong Zhang
On Tue, Sep 15, 2015 at 02:50:27PM +0100, Andrew Cooper wrote: > On 15/09/15 14:42, Haozhong Zhang wrote: > > > >>> +mfn = mfn_x(get_gfn(d, gpfn, )); > >>> + > >>> +if (mfn == INVALID_MFN) { > >>> +

[Xen-devel] [PATCH v2 4/4] tools/xen-mceinj: Pass in GPA when injecting through MSR_MCI_ADDR

2015-09-15 Thread Haozhong Zhang
-by: Haozhong Zhang <haozhong.zh...@intel.com> --- tools/tests/mce-test/tools/xen-mceinj.c | 152 ++-- 1 file changed, 29 insertions(+), 123 deletions(-) diff --git a/tools/tests/mce-test/tools/xen-mceinj.c b/tools/tests/mce-test/tools/xen-mceinj.c index 71813c6..3

[Xen-devel] [PATCH v2 1/4] x86/mce: Fix code style

2015-09-15 Thread Haozhong Zhang
Remove trailing whitespaces and fix indentations in mce.c and xen_mca.h. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- xen/arch/x86/cpu/mcheck/mce.c | 10 +- xen/include/public/arch-x86/xen-mca.h | 30 +++--- 2 files changed, 20 inse

[Xen-devel] [PATCH v2 0/4] Fix tools/xen-mceinj to handle >=4GB guest memory

2015-09-15 Thread Haozhong Zhang
-mceinj.c. 7. Update the commit message of patch 4 to explicitly state that the address translation is moved to the hypervisor. Haozhong Zhang (4): x86/mce: Fix code style tools/xen-mceinj: Fix code style x86/mce: Translate passed-in GPA to host machine address tools/xen-mceinj: Pass i

[Xen-devel] [PATCH v2 3/4] x86/mce: Translate passed-in GPA to host machine address

2015-09-15 Thread Haozhong Zhang
This patch adds a new flag MC_MSRINJ_F_GPADDR to xen_mc_msrinject.mcinj_flags, and makes do_mca() to translate the guest physical address passed-in through xen_mc_msrinject.mcinj_msr[i].value to the host machine address if this flag is present. Signed-off-by: Haozhong Zhang <haozhong

[Xen-devel] [PATCH v2 2/4] tools/xen-mceinj: Fix code style

2015-09-15 Thread Haozhong Zhang
Remove trailing whitespaces in xen-mceinj.c. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- tools/tests/mce-test/tools/xen-mceinj.c | 66 - 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/tools/tests/mce-test/tools/xen-mcein

[Xen-devel] [PATCH 4/4] tools/xen-mceinj: Pass in GPA when injecting through MSR_MCI_ADDR

2015-09-15 Thread Haozhong Zhang
This patch removes the address translation in xen-mceinj which translates the guest physical address passed-in through the argument of '-p' to the host machine address. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- tools/tests/mce-test/tools/xen-mceinj.c

[Xen-devel] [PATCH 2/4] tools/mceinject: Fix code style

2015-09-15 Thread Haozhong Zhang
Remove trailing spaces in xen-mceinj.c. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- tools/tests/mce-test/tools/xen-mceinj.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/tests/mce-test/tools/xen-mceinj.c b/tools/tests/mce-test

[Xen-devel] [PATCH 0/4] Fix tools/xen-mceinj to handle >=4GB guest memory

2015-09-15 Thread Haozhong Zhang
by moving the translation from xen-mceinj to the hypervisor, so that it is not necessary to use XEN_DOMCTL_getmemlist. The first two patches just fix serval code-style issues, while the other two are the actual fix. Haozhong Zhang (4): x86/mce: Fix code style tools/mceinject: Fix code style x86/mce:

Re: [Xen-devel] [PATCH 3/4] x86/mce: Translate passed-in GPA to host machine address

2015-09-15 Thread Haozhong Zhang
On Tue, Sep 15, 2015 at 11:14:26AM +0200, Egger, Christoph wrote: > On 2015/09/15 10:29, Haozhong Zhang wrote: > > This patch adds a new flag MC_MSRINJ_F_GPADDR to > > xen_mc_msrinject.mcinj_flags, and makes do_mca() to translate the > > guest physical addr

[Xen-devel] [PATCH 1/4] x86/mce: Fix code style

2015-09-15 Thread Haozhong Zhang
Remove trailing spaces and fix indentations in mce.c and xen-mca.h. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- xen/arch/x86/cpu/mcheck/mce.c | 10 +- xen/include/public/arch-x86/xen-mca.h | 28 ++-- 2 files changed, 19 insertions(

[Xen-devel] [PATCH 3/4] x86/mce: Translate passed-in GPA to host machine address

2015-09-15 Thread Haozhong Zhang
This patch adds a new flag MC_MSRINJ_F_GPADDR to xen_mc_msrinject.mcinj_flags, and makes do_mca() to translate the guest physical address passed-in through xen_mc_msrinject.mcinj_msr[i].value to the host machine address if this flag is present. Signed-off-by: Haozhong Zhang <haozhong

Re: [Xen-devel] [PATCH 4/4] tools/xen-mceinj: Pass in GPA when injecting through MSR_MCI_ADDR

2015-09-15 Thread Haozhong Zhang
On Tue, Sep 15, 2015 at 11:20:20AM +0100, Ian Campbell wrote: > On Tue, 2015-09-15 at 16:29 +0800, Haozhong Zhang wrote: > > This patch removes the address translation in xen-mceinj which > > translates the guest physical address passed-in through the argument > > of '-p

Re: [Xen-devel] [PATCH 4/4] tools/xen-mceinj: Pass in GPA when injecting through MSR_MCI_ADDR

2015-09-15 Thread Haozhong Zhang
On Tue, Sep 15, 2015 at 12:17:01PM +0200, Egger, Christoph wrote: > On 2015/09/15 10:29, Haozhong Zhang wrote: > > This patch removes the address translation in xen-mceinj which > > translates the guest physical address passed-in through the argument > > of '-p' to the

Re: [Xen-devel] [PATCH 3/4] x86/mce: Translate passed-in GPA to host machine address

2015-09-15 Thread Haozhong Zhang
On Tue, Sep 15, 2015 at 07:24:34AM -0600, Jan Beulich wrote: > >>> On 15.09.15 at 10:29, wrote: > > @@ -1422,6 +1423,38 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) > > u_xen_mc) > > if (mc_msrinject->mcinj_count == 0) > > return 0; > > > > +

Re: [Xen-devel] [PATCH 1/4] x86/mce: Fix code style

2015-09-15 Thread Haozhong Zhang
On Tue, Sep 15, 2015 at 07:13:16AM -0600, Jan Beulich wrote: > >>> On 15.09.15 at 10:29, wrote: > > --- a/xen/arch/x86/cpu/mcheck/mce.c > > +++ b/xen/arch/x86/cpu/mcheck/mce.c > > @@ -105,7 +105,7 @@ void x86_mce_callback_register(x86_mce_callback_t > > cbfunc) > >

<    2   3   4   5   6   7