Re: [PATCH] KVM: VMX: Cache IA32_DEBUGCTL in memory

2017-11-29 Thread Andi Kleen
On Wed, Nov 29, 2017 at 11:26:30PM +0100, Paolo Bonzini wrote: > On 29/11/2017 19:20, Andi Kleen wrote: > > But I haven't looked too closely, but I suspect you'll clobber global > > kernel debugger state this way. > > I checked all callers of update_debugctlmsr, and couldn't find any that > could

Re: [PATCH] KVM: VMX: Cache IA32_DEBUGCTL in memory

2017-11-29 Thread Andi Kleen
On Wed, Nov 29, 2017 at 11:26:30PM +0100, Paolo Bonzini wrote: > On 29/11/2017 19:20, Andi Kleen wrote: > > But I haven't looked too closely, but I suspect you'll clobber global > > kernel debugger state this way. > > I checked all callers of update_debugctlmsr, and couldn't find any that > could

Re: [PATCH] KVM: VMX: Cache IA32_DEBUGCTL in memory

2017-11-29 Thread Paolo Bonzini
On 29/11/2017 19:20, Andi Kleen wrote: > But I haven't looked too closely, but I suspect you'll clobber global > kernel debugger state this way. I checked all callers of update_debugctlmsr, and couldn't find any that could run asynchronously while KVM is caching the value. For example

Re: [PATCH] KVM: VMX: Cache IA32_DEBUGCTL in memory

2017-11-29 Thread Paolo Bonzini
On 29/11/2017 19:20, Andi Kleen wrote: > But I haven't looked too closely, but I suspect you'll clobber global > kernel debugger state this way. I checked all callers of update_debugctlmsr, and couldn't find any that could run asynchronously while KVM is caching the value. For example

Re: [PATCH] KVM: VMX: Cache IA32_DEBUGCTL in memory

2017-11-29 Thread Andi Kleen
On Wed, Nov 29, 2017 at 11:05:46AM -0800, Jim Mattson wrote: > An alternative is to give the L1 guest read permission for this MSR in > the MSR permission bitmaps. It's still going to be ~80 cycles, but > that's better than the cost of a VM-exit/VM-entry round-trip. It's a useful optimization, 80

Re: [PATCH] KVM: VMX: Cache IA32_DEBUGCTL in memory

2017-11-29 Thread Andi Kleen
On Wed, Nov 29, 2017 at 11:05:46AM -0800, Jim Mattson wrote: > An alternative is to give the L1 guest read permission for this MSR in > the MSR permission bitmaps. It's still going to be ~80 cycles, but > that's better than the cost of a VM-exit/VM-entry round-trip. It's a useful optimization, 80

Re: [PATCH] KVM: VMX: Cache IA32_DEBUGCTL in memory

2017-11-29 Thread Jim Mattson
An alternative is to give the L1 guest read permission for this MSR in the MSR permission bitmaps. It's still going to be ~80 cycles, but that's better than the cost of a VM-exit/VM-entry round-trip. On Wed, Nov 29, 2017 at 10:20 AM, Andi Kleen wrote: > Wanpeng Li

Re: [PATCH] KVM: VMX: Cache IA32_DEBUGCTL in memory

2017-11-29 Thread Jim Mattson
An alternative is to give the L1 guest read permission for this MSR in the MSR permission bitmaps. It's still going to be ~80 cycles, but that's better than the cost of a VM-exit/VM-entry round-trip. On Wed, Nov 29, 2017 at 10:20 AM, Andi Kleen wrote: > Wanpeng Li writes: > >> From: Wanpeng Li

Re: [PATCH] KVM: VMX: Cache IA32_DEBUGCTL in memory

2017-11-29 Thread Andi Kleen
Wanpeng Li writes: > From: Wanpeng Li > > MSR_IA32_DEBUGCTLMSR is zeroed on VMEXIT, so it is saved/restored > each time during world switch. Jim from Google pointed out that > when running schbench in L2, vmx_vcpu_run will occupy 4% cpu time, >

Re: [PATCH] KVM: VMX: Cache IA32_DEBUGCTL in memory

2017-11-29 Thread Andi Kleen
Wanpeng Li writes: > From: Wanpeng Li > > MSR_IA32_DEBUGCTLMSR is zeroed on VMEXIT, so it is saved/restored > each time during world switch. Jim from Google pointed out that > when running schbench in L2, vmx_vcpu_run will occupy 4% cpu time, > and the 25% of vmx_vcpu_run cpu time is

Re: [PATCH] KVM: VMX: Cache IA32_DEBUGCTL in memory

2017-11-29 Thread Wanpeng Li
2017-11-29 17:13 GMT+08:00 Paolo Bonzini : > On 29/11/2017 09:51, Wanpeng Li wrote: >> 2017-11-29 16:48 GMT+08:00 Paolo Bonzini : >>> On 29/11/2017 07:07, Wanpeng Li wrote: From: Wanpeng Li MSR_IA32_DEBUGCTLMSR is

Re: [PATCH] KVM: VMX: Cache IA32_DEBUGCTL in memory

2017-11-29 Thread Wanpeng Li
2017-11-29 17:13 GMT+08:00 Paolo Bonzini : > On 29/11/2017 09:51, Wanpeng Li wrote: >> 2017-11-29 16:48 GMT+08:00 Paolo Bonzini : >>> On 29/11/2017 07:07, Wanpeng Li wrote: From: Wanpeng Li MSR_IA32_DEBUGCTLMSR is zeroed on VMEXIT, so it is saved/restored each time during

Re: [PATCH] KVM: VMX: Cache IA32_DEBUGCTL in memory

2017-11-29 Thread Paolo Bonzini
On 29/11/2017 09:51, Wanpeng Li wrote: > 2017-11-29 16:48 GMT+08:00 Paolo Bonzini : >> On 29/11/2017 07:07, Wanpeng Li wrote: >>> From: Wanpeng Li >>> >>> MSR_IA32_DEBUGCTLMSR is zeroed on VMEXIT, so it is saved/restored >>> each time during world

Re: [PATCH] KVM: VMX: Cache IA32_DEBUGCTL in memory

2017-11-29 Thread Paolo Bonzini
On 29/11/2017 09:51, Wanpeng Li wrote: > 2017-11-29 16:48 GMT+08:00 Paolo Bonzini : >> On 29/11/2017 07:07, Wanpeng Li wrote: >>> From: Wanpeng Li >>> >>> MSR_IA32_DEBUGCTLMSR is zeroed on VMEXIT, so it is saved/restored >>> each time during world switch. Jim from Google pointed out that >>> when

Re: [PATCH] KVM: VMX: Cache IA32_DEBUGCTL in memory

2017-11-29 Thread Wanpeng Li
2017-11-29 16:48 GMT+08:00 Paolo Bonzini : > On 29/11/2017 07:07, Wanpeng Li wrote: >> From: Wanpeng Li >> >> MSR_IA32_DEBUGCTLMSR is zeroed on VMEXIT, so it is saved/restored >> each time during world switch. Jim from Google pointed out that >> when

Re: [PATCH] KVM: VMX: Cache IA32_DEBUGCTL in memory

2017-11-29 Thread Wanpeng Li
2017-11-29 16:48 GMT+08:00 Paolo Bonzini : > On 29/11/2017 07:07, Wanpeng Li wrote: >> From: Wanpeng Li >> >> MSR_IA32_DEBUGCTLMSR is zeroed on VMEXIT, so it is saved/restored >> each time during world switch. Jim from Google pointed out that >> when running schbench in L2, vmx_vcpu_run will

Re: [PATCH] KVM: VMX: Cache IA32_DEBUGCTL in memory

2017-11-29 Thread Paolo Bonzini
On 29/11/2017 07:07, Wanpeng Li wrote: > From: Wanpeng Li > > MSR_IA32_DEBUGCTLMSR is zeroed on VMEXIT, so it is saved/restored > each time during world switch. Jim from Google pointed out that > when running schbench in L2, vmx_vcpu_run will occupy 4% cpu time, > and

Re: [PATCH] KVM: VMX: Cache IA32_DEBUGCTL in memory

2017-11-29 Thread Paolo Bonzini
On 29/11/2017 07:07, Wanpeng Li wrote: > From: Wanpeng Li > > MSR_IA32_DEBUGCTLMSR is zeroed on VMEXIT, so it is saved/restored > each time during world switch. Jim from Google pointed out that > when running schbench in L2, vmx_vcpu_run will occupy 4% cpu time, > and the 25% of vmx_vcpu_run

[PATCH] KVM: VMX: Cache IA32_DEBUGCTL in memory

2017-11-28 Thread Wanpeng Li
From: Wanpeng Li MSR_IA32_DEBUGCTLMSR is zeroed on VMEXIT, so it is saved/restored each time during world switch. Jim from Google pointed out that when running schbench in L2, vmx_vcpu_run will occupy 4% cpu time, and the 25% of vmx_vcpu_run cpu time is occupied by

[PATCH] KVM: VMX: Cache IA32_DEBUGCTL in memory

2017-11-28 Thread Wanpeng Li
From: Wanpeng Li MSR_IA32_DEBUGCTLMSR is zeroed on VMEXIT, so it is saved/restored each time during world switch. Jim from Google pointed out that when running schbench in L2, vmx_vcpu_run will occupy 4% cpu time, and the 25% of vmx_vcpu_run cpu time is occupied by get_debugctlmsr(). This