Re: [PATCH v1 4/4] KVM/vmx: enable lbr for the guest

2017-09-26 Thread Wei Wang
On 09/27/2017 12:41 AM, Andi Kleen wrote: 1) vCPU context switching and guest side task switching are not identical. That is, when the vCPU is scheduled out, the guest task on the vCPU may not guest task lifetime has nothing to do with this. It's completely independent of what you do here on

Re: [PATCH v1 4/4] KVM/vmx: enable lbr for the guest

2017-09-26 Thread Andi Kleen
> 1) vCPU context switching and guest side task switching are not identical. > That is, when the vCPU is scheduled out, the guest task on the vCPU may not guest task lifetime has nothing to do with this. It's completely independent of what you do here on the VCPU level. > run out its time slice

Re: [PATCH v1 4/4] KVM/vmx: enable lbr for the guest

2017-09-26 Thread Wei Wang
On 09/25/2017 10:57 PM, Andi Kleen wrote: +static void auto_switch_lbr_msrs(struct vcpu_vmx *vmx) +{ + int i; + struct perf_lbr_stack lbr_stack; + + perf_get_lbr_stack(_stack); + + add_atomic_switch_msr(vmx, MSR_LBR_SELECT, 0, 0); + add_atomic_switch_msr(vmx,

Re: [PATCH v1 4/4] KVM/vmx: enable lbr for the guest

2017-09-25 Thread Wei Wang
On 09/25/2017 05:16 PM, Paolo Bonzini wrote: On 25/09/2017 06:44, Wei Wang wrote: Passthrough the LBR stack to the guest, and auto switch the stack MSRs upon VMEntry and VMExit. Signed-off-by: Wei Wang This has to be enabled separately for each guest, because it may

Re: [PATCH v1 4/4] KVM/vmx: enable lbr for the guest

2017-09-25 Thread Paolo Bonzini
On 25/09/2017 06:44, Wei Wang wrote: > Passthrough the LBR stack to the guest, and auto switch the stack MSRs > upon VMEntry and VMExit. > > Signed-off-by: Wei Wang This has to be enabled separately for each guest, because it may prevent live migration to hosts with a

[PATCH v1 4/4] KVM/vmx: enable lbr for the guest

2017-09-24 Thread Wei Wang
Passthrough the LBR stack to the guest, and auto switch the stack MSRs upon VMEntry and VMExit. Signed-off-by: Wei Wang --- arch/x86/kvm/vmx.c | 50 ++ 1 file changed, 50 insertions(+) diff --git a/arch/x86/kvm/vmx.c