Re: [PATCH 5/5] hyperv: Use hvhdk.h instead of hyperv-tlfs.h in Hyper-V code

From: kernel test robot
Date: Fri Oct 04 2024 - 17:56:36 EST


Hi Nuno,

kernel test robot noticed the following build errors:

[auto build test ERROR on tip/x86/core]
[also build test ERROR on arm64/for-next/core kvm/queue linus/master v6.12-rc1 next-20241004]
[cannot apply to kvm/linux-next]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Nuno-Das-Neves/hyperv-Move-hv_connection_id-to-hyperv-tlfs-h/20241004-035418
base: tip/x86/core
patch link: https://lore.kernel.org/r/1727985064-18362-6-git-send-email-nunodasneves%40linux.microsoft.com
patch subject: [PATCH 5/5] hyperv: Use hvhdk.h instead of hyperv-tlfs.h in Hyper-V code
config: x86_64-allmodconfig (https://download.01.org/0day-ci/archive/20241005/202410050518.LFXqJEpd-lkp@xxxxxxxxx/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241005/202410050518.LFXqJEpd-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410050518.LFXqJEpd-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

>> arch/x86/hyperv/hv_init.c:428:19: error: invalid application of 'sizeof' to an incomplete type 'struct hv_get_vp_registers_input'
428 | memset(input, 0, struct_size(input, element, 1));
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:372:9: note: expanded from macro 'struct_size'
372 | sizeof(*(p)) + flex_array_size(p, member, count), \
| ^
include/linux/fortify-string.h:512:52: note: expanded from macro 'memset'
512 | #define memset(p, c, s) __fortify_memset_chk(p, c, s, \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
513 | __struct_size(p), __member_size(p))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fortify-string.h:502:35: note: expanded from macro '__fortify_memset_chk'
502 | size_t __fortify_size = (size_t)(size); \
| ^~~~
arch/x86/hyperv/hv_init.c:419:9: note: forward declaration of 'struct hv_get_vp_registers_input'
419 | struct hv_get_vp_registers_input *input;
| ^
>> arch/x86/hyperv/hv_init.c:428:19: error: incomplete definition of type 'struct hv_get_vp_registers_input'
428 | memset(input, 0, struct_size(input, element, 1));
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:372:18: note: expanded from macro 'struct_size'
372 | sizeof(*(p)) + flex_array_size(p, member, count), \
| ^
include/linux/overflow.h:356:24: note: expanded from macro 'flex_array_size'
356 | (count) * sizeof(*(p)->member) + __must_be_array((p)->member), \
| ^
include/linux/fortify-string.h:512:52: note: expanded from macro 'memset'
512 | #define memset(p, c, s) __fortify_memset_chk(p, c, s, \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
513 | __struct_size(p), __member_size(p))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fortify-string.h:502:35: note: expanded from macro '__fortify_memset_chk'
502 | size_t __fortify_size = (size_t)(size); \
| ^~~~
arch/x86/hyperv/hv_init.c:419:9: note: forward declaration of 'struct hv_get_vp_registers_input'
419 | struct hv_get_vp_registers_input *input;
| ^
>> arch/x86/hyperv/hv_init.c:428:19: error: incomplete definition of type 'struct hv_get_vp_registers_input'
428 | memset(input, 0, struct_size(input, element, 1));
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:372:18: note: expanded from macro 'struct_size'
372 | sizeof(*(p)) + flex_array_size(p, member, count), \
| ^
include/linux/overflow.h:356:55: note: expanded from macro 'flex_array_size'
356 | (count) * sizeof(*(p)->member) + __must_be_array((p)->member), \
| ^
include/linux/compiler.h:243:59: note: expanded from macro '__must_be_array'
243 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
| ^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/fortify-string.h:512:52: note: expanded from macro 'memset'
512 | #define memset(p, c, s) __fortify_memset_chk(p, c, s, \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
513 | __struct_size(p), __member_size(p))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fortify-string.h:502:35: note: expanded from macro '__fortify_memset_chk'
502 | size_t __fortify_size = (size_t)(size); \
| ^~~~
arch/x86/hyperv/hv_init.c:419:9: note: forward declaration of 'struct hv_get_vp_registers_input'
419 | struct hv_get_vp_registers_input *input;
| ^
>> arch/x86/hyperv/hv_init.c:428:19: error: incomplete definition of type 'struct hv_get_vp_registers_input'
428 | memset(input, 0, struct_size(input, element, 1));
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:372:18: note: expanded from macro 'struct_size'
372 | sizeof(*(p)) + flex_array_size(p, member, count), \
| ^
include/linux/overflow.h:357:30: note: expanded from macro 'flex_array_size'
357 | size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
| ^
include/linux/fortify-string.h:512:52: note: expanded from macro 'memset'
512 | #define memset(p, c, s) __fortify_memset_chk(p, c, s, \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
513 | __struct_size(p), __member_size(p))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fortify-string.h:502:35: note: expanded from macro '__fortify_memset_chk'
502 | size_t __fortify_size = (size_t)(size); \
| ^~~~
arch/x86/hyperv/hv_init.c:419:9: note: forward declaration of 'struct hv_get_vp_registers_input'
419 | struct hv_get_vp_registers_input *input;
| ^
>> arch/x86/hyperv/hv_init.c:428:19: error: incomplete definition of type 'struct hv_get_vp_registers_input'
428 | memset(input, 0, struct_size(input, element, 1));
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:372:18: note: expanded from macro 'struct_size'
372 | sizeof(*(p)) + flex_array_size(p, member, count), \
| ^
include/linux/overflow.h:357:61: note: expanded from macro 'flex_array_size'
357 | size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
| ^
include/linux/compiler.h:243:59: note: expanded from macro '__must_be_array'
243 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
| ^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/fortify-string.h:512:52: note: expanded from macro 'memset'
512 | #define memset(p, c, s) __fortify_memset_chk(p, c, s, \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
513 | __struct_size(p), __member_size(p))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fortify-string.h:502:35: note: expanded from macro '__fortify_memset_chk'
502 | size_t __fortify_size = (size_t)(size); \
| ^~~~
arch/x86/hyperv/hv_init.c:419:9: note: forward declaration of 'struct hv_get_vp_registers_input'
419 | struct hv_get_vp_registers_input *input;
| ^
arch/x86/hyperv/hv_init.c:429:7: error: incomplete definition of type 'struct hv_get_vp_registers_input'
429 | input->header.partitionid = HV_PARTITION_ID_SELF;
| ~~~~~^
arch/x86/hyperv/hv_init.c:419:9: note: forward declaration of 'struct hv_get_vp_registers_input'
419 | struct hv_get_vp_registers_input *input;
| ^
arch/x86/hyperv/hv_init.c:430:7: error: incomplete definition of type 'struct hv_get_vp_registers_input'
430 | input->header.vpindex = HV_VP_INDEX_SELF;
| ~~~~~^
arch/x86/hyperv/hv_init.c:419:9: note: forward declaration of 'struct hv_get_vp_registers_input'
419 | struct hv_get_vp_registers_input *input;
| ^
arch/x86/hyperv/hv_init.c:431:7: error: incomplete definition of type 'struct hv_get_vp_registers_input'
431 | input->header.inputvtl = 0;
| ~~~~~^
arch/x86/hyperv/hv_init.c:419:9: note: forward declaration of 'struct hv_get_vp_registers_input'
419 | struct hv_get_vp_registers_input *input;
| ^
arch/x86/hyperv/hv_init.c:432:7: error: incomplete definition of type 'struct hv_get_vp_registers_input'
432 | input->element[0].name0 = HV_X64_REGISTER_VSM_VP_STATUS;
| ~~~~~^
arch/x86/hyperv/hv_init.c:419:9: note: forward declaration of 'struct hv_get_vp_registers_input'
419 | struct hv_get_vp_registers_input *input;
| ^
>> arch/x86/hyperv/hv_init.c:436:15: error: incomplete definition of type 'struct hv_get_vp_registers_output'
436 | ret = output->as64.low & HV_X64_VTL_MASK;
| ~~~~~~^
arch/x86/hyperv/hv_init.c:420:9: note: forward declaration of 'struct hv_get_vp_registers_output'
420 | struct hv_get_vp_registers_output *output;
| ^
10 errors generated.
--
>> arch/x86/hyperv/hv_vtl.c:154:27: error: use of undeclared identifier 'HVCALL_ENABLE_VP_VTL'
154 | status = hv_do_hypercall(HVCALL_ENABLE_VP_VTL, input, NULL);
| ^
>> arch/x86/hyperv/hv_vtl.c:189:25: error: invalid application of 'sizeof' to an incomplete type 'struct hv_get_vp_from_apic_id_in'
189 | memset(input, 0, sizeof(*input));
| ^~~~~~~~
include/linux/fortify-string.h:512:52: note: expanded from macro 'memset'
512 | #define memset(p, c, s) __fortify_memset_chk(p, c, s, \
| ^
include/linux/fortify-string.h:502:35: note: expanded from macro '__fortify_memset_chk'
502 | size_t __fortify_size = (size_t)(size); \
| ^~~~
arch/x86/hyperv/hv_vtl.c:183:9: note: forward declaration of 'struct hv_get_vp_from_apic_id_in'
183 | struct hv_get_vp_from_apic_id_in *input;
| ^
>> arch/x86/hyperv/hv_vtl.c:190:7: error: incomplete definition of type 'struct hv_get_vp_from_apic_id_in'
190 | input->partition_id = HV_PARTITION_ID_SELF;
| ~~~~~^
arch/x86/hyperv/hv_vtl.c:183:9: note: forward declaration of 'struct hv_get_vp_from_apic_id_in'
183 | struct hv_get_vp_from_apic_id_in *input;
| ^
arch/x86/hyperv/hv_vtl.c:191:7: error: incomplete definition of type 'struct hv_get_vp_from_apic_id_in'
191 | input->apic_ids[0] = apic_id;
| ~~~~~^
arch/x86/hyperv/hv_vtl.c:183:9: note: forward declaration of 'struct hv_get_vp_from_apic_id_in'
183 | struct hv_get_vp_from_apic_id_in *input;
| ^
>> arch/x86/hyperv/hv_vtl.c:195:38: error: use of undeclared identifier 'HVCALL_GET_VP_ID_FROM_APIC_ID'
195 | control = HV_HYPERCALL_REP_COMP_1 | HVCALL_GET_VP_ID_FROM_APIC_ID;
| ^
5 errors generated.


vim +428 arch/x86/hyperv/hv_init.c

99a0f46af6a771 Wei Liu 2021-02-03 414
f2a55d08d7e1a5 Saurabh Sengar 2023-09-19 415 #if IS_ENABLED(CONFIG_HYPERV_VTL_MODE)
8387ce06d70bbb Tianyu Lan 2023-08-18 416 static u8 __init get_vtl(void)
8387ce06d70bbb Tianyu Lan 2023-08-18 417 {
8387ce06d70bbb Tianyu Lan 2023-08-18 418 u64 control = HV_HYPERCALL_REP_COMP_1 | HVCALL_GET_VP_REGISTERS;
8387ce06d70bbb Tianyu Lan 2023-08-18 @419 struct hv_get_vp_registers_input *input;
8387ce06d70bbb Tianyu Lan 2023-08-18 420 struct hv_get_vp_registers_output *output;
8387ce06d70bbb Tianyu Lan 2023-08-18 421 unsigned long flags;
8387ce06d70bbb Tianyu Lan 2023-08-18 422 u64 ret;
8387ce06d70bbb Tianyu Lan 2023-08-18 423
8387ce06d70bbb Tianyu Lan 2023-08-18 424 local_irq_save(flags);
8387ce06d70bbb Tianyu Lan 2023-08-18 425 input = *this_cpu_ptr(hyperv_pcpu_input_arg);
8387ce06d70bbb Tianyu Lan 2023-08-18 426 output = (struct hv_get_vp_registers_output *)input;
8387ce06d70bbb Tianyu Lan 2023-08-18 427
8387ce06d70bbb Tianyu Lan 2023-08-18 @428 memset(input, 0, struct_size(input, element, 1));
8387ce06d70bbb Tianyu Lan 2023-08-18 429 input->header.partitionid = HV_PARTITION_ID_SELF;
8387ce06d70bbb Tianyu Lan 2023-08-18 430 input->header.vpindex = HV_VP_INDEX_SELF;
8387ce06d70bbb Tianyu Lan 2023-08-18 431 input->header.inputvtl = 0;
8387ce06d70bbb Tianyu Lan 2023-08-18 432 input->element[0].name0 = HV_X64_REGISTER_VSM_VP_STATUS;
8387ce06d70bbb Tianyu Lan 2023-08-18 433
8387ce06d70bbb Tianyu Lan 2023-08-18 434 ret = hv_do_hypercall(control, input, output);
8387ce06d70bbb Tianyu Lan 2023-08-18 435 if (hv_result_success(ret)) {
8387ce06d70bbb Tianyu Lan 2023-08-18 @436 ret = output->as64.low & HV_X64_VTL_MASK;
8387ce06d70bbb Tianyu Lan 2023-08-18 437 } else {
f2a55d08d7e1a5 Saurabh Sengar 2023-09-19 438 pr_err("Failed to get VTL(error: %lld) exiting...\n", ret);
f2a55d08d7e1a5 Saurabh Sengar 2023-09-19 439 BUG();
8387ce06d70bbb Tianyu Lan 2023-08-18 440 }
8387ce06d70bbb Tianyu Lan 2023-08-18 441
8387ce06d70bbb Tianyu Lan 2023-08-18 442 local_irq_restore(flags);
8387ce06d70bbb Tianyu Lan 2023-08-18 443 return ret;
8387ce06d70bbb Tianyu Lan 2023-08-18 444 }
f2a55d08d7e1a5 Saurabh Sengar 2023-09-19 445 #else
f2a55d08d7e1a5 Saurabh Sengar 2023-09-19 446 static inline u8 get_vtl(void) { return 0; }
f2a55d08d7e1a5 Saurabh Sengar 2023-09-19 447 #endif
8387ce06d70bbb Tianyu Lan 2023-08-18 448

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki