public inbox for linux-hyperv@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Anirudh Rayabharam <anirudh@anirudhrb.com>,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
	Long Li <longli@microsoft.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	anirudh@anirudhrb.com, linux-hyperv@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls
Date: Sun, 16 Nov 2025 16:17:08 +0800	[thread overview]
Message-ID: <202511161617.KcDzR4sA-lkp@intel.com> (raw)
In-Reply-To: <20251114095853.3482596-1-anirudh@anirudhrb.com>

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

  parent reply	other threads:[~2025-11-16  8:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-14  9:58 [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls Anirudh Rayabharam
2025-11-15  6:22 ` Wei Liu
2025-11-15  7:39   ` Anirudh Rayabharam
2025-11-15  7:46     ` Wei Liu
2025-11-16  8:17 ` kernel test robot [this message]
2025-11-17 17:34   ` Wei Liu
2025-11-17 17:41     ` Nuno Das Neves
2025-11-17 17:57       ` Anirudh Rayabharam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202511161617.KcDzR4sA-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=anirudh@anirudhrb.com \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=longli@microsoft.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=wei.liu@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox