Re: [PATCH v14 10/13] KVM: x86: Enable CET virtualization for VMX and advertise CET to userspace

From: kernel test robot
Date: Mon Nov 09 2020 - 02:24:44 EST


Hi Yang,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tip/master]
[also build test WARNING on linus/master v5.10-rc3 next-20201106]
[cannot apply to vhost/linux-next kvm/linux-next linux/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Yang-Weijiang/Introduce-support-for-guest-CET-feature/20201106-090915
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 6f72faf4a32303c8bdc6491186b79391e9cf0c7e
config: i386-randconfig-r022-20201109 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/34e06718bac59b9ecb835d2c4a04ae9378067819
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Yang-Weijiang/Introduce-support-for-guest-CET-feature/20201106-090915
git checkout 34e06718bac59b9ecb835d2c4a04ae9378067819
# save the attached .config to linux build tree
make W=1 ARCH=i386

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

In file included from arch/x86/kvm/cpuid.h:5,
from arch/x86/kvm/mmu.h:7,
from arch/x86/kvm/x86.c:22:
arch/x86/kvm/x86.h: In function 'kvm_cet_supported':
arch/x86/kvm/x86.h:291:25: error: 'XFEATURE_MASK_CET_USER' undeclared (first use in this function); did you mean 'XFEATURE_MASK_SSE'?
291 | return supported_xss & XFEATURE_MASK_CET_USER;
| ^~~~~~~~~~~~~~~~~~~~~~
| XFEATURE_MASK_SSE
arch/x86/kvm/x86.h:291:25: note: each undeclared identifier is reported only once for each function it appears in
In file included from include/linux/kvm_host.h:36,
from arch/x86/kvm/x86.c:19:
arch/x86/kvm/x86.c: At top level:
arch/x86/include/asm/kvm_host.h:104:8: error: 'X86_CR4_CET' undeclared here (not in a function); did you mean 'X86_CR4_DE'?
104 | | X86_CR4_CET))
| ^~~~~~~~~~~
arch/x86/kvm/x86.c:101:46: note: in expansion of macro 'CR4_RESERVED_BITS'
101 | static u64 __read_mostly cr4_reserved_bits = CR4_RESERVED_BITS;
| ^~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.c:1251:2: error: 'MSR_IA32_U_CET' undeclared here (not in a function); did you mean 'MSR_IA32_PMC0'?
1251 | MSR_IA32_U_CET, MSR_IA32_S_CET, MSR_IA32_INT_SSP_TAB, MSR_KVM_GUEST_SSP,
| ^~~~~~~~~~~~~~
| MSR_IA32_PMC0
arch/x86/kvm/x86.c:1251:18: error: 'MSR_IA32_S_CET' undeclared here (not in a function); did you mean 'MSR_IA32_PMC0'?
1251 | MSR_IA32_U_CET, MSR_IA32_S_CET, MSR_IA32_INT_SSP_TAB, MSR_KVM_GUEST_SSP,
| ^~~~~~~~~~~~~~
| MSR_IA32_PMC0
arch/x86/kvm/x86.c:1251:34: error: 'MSR_IA32_INT_SSP_TAB' undeclared here (not in a function)
1251 | MSR_IA32_U_CET, MSR_IA32_S_CET, MSR_IA32_INT_SSP_TAB, MSR_KVM_GUEST_SSP,
| ^~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.c:1252:2: error: 'MSR_IA32_PL0_SSP' undeclared here (not in a function); did you mean 'MSR_IA32_MCG_ESP'?
1252 | MSR_IA32_PL0_SSP, MSR_IA32_PL1_SSP, MSR_IA32_PL2_SSP, MSR_IA32_PL3_SSP,
| ^~~~~~~~~~~~~~~~
| MSR_IA32_MCG_ESP
arch/x86/kvm/x86.c:1252:20: error: 'MSR_IA32_PL1_SSP' undeclared here (not in a function); did you mean 'MSR_IA32_MCG_ESP'?
1252 | MSR_IA32_PL0_SSP, MSR_IA32_PL1_SSP, MSR_IA32_PL2_SSP, MSR_IA32_PL3_SSP,
| ^~~~~~~~~~~~~~~~
| MSR_IA32_MCG_ESP
arch/x86/kvm/x86.c:1252:38: error: 'MSR_IA32_PL2_SSP' undeclared here (not in a function); did you mean 'MSR_IA32_MCG_ESP'?
1252 | MSR_IA32_PL0_SSP, MSR_IA32_PL1_SSP, MSR_IA32_PL2_SSP, MSR_IA32_PL3_SSP,
| ^~~~~~~~~~~~~~~~
| MSR_IA32_MCG_ESP
arch/x86/kvm/x86.c:1252:56: error: 'MSR_IA32_PL3_SSP' undeclared here (not in a function); did you mean 'MSR_IA32_MCG_ESP'?
1252 | MSR_IA32_PL0_SSP, MSR_IA32_PL1_SSP, MSR_IA32_PL2_SSP, MSR_IA32_PL3_SSP,
| ^~~~~~~~~~~~~~~~
| MSR_IA32_MCG_ESP
arch/x86/kvm/x86.c: In function 'is_xsaves_msr':
arch/x86/kvm/x86.c:3591:15: warning: comparison between pointer and integer
3591 | return index == MSR_IA32_U_CET ||
| ^~
arch/x86/kvm/x86.c:3592:16: warning: comparison between pointer and integer
3592 | (index >= MSR_IA32_PL0_SSP && index <= MSR_IA32_PL3_SSP);
| ^~
arch/x86/kvm/x86.c:3592:45: warning: comparison between pointer and integer
3592 | (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:10205:21: error: 'X86_FEATURE_SHSTK' undeclared (first use in this function); did you mean 'X86_FEATURE_EST'?
10205 | kvm_cpu_cap_clear(X86_FEATURE_SHSTK);
| ^~~~~~~~~~~~~~~~~
| X86_FEATURE_EST
>> arch/x86/kvm/x86.c:10205:21: warning: passing argument 1 of 'kvm_cpu_cap_clear' makes integer from pointer without a cast [-Wint-conversion]
In file included from arch/x86/kvm/mmu.h:7,
from arch/x86/kvm/x86.c:22:
arch/x86/kvm/cpuid.h:277:60: note: expected 'unsigned int' but argument is of type 'const u32 *' {aka 'const unsigned int *'}
277 | static __always_inline void kvm_cpu_cap_clear(unsigned int x86_feature)
| ~~~~~~~~~~~~~^~~~~~~~~~~
arch/x86/kvm/x86.c:10206:21: error: 'X86_FEATURE_IBT' undeclared (first use in this function); did you mean 'X86_FEATURE_IBS'?
10206 | kvm_cpu_cap_clear(X86_FEATURE_IBT);
| ^~~~~~~~~~~~~~~
| X86_FEATURE_IBS
arch/x86/kvm/x86.c:10206:21: warning: passing argument 1 of 'kvm_cpu_cap_clear' makes integer from pointer without a cast [-Wint-conversion]
In file included from arch/x86/kvm/mmu.h:7,
from arch/x86/kvm/x86.c:22:
arch/x86/kvm/cpuid.h:277:60: note: expected 'unsigned int' but argument is of type 'const u32 *' {aka 'const unsigned int *'}
277 | static __always_inline void kvm_cpu_cap_clear(unsigned int x86_feature)
| ~~~~~~~~~~~~~^~~~~~~~~~~
In file included from include/linux/kvm_host.h:36,
from arch/x86/kvm/x86.c:19:
arch/x86/include/asm/kvm_host.h:104:6: error: invalid operands to binary | (have 'long unsigned int' and 'const u32 *' {aka 'const unsigned int *'})
104 | | X86_CR4_CET))
| ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/kvm/x86.h:388:24: note: in expansion of macro 'CR4_RESERVED_BITS'
388 | u64 __reserved_bits = CR4_RESERVED_BITS; \
| ^~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.c:10210:22: note: in expansion of macro '__cr4_reserved_bits'
10210 | cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_);
| ^~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:22: warning: passing argument 1 of 'kvm_cpu_cap_has' makes integer from pointer without a cast [-Wint-conversion]
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~~~~~~~~~
| |
| const u32 * {aka const unsigned int *}
arch/x86/kvm/x86.c:10209:55: note: in definition of macro '__kvm_cpu_cap_has'
10209 | #define __kvm_cpu_cap_has(UNUSED_, f) kvm_cpu_cap_has(f)
| ^
arch/x86/kvm/x86.c:10210:22: note: in expansion of macro '__cr4_reserved_bits'
10210 | cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_);
| ^~~~~~~~~~~~~~~~~~~
In file included from arch/x86/kvm/mmu.h:7,
from arch/x86/kvm/x86.c:22:
arch/x86/kvm/cpuid.h:301:58: note: expected 'unsigned int' but argument is of type 'const u32 *' {aka 'const unsigned int *'}
301 | static __always_inline bool kvm_cpu_cap_has(unsigned int x86_feature)
| ~~~~~~~~~~~~~^~~~~~~~~~~
arch/x86/kvm/x86.h:407:22: warning: passing argument 1 of 'kvm_cpu_cap_has' makes integer from pointer without a cast [-Wint-conversion]
407 | !__cpu_has(__c, X86_FEATURE_IBT)) \
| ^~~~~~~~~~~~~~~
| |
| const u32 * {aka const unsigned int *}
arch/x86/kvm/x86.c:10209:55: note: in definition of macro '__kvm_cpu_cap_has'
10209 | #define __kvm_cpu_cap_has(UNUSED_, f) kvm_cpu_cap_has(f)
| ^
arch/x86/kvm/x86.c:10210:22: note: in expansion of macro '__cr4_reserved_bits'
10210 | cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_);
| ^~~~~~~~~~~~~~~~~~~
In file included from arch/x86/kvm/mmu.h:7,
from arch/x86/kvm/x86.c:22:
arch/x86/kvm/cpuid.h:301:58: note: expected 'unsigned int' but argument is of type 'const u32 *' {aka 'const unsigned int *'}
301 | static __always_inline bool kvm_cpu_cap_has(unsigned int x86_feature)
| ~~~~~~~~~~~~~^~~~~~~~~~~
In file included from arch/x86/kvm/cpuid.h:5,
from arch/x86/kvm/mmu.h:7,
from arch/x86/kvm/x86.c:22:
arch/x86/kvm/x86.h:408:19: error: invalid operands to binary | (have 'u64' {aka 'long long unsigned int'} and 'const u32 *' {aka 'const unsigned int *'})
408 | __reserved_bits |= X86_CR4_CET; \
| ^~ ~~~~~~~~~~~
| |
| const u32 * {aka const unsigned int *}
arch/x86/kvm/x86.c:10210:22: note: in expansion of macro '__cr4_reserved_bits'
10210 | cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_);
| ^~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:408:3: warning: statement with no effect [-Wunused-value]
408 | __reserved_bits |= X86_CR4_CET; \
| ^~~~~~~~~~~~~~~
arch/x86/kvm/x86.c:10210:22: note: in expansion of macro '__cr4_reserved_bits'
10210 | cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_);
| ^~~~~~~~~~~~~~~~~~~
In file included from include/linux/kvm_host.h:36,
from arch/x86/kvm/x86.c:19:
arch/x86/kvm/x86.c: In function 'kvm_arch_check_processor_compat':
arch/x86/include/asm/kvm_host.h:104:6: error: invalid operands to binary | (have 'long unsigned int' and 'const u32 *' {aka 'const unsigned int *'})
104 | | X86_CR4_CET))
| ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/kvm/x86.h:388:24: note: in expansion of macro 'CR4_RESERVED_BITS'
388 | u64 __reserved_bits = CR4_RESERVED_BITS; \
| ^~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.c:10243:6: note: in expansion of macro '__cr4_reserved_bits'
10243 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
In file included 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:78,
from include/linux/percpu.h:6,
from include/linux/context_tracking_state.h:5,
from include/linux/hardirq.h:5,
from include/linux/kvm_host.h:7,
from arch/x86/kvm/x86.c:19:

vim +/kvm_cpu_cap_clear +10205 arch/x86/kvm/x86.c

10181
10182 int kvm_arch_hardware_setup(void *opaque)
10183 {
10184 struct kvm_x86_init_ops *ops = opaque;
10185 int r;
10186
10187 rdmsrl_safe(MSR_EFER, &host_efer);
10188
10189 if (boot_cpu_has(X86_FEATURE_XSAVES))
10190 rdmsrl(MSR_IA32_XSS, host_xss);
10191
10192 r = ops->hardware_setup();
10193 if (r != 0)
10194 return r;
10195
10196 memcpy(&kvm_x86_ops, ops->runtime_ops, sizeof(kvm_x86_ops));
10197
10198 if (!kvm_cpu_cap_has(X86_FEATURE_XSAVES))
10199 supported_xss = 0;
10200 else
10201 supported_xss &= host_xss;
10202
10203 /* Update CET features now that supported_xss is finalized. */
10204 if (!kvm_cet_supported()) {
10205 kvm_cpu_cap_clear(X86_FEATURE_SHSTK);
10206 kvm_cpu_cap_clear(X86_FEATURE_IBT);
10207 }
10208

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

Attachment: .config.gz
Description: application/gzip