Hi Jingqi, Thank you for the patch! Yet something to improve: [auto build test ERROR on kvm/linux-next] [also build test ERROR on v4.18-rc3 next-20180704] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Jingqi-Liu/KVM-Expose-the-split-lock-detection-feature-to-guest-VM/20180705-041612 base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git linux-next config: i386-allmodconfig (attached as .config) compiler: gcc-7 (Debian 7.3.0-16) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=i386 All error/warnings (new ones prefixed by >>): arch/x86/kvm/vmx.c: In function 'vmx_get_msr': >> arch/x86/kvm/vmx.c:3757:7: error: 'MSR_TEST_CTL' undeclared (first use in this function); did you mean 'MSR_THERM2_CTL'? case MSR_TEST_CTL: ^~~~~~~~~~~~ MSR_THERM2_CTL arch/x86/kvm/vmx.c:3757:7: note: each undeclared identifier is reported only once for each function it appears in arch/x86/kvm/vmx.c: In function 'vmx_set_msr': arch/x86/kvm/vmx.c:3881:7: error: 'MSR_TEST_CTL' undeclared (first use in this function); did you mean 'MSR_THERM2_CTL'? case MSR_TEST_CTL: ^~~~~~~~~~~~ MSR_THERM2_CTL In file included from arch/x86/include/asm/thread_info.h:53:0, from include/linux/thread_info.h:38, from arch/x86/include/asm/preempt.h:7, from include/linux/preempt.h:81, from include/linux/spinlock.h:51, from include/linux/mm_types.h:9, from arch/x86/kvm/irq.h:25, from arch/x86/kvm/vmx.c:19: arch/x86/kvm/vmx.c: In function 'x86_split_lock_ctrl_init': >> arch/x86/kvm/vmx.c:9982:19: error: 'X86_FEATURE_AC_SPLIT_LOCK' undeclared (first use in this function); did you mean 'X86_FEATURE_CAT_L2'? if (boot_cpu_has(X86_FEATURE_AC_SPLIT_LOCK)) { ^ arch/x86/include/asm/cpufeature.h:111:24: note: in definition of macro 'cpu_has' (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \ ^~~ >> arch/x86/kvm/vmx.c:9982:6: note: in expansion of macro 'boot_cpu_has' if (boot_cpu_has(X86_FEATURE_AC_SPLIT_LOCK)) { ^~~~~~~~~~~~ In file included from arch/x86/include/asm/msr.h:246:0, from arch/x86/include/asm/processor.h:21, from arch/x86/include/asm/cpufeature.h:5, from arch/x86/include/asm/thread_info.h:53, from include/linux/thread_info.h:38, from arch/x86/include/asm/preempt.h:7, from include/linux/preempt.h:81, from include/linux/spinlock.h:51, from include/linux/mm_types.h:9, from arch/x86/kvm/irq.h:25, from arch/x86/kvm/vmx.c:19: arch/x86/kvm/vmx.c:9983:10: error: 'MSR_TEST_CTL' undeclared (first use in this function); did you mean 'MSR_THERM2_CTL'? rdmsrl(MSR_TEST_CTL, x86_split_lock_ctrl_base); ^ arch/x86/include/asm/paravirt.h:145:26: note: in definition of macro 'rdmsrl' val = paravirt_read_msr(msr); \ ^~~ >> arch/x86/kvm/vmx.c:9984:30: error: 'MSR_TEST_CTL_ENABLE_AC_SPLIT_LOCK' undeclared (first use in this function); did you mean 'X86_FEATURE_AC_SPLIT_LOCK'? x86_split_lock_ctrl_mask = MSR_TEST_CTL_ENABLE_AC_SPLIT_LOCK; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ X86_FEATURE_AC_SPLIT_LOCK In file included from arch/x86/include/asm/thread_info.h:53:0, from include/linux/thread_info.h:38, from arch/x86/include/asm/preempt.h:7, from include/linux/preempt.h:81, from include/linux/spinlock.h:51, from include/linux/mm_types.h:9, from arch/x86/kvm/irq.h:25, from arch/x86/kvm/vmx.c:19: arch/x86/kvm/vmx.c: In function 'x86_set_split_lock_ctrl': arch/x86/kvm/vmx.c:9995:19: error: 'X86_FEATURE_AC_SPLIT_LOCK' undeclared (first use in this function); did you mean 'X86_FEATURE_CAT_L2'? if (boot_cpu_has(X86_FEATURE_AC_SPLIT_LOCK)) { ^ arch/x86/include/asm/cpufeature.h:111:24: note: in definition of macro 'cpu_has' (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \ ^~~ arch/x86/kvm/vmx.c:9995:6: note: in expansion of macro 'boot_cpu_has' if (boot_cpu_has(X86_FEATURE_AC_SPLIT_LOCK)) { ^~~~~~~~~~~~ arch/x86/kvm/vmx.c:10003:11: error: 'MSR_TEST_CTL' undeclared (first use in this function); did you mean 'MSR_THERM2_CTL'? wrmsrl(MSR_TEST_CTL, msrval); ^~~~~~~~~~~~ MSR_THERM2_CTL arch/x86/kvm/vmx.c: In function 'vmx_vcpu_run': arch/x86/kvm/vmx.c:10230:35: error: 'MSR_TEST_CTL' undeclared (first use in this function); did you mean 'MSR_THERM2_CTL'? !msr_write_intercepted(vcpu, MSR_TEST_CTL)) { ^~~~~~~~~~~~ MSR_THERM2_CTL vim +3757 arch/x86/kvm/vmx.c 3731 3732 /* 3733 * Reads an msr value (of 'msr_index') into 'pdata'. 3734 * Returns 0 on success, non-0 otherwise. 3735 * Assumes vcpu_load() was already called. 3736 */ 3737 static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) 3738 { 3739 struct vcpu_vmx *vmx = to_vmx(vcpu); 3740 struct shared_msr_entry *msr; 3741 3742 switch (msr_info->index) { 3743 #ifdef CONFIG_X86_64 3744 case MSR_FS_BASE: 3745 msr_info->data = vmcs_readl(GUEST_FS_BASE); 3746 break; 3747 case MSR_GS_BASE: 3748 msr_info->data = vmcs_readl(GUEST_GS_BASE); 3749 break; 3750 case MSR_KERNEL_GS_BASE: 3751 vmx_load_host_state(vmx); 3752 msr_info->data = vmx->msr_guest_kernel_gs_base; 3753 break; 3754 #endif 3755 case MSR_EFER: 3756 return kvm_get_msr_common(vcpu, msr_info); > 3757 case MSR_TEST_CTL: 3758 if (!msr_info->host_initiated && 3759 !kvm_split_lock_ac_in_guest(vcpu->kvm)) 3760 return 1; 3761 msr_info->data = to_vmx(vcpu)->split_lock_ctrl; 3762 break; 3763 case MSR_IA32_SPEC_CTRL: 3764 if (!msr_info->host_initiated && 3765 !guest_cpuid_has(vcpu, X86_FEATURE_SPEC_CTRL)) 3766 return 1; 3767 3768 msr_info->data = to_vmx(vcpu)->spec_ctrl; 3769 break; 3770 case MSR_IA32_ARCH_CAPABILITIES: 3771 if (!msr_info->host_initiated && 3772 !guest_cpuid_has(vcpu, X86_FEATURE_ARCH_CAPABILITIES)) 3773 return 1; 3774 msr_info->data = to_vmx(vcpu)->arch_capabilities; 3775 break; 3776 case MSR_IA32_SYSENTER_CS: 3777 msr_info->data = vmcs_read32(GUEST_SYSENTER_CS); 3778 break; 3779 case MSR_IA32_SYSENTER_EIP: 3780 msr_info->data = vmcs_readl(GUEST_SYSENTER_EIP); 3781 break; 3782 case MSR_IA32_SYSENTER_ESP: 3783 msr_info->data = vmcs_readl(GUEST_SYSENTER_ESP); 3784 break; 3785 case MSR_IA32_BNDCFGS: 3786 if (!kvm_mpx_supported() || 3787 (!msr_info->host_initiated && 3788 !guest_cpuid_has(vcpu, X86_FEATURE_MPX))) 3789 return 1; 3790 msr_info->data = vmcs_read64(GUEST_BNDCFGS); 3791 break; 3792 case MSR_IA32_MCG_EXT_CTL: 3793 if (!msr_info->host_initiated && 3794 !(vmx->msr_ia32_feature_control & 3795 FEATURE_CONTROL_LMCE)) 3796 return 1; 3797 msr_info->data = vcpu->arch.mcg_ext_ctl; 3798 break; 3799 case MSR_IA32_FEATURE_CONTROL: 3800 msr_info->data = vmx->msr_ia32_feature_control; 3801 break; 3802 case MSR_IA32_VMX_BASIC ... MSR_IA32_VMX_VMFUNC: 3803 if (!nested_vmx_allowed(vcpu)) 3804 return 1; 3805 return vmx_get_vmx_msr(&vmx->nested.msrs, msr_info->index, 3806 &msr_info->data); 3807 case MSR_IA32_XSS: 3808 if (!vmx_xsaves_supported()) 3809 return 1; 3810 msr_info->data = vcpu->arch.ia32_xss; 3811 break; 3812 case MSR_TSC_AUX: 3813 if (!msr_info->host_initiated && 3814 !guest_cpuid_has(vcpu, X86_FEATURE_RDTSCP)) 3815 return 1; 3816 /* Otherwise falls through */ 3817 default: 3818 msr = find_msr_entry(vmx, msr_info->index); 3819 if (msr) { 3820 msr_info->data = msr->data; 3821 break; 3822 } 3823 return kvm_get_msr_common(vcpu, msr_info); 3824 } 3825 3826 return 0; 3827 } 3828 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation