Re: [PATCH 3/4] KVM: nVMX: accurate emulation of MSR_IA32_CR{0,4}_FIXED1

2016-11-28 Thread David Matlack
On Wed, Nov 23, 2016 at 3:28 PM, David Matlack wrote: > On Wed, Nov 23, 2016 at 2:11 PM, Paolo Bonzini wrote: >> On 23/11/2016 23:07, David Matlack wrote: >>> A downside of this scheme is we'd have to remember to update >>> nested_vmx_cr4_fixed1_update() before giving VMs new CPUID bits. If we >>

Re: [PATCH 3/4] KVM: nVMX: accurate emulation of MSR_IA32_CR{0,4}_FIXED1

2016-11-23 Thread David Matlack
On Wed, Nov 23, 2016 at 2:11 PM, Paolo Bonzini wrote: > On 23/11/2016 23:07, David Matlack wrote: >> A downside of this scheme is we'd have to remember to update >> nested_vmx_cr4_fixed1_update() before giving VMs new CPUID bits. If we >> forget, a VM could end up with different values for CR{0,4}

Re: [PATCH 3/4] KVM: nVMX: accurate emulation of MSR_IA32_CR{0,4}_FIXED1

2016-11-23 Thread Paolo Bonzini
On 23/11/2016 23:07, David Matlack wrote: > A downside of this scheme is we'd have to remember to update > nested_vmx_cr4_fixed1_update() before giving VMs new CPUID bits. If we > forget, a VM could end up with different values for CR{0,4}_FIXED0 for > the same CPUID depending on which version of

Re: [PATCH 3/4] KVM: nVMX: accurate emulation of MSR_IA32_CR{0,4}_FIXED1

2016-11-23 Thread David Matlack
On Wed, Nov 23, 2016 at 11:24 AM, Paolo Bonzini wrote: > > > On 23/11/2016 20:16, David Matlack wrote: >> > Oh, I thought userspace would do that! Doing it in KVM is fine as well, >> > but then do we need to give userspace access to CR{0,4}_FIXED{0,1} at all? >> >> I think it should be safe for u

Re: [PATCH 3/4] KVM: nVMX: accurate emulation of MSR_IA32_CR{0,4}_FIXED1

2016-11-23 Thread Paolo Bonzini
On 23/11/2016 20:16, David Matlack wrote: > > Oh, I thought userspace would do that! Doing it in KVM is fine as well, > > but then do we need to give userspace access to CR{0,4}_FIXED{0,1} at all? > > I think it should be safe for userspace to skip restoring CR4_FIXED1, > since it is 100% genera

Re: [PATCH 3/4] KVM: nVMX: accurate emulation of MSR_IA32_CR{0,4}_FIXED1

2016-11-23 Thread David Matlack
On Wed, Nov 23, 2016 at 1:06 AM, Paolo Bonzini wrote: > >> Set MSR_IA32_CR{0,4}_FIXED1 to match the CPU's MSRs. >> >> In addition, MSR_IA32_CR4_FIXED1 should reflect the available CR4 bits >> according to CPUID. Whenever guest CPUID is updated by userspace, >> regenerate MSR_IA32_CR4_FIXED1 to mat

Re: [PATCH 3/4] KVM: nVMX: accurate emulation of MSR_IA32_CR{0,4}_FIXED1

2016-11-23 Thread Paolo Bonzini
> Set MSR_IA32_CR{0,4}_FIXED1 to match the CPU's MSRs. > > In addition, MSR_IA32_CR4_FIXED1 should reflect the available CR4 bits > according to CPUID. Whenever guest CPUID is updated by userspace, > regenerate MSR_IA32_CR4_FIXED1 to match it. > > Signed-off-by: David Matlack Oh, I thought use