Re: [PATCH] KVM: vmx: Fix the broken usage of vmx_xsaves_supported

2019-06-20 Thread Wanpeng Li
On Thu, 20 Jun 2019 at 16:59, Paolo Bonzini wrote: > > On 20/06/19 10:55, Xiaoyao Li wrote: > > > >> However I may be wrong because I didn't review the code very closely: > >> the old code is obvious and so there is no point in changing it. > > > > you mean this part about XSS_EXIT_BITMAP? how

Re: [PATCH] KVM: vmx: Fix the broken usage of vmx_xsaves_supported

2019-06-20 Thread Paolo Bonzini
On 20/06/19 10:55, Xiaoyao Li wrote: > >> However I may be wrong because I didn't review the code very closely: >> the old code is obvious and so there is no point in changing it. > > you mean this part about XSS_EXIT_BITMAP? how about the other part in > vmx_set/get_msr() in this patch? Yes,

Re: [PATCH] KVM: vmx: Fix the broken usage of vmx_xsaves_supported

2019-06-20 Thread Xiaoyao Li
On 6/20/2019 4:17 PM, Paolo Bonzini wrote: On 20/06/19 08:46, Xiaoyao Li wrote: It depends on whether or not processors support the 1-setting instead of “enable XSAVES/XRSTORS” is 1 in VM-exection control field. Anyway, Yes, whether this field exist or not depends on whether processors

Re: [PATCH] KVM: vmx: Fix the broken usage of vmx_xsaves_supported

2019-06-20 Thread Paolo Bonzini
On 20/06/19 10:27, Wanpeng Li wrote: > Agreed, in addition, guest can enable/disable cpuid bits by grub > parameter Through what path? Guest can disable X86_FEATURE_* but that's purely a Linux feature, the few CPUID bits that can change at runtime already call kvm_x86_ops->cpuid_update(). Paolo

Re: [PATCH] KVM: vmx: Fix the broken usage of vmx_xsaves_supported

2019-06-20 Thread Wanpeng Li
On Thu, 20 Jun 2019 at 16:17, Paolo Bonzini wrote: > > On 20/06/19 08:46, Xiaoyao Li wrote: > >> > >> It depends on whether or not processors support the 1-setting instead > >> of “enable XSAVES/XRSTORS” is 1 in VM-exection control field. Anyway, > > > > Yes, whether this field exist or not

Re: [PATCH] KVM: vmx: Fix the broken usage of vmx_xsaves_supported

2019-06-20 Thread Paolo Bonzini
On 20/06/19 08:46, Xiaoyao Li wrote: >> >> It depends on whether or not processors support the 1-setting instead >> of “enable XSAVES/XRSTORS” is 1 in VM-exection control field. Anyway, > > Yes, whether this field exist or not depends on whether processors > support the 1-setting. > > But if

Re: [PATCH] KVM: vmx: Fix the broken usage of vmx_xsaves_supported

2019-06-20 Thread Xiaoyao Li
On 6/20/2019 2:40 PM, Wanpeng Li wrote: Hi, On Thu, 20 Jun 2019 at 13:06, Tao Xu wrote: The helper vmx_xsaves_supported() returns the bit value of SECONDARY_EXEC_XSAVES in vmcs_config.cpu_based_2nd_exec_ctrl, which remains unchanged true if vmcs supports 1-setting of this bit after

Re: [PATCH] KVM: vmx: Fix the broken usage of vmx_xsaves_supported

2019-06-20 Thread Wanpeng Li
Hi, On Thu, 20 Jun 2019 at 13:06, Tao Xu wrote: > > The helper vmx_xsaves_supported() returns the bit value of > SECONDARY_EXEC_XSAVES in vmcs_config.cpu_based_2nd_exec_ctrl, which > remains unchanged true if vmcs supports 1-setting of this bit after > setup_vmcs_config(). It should check the

[PATCH] KVM: vmx: Fix the broken usage of vmx_xsaves_supported

2019-06-19 Thread Tao Xu
The helper vmx_xsaves_supported() returns the bit value of SECONDARY_EXEC_XSAVES in vmcs_config.cpu_based_2nd_exec_ctrl, which remains unchanged true if vmcs supports 1-setting of this bit after setup_vmcs_config(). It should check the guest's cpuid not this unchanged value when get/set msr.