Re: [PATCH v12 06/10] KVM: x86: Add userspace access interface for CET MSRs

kbuild test robot
2020-05-07T05:19:14Z

[-- Attachment #1: Type: text/plain, Size: 10001 bytes --]

Hi Yang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on vhost/linux-next]
[also build test ERROR on tip/auto-latest linus/master v5.7-rc4 next-20200505]
[cannot apply to kvm/linux-next linux/master]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Yang-Weijiang/Introduce-support-for-guest-CET-feature/20200507-021021
base: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next
config: x86_64-rhel (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

arch/x86/kvm/x86.c: In function 'kvm_set_cr0':
arch/x86/kvm/x86.c:808:53: error: 'X86_CR4_CET' undeclared (first use in this function); did you mean 'X86_CR0_ET'?
if (!(cr0 & X86_CR0_WP) && kvm_read_cr4_bits(vcpu, X86_CR4_CET))
^~~~~~~~~~~
X86_CR0_ET
arch/x86/kvm/x86.c:808:53: note: each undeclared identifier is reported only once for each function it appears in
arch/x86/kvm/x86.c: At top level:
arch/x86/kvm/x86.c:1232:16: error: 'MSR_IA32_U_CET' undeclared here (not in a function); did you mean 'MSR_IA32_TSC'?
MSR_IA32_XSS, MSR_IA32_U_CET, MSR_IA32_S_CET,
^~~~~~~~~~~~~~
MSR_IA32_TSC
arch/x86/kvm/x86.c:1232:32: error: 'MSR_IA32_S_CET' undeclared here (not in a function); did you mean 'MSR_IA32_U_CET'?
MSR_IA32_XSS, MSR_IA32_U_CET, MSR_IA32_S_CET,
^~~~~~~~~~~~~~
MSR_IA32_U_CET
arch/x86/kvm/x86.c:1233:2: error: 'MSR_IA32_PL0_SSP' undeclared here (not in a function); did you mean 'MSR_IA32_MCG_ESP'?
MSR_IA32_PL0_SSP, MSR_IA32_PL1_SSP, MSR_IA32_PL2_SSP,
^~~~~~~~~~~~~~~~
MSR_IA32_MCG_ESP
arch/x86/kvm/x86.c:1233:20: error: 'MSR_IA32_PL1_SSP' undeclared here (not in a function); did you mean 'MSR_IA32_PL0_SSP'?
MSR_IA32_PL0_SSP, MSR_IA32_PL1_SSP, MSR_IA32_PL2_SSP,
^~~~~~~~~~~~~~~~
MSR_IA32_PL0_SSP
arch/x86/kvm/x86.c:1233:38: error: 'MSR_IA32_PL2_SSP' undeclared here (not in a function); did you mean 'MSR_IA32_PL1_SSP'?
MSR_IA32_PL0_SSP, MSR_IA32_PL1_SSP, MSR_IA32_PL2_SSP,
^~~~~~~~~~~~~~~~
MSR_IA32_PL1_SSP
arch/x86/kvm/x86.c:1234:2: error: 'MSR_IA32_PL3_SSP' undeclared here (not in a function); did you mean 'MSR_IA32_PL2_SSP'?
MSR_IA32_PL3_SSP, MSR_IA32_INT_SSP_TAB,
^~~~~~~~~~~~~~~~
MSR_IA32_PL2_SSP
arch/x86/kvm/x86.c:1234:20: error: 'MSR_IA32_INT_SSP_TAB' undeclared here (not in a function); did you mean 'MSR_IA32_PL3_SSP'?
MSR_IA32_PL3_SSP, MSR_IA32_INT_SSP_TAB,
^~~~~~~~~~~~~~~~~~~~
MSR_IA32_PL3_SSP
arch/x86/kvm/x86.c: In function 'is_xsaves_msr':
arch/x86/kvm/x86.c:3278:15: error: comparison between pointer and integer [-Werror]
return index == MSR_IA32_U_CET ||
^~
arch/x86/kvm/x86.c:3279:16: error: comparison between pointer and integer [-Werror]
(index >= MSR_IA32_PL0_SSP && index <= MSR_IA32_PL3_SSP);
^~
arch/x86/kvm/x86.c:3279:45: error: comparison between pointer and integer [-Werror]
(index >= MSR_IA32_PL0_SSP && index <= MSR_IA32_PL3_SSP);
^~
arch/x86/kvm/x86.c: In function 'kvm_arch_hardware_setup':
arch/x86/kvm/x86.c:191:34: error: 'XFEATURE_MASK_CET_USER' undeclared (first use in this function); did you mean 'XFEATURE_MASK_BNDCSR'?
#define KVM_SUPPORTED_XSS (XFEATURE_MASK_CET_USER | \
^
arch/x86/kvm/x86.c:9707:30: note: in expansion of macro 'KVM_SUPPORTED_XSS'
supported_xss = host_xss & KVM_SUPPORTED_XSS;
^~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.c:192:6: error: 'XFEATURE_MASK_CET_KERNEL' undeclared (first use in this function); did you mean 'XFEATURE_MASK_CET_USER'?
XFEATURE_MASK_CET_KERNEL)
^
arch/x86/kvm/x86.c:9707:30: note: in expansion of macro 'KVM_SUPPORTED_XSS'
supported_xss = host_xss & KVM_SUPPORTED_XSS;
^~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.c:191:57: error: invalid operands to binary | (have 'const u32 * {aka const unsigned int *}' and 'const u32 * {aka const unsigned int *}')
#define KVM_SUPPORTED_XSS (XFEATURE_MASK_CET_USER | \
~ ^
arch/x86/kvm/x86.c:9707:30: note: in expansion of macro 'KVM_SUPPORTED_XSS'
supported_xss = host_xss & KVM_SUPPORTED_XSS;
^~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.c:9707:28: error: invalid operands to binary & (have 'u64 {aka long long unsigned int}' and 'const u32 * {aka const unsigned int *}')
supported_xss = host_xss & KVM_SUPPORTED_XSS;
^
>> arch/x86/kvm/x86.c:9707:17: error: assignment makes integer from pointer without a cast [-Werror=int-conversion]
supported_xss = host_xss & KVM_SUPPORTED_XSS;
^
cc1: all warnings being treated as errors

vim +9707 arch/x86/kvm/x86.c

e9b11c17552afe drivers/kvm/x86.c Zhang Xiantao 2007-11-14 9688
b990408537388e arch/x86/kvm/x86.c Sean Christopherson 2020-03-21 9689 int kvm_arch_hardware_setup(void *opaque)
e9b11c17552afe drivers/kvm/x86.c Zhang Xiantao 2007-11-14 9690 {
d008dfdb0e7012 arch/x86/kvm/x86.c Sean Christopherson 2020-03-21 9691 struct kvm_x86_init_ops *ops = opaque;
9e9c3fe40bcd28 arch/x86/kvm/x86.c Nadav Amit 2015-04-12 9692 int r;
9e9c3fe40bcd28 arch/x86/kvm/x86.c Nadav Amit 2015-04-12 9693
91661989d17cce arch/x86/kvm/x86.c Sean Christopherson 2020-03-02 9694 rdmsrl_safe(MSR_EFER, &host_efer);
91661989d17cce arch/x86/kvm/x86.c Sean Christopherson 2020-03-02 9695
408e9a318f57ba arch/x86/kvm/x86.c Paolo Bonzini 2020-03-05 9696 if (boot_cpu_has(X86_FEATURE_XSAVES))
408e9a318f57ba arch/x86/kvm/x86.c Paolo Bonzini 2020-03-05 9697 rdmsrl(MSR_IA32_XSS, host_xss);
408e9a318f57ba arch/x86/kvm/x86.c Paolo Bonzini 2020-03-05 9698
d008dfdb0e7012 arch/x86/kvm/x86.c Sean Christopherson 2020-03-21 9699 r = ops->hardware_setup();
9e9c3fe40bcd28 arch/x86/kvm/x86.c Nadav Amit 2015-04-12 9700 if (r != 0)
9e9c3fe40bcd28 arch/x86/kvm/x86.c Nadav Amit 2015-04-12 9701 return r;
9e9c3fe40bcd28 arch/x86/kvm/x86.c Nadav Amit 2015-04-12 9702
afaf0b2f9b801c arch/x86/kvm/x86.c Sean Christopherson 2020-03-21 9703 memcpy(&kvm_x86_ops, ops->runtime_ops, sizeof(kvm_x86_ops));
69c6f69aa3064a arch/x86/kvm/x86.c Sean Christopherson 2020-03-21 9704
408e9a318f57ba arch/x86/kvm/x86.c Paolo Bonzini 2020-03-05 9705 supported_xss = 0;
c76aeac0801da1 arch/x86/kvm/x86.c Yang Weijiang 2020-05-06 9706 if (kvm_cpu_cap_has(X86_FEATURE_XSAVES))
c76aeac0801da1 arch/x86/kvm/x86.c Yang Weijiang 2020-05-06 @9707 supported_xss = host_xss & KVM_SUPPORTED_XSS;
408e9a318f57ba arch/x86/kvm/x86.c Paolo Bonzini 2020-03-05 9708
b11306b53b2540 arch/x86/kvm/x86.c Sean Christopherson 2019-12-10 9709 cr4_reserved_bits = kvm_host_cr4_reserved_bits(&boot_cpu_data);
b11306b53b2540 arch/x86/kvm/x86.c Sean Christopherson 2019-12-10 9710
35181e86df97e4 arch/x86/kvm/x86.c Haozhong Zhang 2015-10-20 9711 if (kvm_has_tsc_control) {
35181e86df97e4 arch/x86/kvm/x86.c Haozhong Zhang 2015-10-20 9712 /*
35181e86df97e4 arch/x86/kvm/x86.c Haozhong Zhang 2015-10-20 9713 * Make sure the user can only configure tsc_khz values that
35181e86df97e4 arch/x86/kvm/x86.c Haozhong Zhang 2015-10-20 9714 * fit into a signed integer.
273ba45796c14b arch/x86/kvm/x86.c Marcelo Tosatti 2018-06-11 9715 * A min value is not calculated because it will always
35181e86df97e4 arch/x86/kvm/x86.c Haozhong Zhang 2015-10-20 9716 * be 1 on all machines.
35181e86df97e4 arch/x86/kvm/x86.c Haozhong Zhang 2015-10-20 9717 */
35181e86df97e4 arch/x86/kvm/x86.c Haozhong Zhang 2015-10-20 9718 u64 max = min(0x7fffffffULL,
35181e86df97e4 arch/x86/kvm/x86.c Haozhong Zhang 2015-10-20 9719 __scale_tsc(kvm_max_tsc_scaling_ratio, tsc_khz));
35181e86df97e4 arch/x86/kvm/x86.c Haozhong Zhang 2015-10-20 9720 kvm_max_guest_tsc_khz = max;
35181e86df97e4 arch/x86/kvm/x86.c Haozhong Zhang 2015-10-20 9721
ad721883e9c5f4 arch/x86/kvm/x86.c Haozhong Zhang 2015-10-20 9722 kvm_default_tsc_scaling_ratio = 1ULL << kvm_tsc_scaling_ratio_frac_bits;
35181e86df97e4 arch/x86/kvm/x86.c Haozhong Zhang 2015-10-20 9723 }
ad721883e9c5f4 arch/x86/kvm/x86.c Haozhong Zhang 2015-10-20 9724
9e9c3fe40bcd28 arch/x86/kvm/x86.c Nadav Amit 2015-04-12 9725 kvm_init_msr_list();
9e9c3fe40bcd28 arch/x86/kvm/x86.c Nadav Amit 2015-04-12 9726 return 0;
e9b11c17552afe drivers/kvm/x86.c Zhang Xiantao 2007-11-14 9727 }
e9b11c17552afe drivers/kvm/x86.c Zhang Xiantao 2007-11-14 9728

:::::: The code at line 9707 was first introduced by commit
:::::: c76aeac0801da1991ca230714e41d1ce71555219 KVM: x86: Refresh CPUID once guest changes XSS bits

:::::: TO: Yang Weijiang <weijiang.yang@intel.com>
:::::: CC: 0day robot <lkp@intel.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 44923 bytes --]