Re: [PATCH] kvm/x86/vmx: switch MSR_MISC_FEATURES_ENABLES between host and guest

2019-03-14 Thread Paolo Bonzini
On 14/03/19 13:37, Xiaoyao Li wrote: >> Adding a RDMSR for this to each vmentry is too heavy. Since we emulate >> MSR_MISC_FEATURES_ENABLES, you can just clear the MSR on vcpu_load and >> restore it on vcpu_put. > One question here. Just clear the MSR on vcpu_load instead of writing the >

Re: [PATCH] kvm/x86/vmx: switch MSR_MISC_FEATURES_ENABLES between host and guest

2019-03-14 Thread Xiaoyao Li
On Thu, 2019-03-14 at 12:28 +0100, Paolo Bonzini wrote: > On 14/03/19 07:38, Xiaoyao Li wrote: > > CPUID Faulting is a feature about CPUID instruction. When CPUID Faulting is > > enabled, all execution of the CPUID instruction outside system-management > > mode (SMM) cause a general-protection

Re: [PATCH] kvm/x86/vmx: switch MSR_MISC_FEATURES_ENABLES between host and guest

2019-03-14 Thread Xiaoyao Li
On Thu, 2019-03-14 at 12:28 +0100, Paolo Bonzini wrote: > On 14/03/19 07:38, Xiaoyao Li wrote: > > CPUID Faulting is a feature about CPUID instruction. When CPUID Faulting is > > enabled, all execution of the CPUID instruction outside system-management > > mode (SMM) cause a general-protection

Re: [PATCH] kvm/x86/vmx: switch MSR_MISC_FEATURES_ENABLES between host and guest

2019-03-14 Thread Paolo Bonzini
On 14/03/19 11:43, Xiaoyao Li wrote: > Yes, you are right. With your patches, only when we enable cpuid faulting for > the QEMU or other VMM userspace processes via arch_prctl, does it "leak" into > the KVM guest. > > But arch_prctl is not the only way to enable it. We can enable cpuid faulting

Re: [PATCH] kvm/x86/vmx: switch MSR_MISC_FEATURES_ENABLES between host and guest

2019-03-14 Thread Paolo Bonzini
On 14/03/19 07:38, Xiaoyao Li wrote: > CPUID Faulting is a feature about CPUID instruction. When CPUID Faulting is > enabled, all execution of the CPUID instruction outside system-management > mode (SMM) cause a general-protection (#GP) if the CPL > 0. > > About this feature, detailed information

Re: [PATCH] kvm/x86/vmx: switch MSR_MISC_FEATURES_ENABLES between host and guest

2019-03-14 Thread Xiaoyao Li
On Thu, 2019-03-14 at 21:43 +1300, Kyle Huey wrote: > On Thu, Mar 14, 2019 at 7:50 PM Xiaoyao Li wrote: > > > > CPUID Faulting is a feature about CPUID instruction. When CPUID Faulting is > > enabled, all execution of the CPUID instruction outside system-management > > mode (SMM) cause a

Re: [PATCH] kvm/x86/vmx: switch MSR_MISC_FEATURES_ENABLES between host and guest

2019-03-14 Thread Kyle Huey
On Thu, Mar 14, 2019 at 7:50 PM Xiaoyao Li wrote: > > CPUID Faulting is a feature about CPUID instruction. When CPUID Faulting is > enabled, all execution of the CPUID instruction outside system-management > mode (SMM) cause a general-protection (#GP) if the CPL > 0. > > About this feature,

Re: [PATCH] kvm/x86/vmx: switch MSR_MISC_FEATURES_ENABLES between host and guest

2019-03-14 Thread Xiaoyao Li
Besides, Peter's this patch https://patchwork.kernel.org/patch/10850143/ adds the handling of cpuid faulting in #GP handler. What's more, it enalbes cpuid fauting once function *clear_cpu_cap()* called successfully. From my tests, during kernel booting, there always are some features cleared,