[PATCH v3 3/4] KVM: X86: Implementation of DEBUGCTLMSR is moved

2015-11-17 Thread Jian Zhou
Move the old implementation of DEBUGCTLMSR from x86.c to vmx.c Signed-off-by: Jian Zhou <jianjay.z...@huawei.com> Signed-off-by: Stephen He <herongguang...@huawei.com> --- arch/x86/kvm/x86.c | 24 +--- 1 file changed, 9 insertions(+), 15 deletions(-) diff --gi

[PATCH v3 4/4] KVM: VMX: Implementation of DEBUGCTLMSR and LBRV

2015-11-17 Thread Jian Zhou
the migration is supported. Signed-off-by: Jian Zhou <jianjay.z...@huawei.com> Signed-off-by: Stephen He <herongguang...@huawei.com> --- arch/x86/kvm/vmx.c | 335 + 1 file changed, 335 insertions(+) diff --git a/arch/x86/kvm/vmx.c b/

[PATCH v3 1/4] KVM: X86: Names and addresses of LBR MSRs

2015-11-17 Thread Jian Zhou
Signed-off-by: Jian Zhou <jianjay.z...@huawei.com> Signed-off-by: Stephen He <herongguang...@huawei.com> --- arch/x86/include/asm/msr-index.h | 26 -- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/inc

[PATCH v3 0/4] KVM: VMX: enable LBR virtualization

2015-11-17 Thread Jian Zhou
CPUs is reorgnized, LBRV can be enabled or not according to the guest CPUID Jian Zhou (4): KVM: X86: Names and addresses of LBR MSRs KVM: X86: Add arrays to save/restore LBR MSRs KVM: X86: Implementation of DEBUGCTLMSR is moved KVM: VMX: Implementation of DEBUGCTLMSR and LBRV arch/x86

[PATCH v3 2/4] KVM: X86: Add arrays to save/restore LBR MSRs

2015-11-17 Thread Jian Zhou
Add arrays in kvm_vcpu_arch struct to save/restore host/guest LBR MSRs at vm exit/entry time. Signed-off-by: Jian Zhou <jianjay.z...@huawei.com> Signed-off-by: Stephen He <herongguang...@huawei.com> --- arch/x86/include/asm/kvm_host.h | 22 -- 1 file changed, 1

Re: [PATCH v2 0/4] KVM: VMX: enable LBR virtualization

2015-11-12 Thread Jian Zhou
On 2015/11/11 23:23, Paolo Bonzini wrote: On 23/10/2015 11:15, Jian Zhou wrote: Changelog in v2: (1) move the implementation into vmx.c (2) migraton is supported (3) add arrays in kvm_vcpu_arch struct to save/restore LBR MSRs at vm exit/entry time. (4) add a parameter

Re: [PATCH v2 3/4] KVM: X86: Migration is supported

2015-11-12 Thread Jian Zhou
On 2015/11/12 17:00, Paolo Bonzini wrote: On 12/11/2015 08:06, Jian Zhou wrote: I think you can just do this in kvm_x86_ops->set_msr. The old implementation for DEBUGCTL MSR can be moved to svm.c. I think you mean "moved to vmx.c"? No, the old implementation is mov

Re: [PATCH v2 3/4] KVM: X86: Migration is supported

2015-11-11 Thread Jian Zhou
On 2015/11/11 23:15, Paolo Bonzini wrote: On 23/10/2015 11:15, Jian Zhou wrote: data *msr_info) } break; case MSR_IA32_DEBUGCTLMSR: - if (!data) { - /* We support the non-activated case already

Re: [PATCH v2 0/4] KVM: VMX: enable LBR virtualization

2015-11-09 Thread Jian Zhou
On 2015/11/9 17:06, Paolo Bonzini wrote: On 09/11/2015 02:33, Jian Zhou wrote: Hi Paolo, May I ask that any suggestion about the version 2 of VMX LBRV? This version is updated following your advices in version 1. BTW the kvm-unit-test for this feature has sent too, and I have tested the CPUs

Re: [PATCH v2 0/4] KVM: VMX: enable LBR virtualization

2015-11-08 Thread Jian Zhou
Hi Paolo, May I ask that any suggestion about the version 2 of VMX LBRV? This version is updated following your advices in version 1. BTW the kvm-unit-test for this feature has sent too, and I have tested the CPUs emulated by QEMU. Thanks, Jian On 2015/10/23 17:15, Jian Zhou wrote: Changelog

[kvm-unit-tests PATCH] KVM: VMX: add tests for MSR_IA32_DEBUGCTLMSR register

2015-10-25 Thread Jian Zhou
tested core2duo, Nehalem, Westmere, SandyBridge, IvyBridge, Haswell and Broadwell. Because LBR depends on the CPU model, it needs to add '-cpu ...' in the command line of x86-run bash script. Signed-off-by: Jian Zhou <jianjay.z...@huawei.com> --- x86/msr.

[PATCH v2 3/4] KVM: X86: Migration is supported

2015-10-23 Thread Jian Zhou
Supported bits of MSR_IA32_DEBUGCTLMSR are DEBUGCTLMSR_LBR(bit 0), DEBUGCTLMSR_BTF(bit 1) and DEBUGCTLMSR_FREEZE_LBRS_ON_PMI(bit 11). Qemu can get/set contents of LBR MSRs and LBR status in order to support migration. Signed-off-by: Jian Zhou <jianjay.z...@huawei.com> Signed-off-by: Step

[PATCH v2 0/4] KVM: VMX: enable LBR virtualization

2015-10-23 Thread Jian Zhou
is reorgnized, LBRV can be enabled or not according to the guest CPUID Jian Zhou (4): KVM: X86: Add arrays to save/restore LBR MSRs KVM: X86: LBR MSRs of supported CPU types KVM: X86: Migration is supported KVM: VMX: details of LBR virtualization implementation arch/x86/include/asm/kvm_host.h

[PATCH v2 2/4] KVM: X86: LBR MSRs of supported CPU types

2015-10-23 Thread Jian Zhou
Macros about LBR MSRs. Signed-off-by: Jian Zhou <jianjay.z...@huawei.com> Signed-off-by: Stephen He <herongguang...@huawei.com> --- arch/x86/include/asm/msr-index.h | 26 -- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/m

[PATCH v2 1/4] KVM: X86: Add arrays to save/restore LBR MSRs

2015-10-23 Thread Jian Zhou
Add arrays in kvm_vcpu_arch struct to save/restore LBR MSRs at vm exit/entry time. Add new hooks to set/get DEBUGCTLMSR and LBR MSRs. Signed-off-by: Jian Zhou <jianjay.z...@huawei.com> Signed-off-by: Stephen He <herongguang...@huawei.com> --- arch/x86/include/asm/kvm

[PATCH v2 4/4] KVM: VMX: details of LBR virtualization implementation

2015-10-23 Thread Jian Zhou
Using msr intercept bitmap and arrays(save/restore LBR MSRs) in kvm_vcpu_arch struct to support LBR virtualization. Add a parameter of kvm_intel module to permanently disable LBRV. Reorgnized the table of supported CPUs, LBRV can be enabled or not according to the guest CPUID. Signed-off-by: Jian

[PATCH v2 3/4] KVM: X86: Migration is supported

2015-10-23 Thread Jian Zhou
Supported bits of MSR_IA32_DEBUGCTLMSR are DEBUGCTLMSR_LBR(bit 0), DEBUGCTLMSR_BTF(bit 1) and DEBUGCTLMSR_FREEZE_LBRS_ON_PMI(bit 11). Qemu can get/set contents of LBR MSRs and LBR status in order to support migration. Signed-off-by: Jian Zhou <jianjay.z...@huawei.com> Signed-off-by: Step

[PATCH v2 1/4] KVM: X86: Add arrays to save/restore LBR MSRs

2015-10-23 Thread Jian Zhou
Add arrays in kvm_vcpu_arch struct to save/restore LBR MSRs at vm exit/entry time. Add new hooks to set/get DEBUGCTLMSR and LBR MSRs. Signed-off-by: Jian Zhou <jianjay.z...@huawei.com> Signed-off-by: Stephen He <herongguang...@huawei.com> --- arch/x86/include/asm/kvm

[PATCH v2 0/4] KVM: VMX: enable LBR virtualization

2015-10-23 Thread Jian Zhou
is reorgnized, LBRV can be enabled or not according to the guest CPUID Jian Zhou (4): KVM: X86: Add arrays to save/restore LBR MSRs KVM: X86: LBR MSRs of supported CPU types KVM: X86: Migration is supported KVM: VMX: details of LBR virtualization implementation arch/x86/include/asm/kvm_host.h

[PATCH v2 4/4] KVM: VMX: details of LBR virtualization implementation

2015-10-23 Thread Jian Zhou
Using msr intercept bitmap and arrays(save/restore LBR MSRs) in kvm_vcpu_arch struct to support LBR virtualization. Add a parameter of kvm_intel module to permanently disable LBRV. Reorgnized the table of supported CPUs, LBRV can be enabled or not according to the guest CPUID. Signed-off-by: Jian

[PATCH v2 2/4] KVM: X86: LBR MSRs of supported CPU types

2015-10-23 Thread Jian Zhou
Macros about LBR MSRs. Signed-off-by: Jian Zhou <jianjay.z...@huawei.com> Signed-off-by: Stephen He <herongguang...@huawei.com> --- arch/x86/include/asm/msr-index.h | 26 -- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/m

Re: [PATCH] KVM: VMX: enable LBR virtualization

2015-10-15 Thread Jian Zhou
On 2015/10/14 19:30, Paolo Bonzini wrote: On 14/10/2015 13:26, Jian Zhou wrote: On 12/10/2015 20:44, Paolo Bonzini wrote: In addition, the MSR numbers may differ between the guest and the host, because it is possible to emulate e.g. a Core CPU on a Core 2 CPU. So I recommend against using

Re: [PATCH] KVM: VMX: enable LBR virtualization

2015-10-15 Thread Jian Zhou
Does it depend on vPMU _for Linux guests_ or in general? My impression is that LBR can be used by the guest independent of the PMU. I think only for Linux guests. I googled how to enable LBR on other guests(except Linux guests), e.g. Windows, and got no developer manuals about it.

Re: [PATCH] KVM: VMX: enable LBR virtualization

2015-10-14 Thread Jian Zhou
On 12/10/2015 20:44, Paolo Bonzini wrote: On 12/10/2015 14:10, Jian Zhou wrote: ping... I think your expectations for review RTT are a bit too optimistic. I have only worked 4 hours since you posted the patch... But it was on my list anyway, so let's do it. Thank for Paolo's time

Re: [PATCH] KVM: VMX: enable LBR virtualization

2015-10-12 Thread Jian Zhou
ping... > Using vmx msr store/load mechanism and msr intercept bitmap > to implement LBR virtualization. > > Signed-off-by: Jian Zhou <jianjay.z...@huawei.com> > Signed-off-by: Stephen He <herongguang...@huawei.com> > > diff --git a/arch/x86/include/asm/

[PATCH] KVM: VMX: enable LBR virtualization

2015-10-10 Thread Jian Zhou
Using vmx msr store/load mechanism and msr intercept bitmap to implement LBR virtualization. Signed-off-by: Jian Zhou <jianjay.z...@huawei.com> Signed-off-by: Stephen He <herongguang...@huawei.com> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h i