llvm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls
       [not found] <20251114095853.3482596-1-anirudh@anirudhrb.com>
@ 2025-11-16  8:17 ` kernel test robot
  2025-11-17 17:34   ` Wei Liu
  0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2025-11-16  8:17 UTC (permalink / raw)
  To: Anirudh Rayabharam, K. Y. Srinivasan, Haiyang Zhang, Wei Liu,
	Dexuan Cui, Long Li
  Cc: llvm, oe-kbuild-all, anirudh, linux-hyperv, linux-kernel

Hi Anirudh,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.18-rc5]
[cannot apply to next-20251114]
[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/Anirudh-Rayabharam/Drivers-hv-ioctl-for-self-targeted-passthrough-hvcalls/20251114-182039
base:   linus/master
patch link:    https://lore.kernel.org/r/20251114095853.3482596-1-anirudh%40anirudhrb.com
patch subject: [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls
config: x86_64-buildonly-randconfig-005-20251116 (https://download.01.org/0day-ci/archive/20251116/202511161617.KcDzR4sA-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251116/202511161617.KcDzR4sA-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511161617.KcDzR4sA-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/hv/mshv_root_main.c:125:2: error: use of undeclared identifier 'HVCALL_GET_PARTITION_PROPERTY_EX'
     125 |         HVCALL_GET_PARTITION_PROPERTY_EX,
         |         ^
>> drivers/hv/mshv_root_main.c:175:18: error: invalid application of 'sizeof' to an incomplete type 'u16[]' (aka 'unsigned short[]')
     175 |         for (i = 0; i < ARRAY_SIZE(mshv_passthru_hvcalls); ++i)
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:32: note: expanded from macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                ^~~~~
   drivers/hv/mshv_root_main.c:179:11: error: invalid application of 'sizeof' to an incomplete type 'u16[]' (aka 'unsigned short[]')
     179 |         if (i >= ARRAY_SIZE(mshv_passthru_hvcalls))
         |         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:32: note: expanded from macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                ^
   include/linux/compiler.h:55:47: note: expanded from macro 'if'
      55 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                            ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:57:52: note: expanded from macro '__trace_if_var'
      57 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                    ^~~~
   drivers/hv/mshv_root_main.c:179:11: error: invalid application of 'sizeof' to an incomplete type 'u16[]' (aka 'unsigned short[]')
     179 |         if (i >= ARRAY_SIZE(mshv_passthru_hvcalls))
         |         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:32: note: expanded from macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                ^
   include/linux/compiler.h:55:47: note: expanded from macro 'if'
      55 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                            ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:57:61: note: expanded from macro '__trace_if_var'
      57 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                             ^~~~
   drivers/hv/mshv_root_main.c:179:11: error: invalid application of 'sizeof' to an incomplete type 'u16[]' (aka 'unsigned short[]')
     179 |         if (i >= ARRAY_SIZE(mshv_passthru_hvcalls))
         |         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:32: note: expanded from macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                ^
   include/linux/compiler.h:55:47: note: expanded from macro 'if'
      55 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                            ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:57:86: note: expanded from macro '__trace_if_var'
      57 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                                     ~~~~~~~~~~~~~~~~~^~~~~
   include/linux/compiler.h:68:3: note: expanded from macro '__trace_if_value'
      68 |         (cond) ?                                        \
         |          ^~~~
   5 errors generated.


vim +/HVCALL_GET_PARTITION_PROPERTY_EX +125 drivers/hv/mshv_root_main.c

   117	
   118	/*
   119	 * Only allow hypercalls that have a u64 partition id as the first member of
   120	 * the input structure.
   121	 * These are sorted by value.
   122	 */
   123	static u16 mshv_passthru_hvcalls[] = {
   124		HVCALL_GET_PARTITION_PROPERTY,
 > 125		HVCALL_GET_PARTITION_PROPERTY_EX,
   126		HVCALL_SET_PARTITION_PROPERTY,
   127		HVCALL_INSTALL_INTERCEPT,
   128		HVCALL_GET_VP_REGISTERS,
   129		HVCALL_SET_VP_REGISTERS,
   130		HVCALL_TRANSLATE_VIRTUAL_ADDRESS,
   131		HVCALL_CLEAR_VIRTUAL_INTERRUPT,
   132		HVCALL_REGISTER_INTERCEPT_RESULT,
   133		HVCALL_ASSERT_VIRTUAL_INTERRUPT,
   134		HVCALL_GET_GPA_PAGES_ACCESS_STATES,
   135		HVCALL_SIGNAL_EVENT_DIRECT,
   136		HVCALL_POST_MESSAGE_DIRECT,
   137		HVCALL_GET_VP_CPUID_VALUES,
   138	};
   139	
   140	static bool mshv_hvcall_is_async(u16 code)
   141	{
   142		switch (code) {
   143		case HVCALL_SET_PARTITION_PROPERTY:
   144			return true;
   145		default:
   146			break;
   147		}
   148		return false;
   149	}
   150	
   151	static int mshv_ioctl_passthru_hvcall(struct mshv_partition *partition,
   152					      bool partition_locked,
   153					      void __user *user_args)
   154	{
   155		u64 status;
   156		int ret = 0, i;
   157		bool is_async;
   158		struct mshv_root_hvcall args;
   159		struct page *page;
   160		unsigned int pages_order;
   161		void *input_pg = NULL;
   162		void *output_pg = NULL;
   163		u64 pt_id = partition ? partition->pt_id : HV_PARTITION_ID_SELF;
   164	
   165		if (copy_from_user(&args, user_args, sizeof(args)))
   166			return -EFAULT;
   167	
   168		if (args.status || !args.in_ptr || args.in_sz < sizeof(u64) ||
   169		    mshv_field_nonzero(args, rsvd) || args.in_sz > HV_HYP_PAGE_SIZE)
   170			return -EINVAL;
   171	
   172		if (args.out_ptr && (!args.out_sz || args.out_sz > HV_HYP_PAGE_SIZE))
   173			return -EINVAL;
   174	
 > 175		for (i = 0; i < ARRAY_SIZE(mshv_passthru_hvcalls); ++i)
   176			if (args.code == mshv_passthru_hvcalls[i])
   177				break;
   178	
   179		if (i >= ARRAY_SIZE(mshv_passthru_hvcalls))
   180			return -EINVAL;
   181	
   182		is_async = mshv_hvcall_is_async(args.code);
   183		if (is_async) {
   184			/* async hypercalls can only be called from partition fd */
   185			if (!partition || !partition_locked)
   186				return -EINVAL;
   187			ret = mshv_init_async_handler(partition);
   188			if (ret)
   189				return ret;
   190		}
   191	
   192		pages_order = args.out_ptr ? 1 : 0;
   193		page = alloc_pages(GFP_KERNEL, pages_order);
   194		if (!page)
   195			return -ENOMEM;
   196		input_pg = page_address(page);
   197	
   198		if (args.out_ptr)
   199			output_pg = (char *)input_pg + PAGE_SIZE;
   200		else
   201			output_pg = NULL;
   202	
   203		if (copy_from_user(input_pg, (void __user *)args.in_ptr,
   204				   args.in_sz)) {
   205			ret = -EFAULT;
   206			goto free_pages_out;
   207		}
   208	
   209		/*
   210		 * NOTE: This only works because all the allowed hypercalls' input
   211		 * structs begin with a u64 partition_id field.
   212		 */
   213		*(u64 *)input_pg = pt_id;
   214	
   215		if (args.reps)
   216			status = hv_do_rep_hypercall(args.code, args.reps, 0,
   217						     input_pg, output_pg);
   218		else
   219			status = hv_do_hypercall(args.code, input_pg, output_pg);
   220	
   221		if (hv_result(status) == HV_STATUS_CALL_PENDING) {
   222			if (is_async) {
   223				mshv_async_hvcall_handler(partition, &status);
   224			} else { /* Paranoia check. This shouldn't happen! */
   225				ret = -EBADFD;
   226				goto free_pages_out;
   227			}
   228		}
   229	
   230		if (hv_result(status) == HV_STATUS_INSUFFICIENT_MEMORY) {
   231			ret = hv_call_deposit_pages(NUMA_NO_NODE, pt_id, 1);
   232			if (!ret)
   233				ret = -EAGAIN;
   234		} else if (!hv_result_success(status)) {
   235			ret = hv_result_to_errno(status);
   236		}
   237	
   238		/*
   239		 * Always return the status and output data regardless of result.
   240		 * The VMM may need it to determine how to proceed. E.g. the status may
   241		 * contain the number of reps completed if a rep hypercall partially
   242		 * succeeded.
   243		 */
   244		args.status = hv_result(status);
   245		args.reps = args.reps ? hv_repcomp(status) : 0;
   246		if (copy_to_user(user_args, &args, sizeof(args)))
   247			ret = -EFAULT;
   248	
   249		if (output_pg &&
   250		    copy_to_user((void __user *)args.out_ptr, output_pg, args.out_sz))
   251			ret = -EFAULT;
   252	
   253	free_pages_out:
   254		free_pages((unsigned long)input_pg, pages_order);
   255	
   256		return ret;
   257	}
   258	

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls
  2025-11-16  8:17 ` [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls kernel test robot
@ 2025-11-17 17:34   ` Wei Liu
  2025-11-17 17:41     ` Nuno Das Neves
  0 siblings, 1 reply; 4+ messages in thread
From: Wei Liu @ 2025-11-17 17:34 UTC (permalink / raw)
  To: kernel test robot, nunodasneves
  Cc: Anirudh Rayabharam, K. Y. Srinivasan, Haiyang Zhang, Wei Liu,
	Dexuan Cui, Long Li, llvm, oe-kbuild-all, linux-hyperv,
	linux-kernel

+Nuno

On Sun, Nov 16, 2025 at 04:17:08PM +0800, kernel test robot wrote:
> Hi Anirudh,
> 
> kernel test robot noticed the following build errors:
> 
> [auto build test ERROR on linus/master]
> [also build test ERROR on v6.18-rc5]
> [cannot apply to next-20251114]
> [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/Anirudh-Rayabharam/Drivers-hv-ioctl-for-self-targeted-passthrough-hvcalls/20251114-182039
> base:   linus/master
> patch link:    https://lore.kernel.org/r/20251114095853.3482596-1-anirudh%40anirudhrb.com
> patch subject: [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls
> config: x86_64-buildonly-randconfig-005-20251116 (https://download.01.org/0day-ci/archive/20251116/202511161617.KcDzR4sA-lkp@intel.com/config)
> compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251116/202511161617.KcDzR4sA-lkp@intel.com/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@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202511161617.KcDzR4sA-lkp@intel.com/
> 
> All errors (new ones prefixed by >>):
> 
> >> drivers/hv/mshv_root_main.c:125:2: error: use of undeclared identifier 'HVCALL_GET_PARTITION_PROPERTY_EX'
>      125 |         HVCALL_GET_PARTITION_PROPERTY_EX,
>          |         ^

Anirudh, please check this.

> >> drivers/hv/mshv_root_main.c:175:18: error: invalid application of 'sizeof' to an incomplete type 'u16[]' (aka 'unsigned short[]')
>      175 |         for (i = 0; i < ARRAY_SIZE(mshv_passthru_hvcalls); ++i)
>          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is from the original patch. Perhaps adding the explicit declaration
of the array size would help.

Wei

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls
  2025-11-17 17:34   ` Wei Liu
@ 2025-11-17 17:41     ` Nuno Das Neves
  2025-11-17 17:57       ` Anirudh Rayabharam
  0 siblings, 1 reply; 4+ messages in thread
From: Nuno Das Neves @ 2025-11-17 17:41 UTC (permalink / raw)
  To: Wei Liu, kernel test robot
  Cc: Anirudh Rayabharam, K. Y. Srinivasan, Haiyang Zhang, Dexuan Cui,
	Long Li, llvm, oe-kbuild-all, linux-hyperv, linux-kernel

On 11/17/2025 9:34 AM, Wei Liu wrote:
> +Nuno
> 
> On Sun, Nov 16, 2025 at 04:17:08PM +0800, kernel test robot wrote:
>> Hi Anirudh,
>>
>> kernel test robot noticed the following build errors:
>>
>> [auto build test ERROR on linus/master]
>> [also build test ERROR on v6.18-rc5]
>> [cannot apply to next-20251114]
>> [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/Anirudh-Rayabharam/Drivers-hv-ioctl-for-self-targeted-passthrough-hvcalls/20251114-182039
>> base:   linus/master
>> patch link:    https://lore.kernel.org/r/20251114095853.3482596-1-anirudh%40anirudhrb.com
>> patch subject: [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls
>> config: x86_64-buildonly-randconfig-005-20251116 (https://download.01.org/0day-ci/archive/20251116/202511161617.KcDzR4sA-lkp@intel.com/config)
>> compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
>> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251116/202511161617.KcDzR4sA-lkp@intel.com/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@intel.com>
>> | Closes: https://lore.kernel.org/oe-kbuild-all/202511161617.KcDzR4sA-lkp@intel.com/
>>
>> All errors (new ones prefixed by >>):
>>
>>>> drivers/hv/mshv_root_main.c:125:2: error: use of undeclared identifier 'HVCALL_GET_PARTITION_PROPERTY_EX'
>>      125 |         HVCALL_GET_PARTITION_PROPERTY_EX,
>>          |         ^
> 
> Anirudh, please check this.
> 
This is introduced in hyperv-next, in:
59aeea195948 mshv: Add the HVCALL_GET_PARTITION_PROPERTY_EX hypercall

But the bot applies the patch to linus/master, that is probably why.

>>>> drivers/hv/mshv_root_main.c:175:18: error: invalid application of 'sizeof' to an incomplete type 'u16[]' (aka 'unsigned short[]')
>>      175 |         for (i = 0; i < ARRAY_SIZE(mshv_passthru_hvcalls); ++i)
>>          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> This is from the original patch. Perhaps adding the explicit declaration
> of the array size would help.
> 

I think this is just due to the earlier error...

Nuno

> Wei


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls
  2025-11-17 17:41     ` Nuno Das Neves
@ 2025-11-17 17:57       ` Anirudh Rayabharam
  0 siblings, 0 replies; 4+ messages in thread
From: Anirudh Rayabharam @ 2025-11-17 17:57 UTC (permalink / raw)
  To: Nuno Das Neves
  Cc: Wei Liu, kernel test robot, K. Y. Srinivasan, Haiyang Zhang,
	Dexuan Cui, Long Li, llvm, oe-kbuild-all, linux-hyperv,
	linux-kernel

On Mon, Nov 17, 2025 at 09:41:19AM -0800, Nuno Das Neves wrote:
> On 11/17/2025 9:34 AM, Wei Liu wrote:
> > +Nuno
> > 
> > On Sun, Nov 16, 2025 at 04:17:08PM +0800, kernel test robot wrote:
> >> Hi Anirudh,
> >>
> >> kernel test robot noticed the following build errors:
> >>
> >> [auto build test ERROR on linus/master]
> >> [also build test ERROR on v6.18-rc5]
> >> [cannot apply to next-20251114]
> >> [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/Anirudh-Rayabharam/Drivers-hv-ioctl-for-self-targeted-passthrough-hvcalls/20251114-182039
> >> base:   linus/master
> >> patch link:    https://lore.kernel.org/r/20251114095853.3482596-1-anirudh%40anirudhrb.com
> >> patch subject: [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls
> >> config: x86_64-buildonly-randconfig-005-20251116 (https://download.01.org/0day-ci/archive/20251116/202511161617.KcDzR4sA-lkp@intel.com/config)
> >> compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
> >> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251116/202511161617.KcDzR4sA-lkp@intel.com/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@intel.com>
> >> | Closes: https://lore.kernel.org/oe-kbuild-all/202511161617.KcDzR4sA-lkp@intel.com/
> >>
> >> All errors (new ones prefixed by >>):
> >>
> >>>> drivers/hv/mshv_root_main.c:125:2: error: use of undeclared identifier 'HVCALL_GET_PARTITION_PROPERTY_EX'
> >>      125 |         HVCALL_GET_PARTITION_PROPERTY_EX,
> >>          |         ^
> > 
> > Anirudh, please check this.
> > 
> This is introduced in hyperv-next, in:
> 59aeea195948 mshv: Add the HVCALL_GET_PARTITION_PROPERTY_EX hypercall
> 
> But the bot applies the patch to linus/master, that is probably why.

Right. In the v2 of this patch, I used the --base argument to git
format-patch as suggested by the tool above. That should help it apply
the patch in the right tree. Let's see if it still complains.

Anirudh

> 
> >>>> drivers/hv/mshv_root_main.c:175:18: error: invalid application of 'sizeof' to an incomplete type 'u16[]' (aka 'unsigned short[]')
> >>      175 |         for (i = 0; i < ARRAY_SIZE(mshv_passthru_hvcalls); ++i)
> >>          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > 
> > This is from the original patch. Perhaps adding the explicit declaration
> > of the array size would help.
> > 
> 
> I think this is just due to the earlier error...
> 
> Nuno
> 
> > Wei
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-11-17 17:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20251114095853.3482596-1-anirudh@anirudhrb.com>
2025-11-16  8:17 ` [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls kernel test robot
2025-11-17 17:34   ` Wei Liu
2025-11-17 17:41     ` Nuno Das Neves
2025-11-17 17:57       ` Anirudh Rayabharam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).