All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>,
	kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org,
	decui@microsoft.com
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 5/5] Drivers: hv: Add support for movable memory regions
Date: Sat, 11 Oct 2025 01:48:34 +0800	[thread overview]
Message-ID: <202510110134.RmOV83Fz-lkp@intel.com> (raw)
In-Reply-To: <175976319844.16834.4747024333732752980.stgit@skinsburskii-cloud-desktop.internal.cloudapp.net>

Hi Stanislav,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on next-20251010]
[cannot apply to v6.17]
[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/Stanislav-Kinsburskii/Drivers-hv-Refactor-and-rename-memory-region-handling-functions/20251010-111917
base:   linus/master
patch link:    https://lore.kernel.org/r/175976319844.16834.4747024333732752980.stgit%40skinsburskii-cloud-desktop.internal.cloudapp.net
patch subject: [PATCH v4 5/5] Drivers: hv: Add support for movable memory regions
config: x86_64-randconfig-006-20251010 (https://download.01.org/0day-ci/archive/20251011/202510110134.RmOV83Fz-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/20251011/202510110134.RmOV83Fz-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/202510110134.RmOV83Fz-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/hv/mshv_root_main.c:1410:11: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
    1410 |         else if (!mutex_trylock(&region->mutex))
         |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hv/mshv_root_main.c:1434:12: note: uninitialized use occurs here
    1434 |         WARN_ONCE(ret,
         |                   ^~~
   include/asm-generic/bug.h:152:18: note: expanded from macro 'WARN_ONCE'
     152 |         DO_ONCE_LITE_IF(condition, WARN, 1, format)
         |                         ^~~~~~~~~
   include/linux/once_lite.h:28:27: note: expanded from macro 'DO_ONCE_LITE_IF'
      28 |                 bool __ret_do_once = !!(condition);                     \
         |                                         ^~~~~~~~~
   drivers/hv/mshv_root_main.c:1410:7: note: remove the 'if' if its condition is always false
    1410 |         else if (!mutex_trylock(&region->mutex))
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1411 |                 goto out_fail;
         |                 ~~~~~~~~~~~~~
   drivers/hv/mshv_root_main.c:1406:9: note: initialize the variable 'ret' to silence this warning
    1406 |         int ret;
         |                ^
         |                 = 0
   1 warning generated.


vim +1410 drivers/hv/mshv_root_main.c

  1377	
  1378	/**
  1379	 * mshv_region_interval_invalidate - Invalidate a range of memory region
  1380	 * @mni: Pointer to the mmu_interval_notifier structure
  1381	 * @range: Pointer to the mmu_notifier_range structure
  1382	 * @cur_seq: Current sequence number for the interval notifier
  1383	 *
  1384	 * This function invalidates a memory region by remapping its pages with
  1385	 * no access permissions. It locks the region's mutex to ensure thread safety
  1386	 * and updates the sequence number for the interval notifier. If the range
  1387	 * is blockable, it uses a blocking lock; otherwise, it attempts a non-blocking
  1388	 * lock and returns false if unsuccessful.
  1389	 *
  1390	 * NOTE: Failure to invalidate a region is a serious error, as the pages will
  1391	 * be considered freed while they are still mapped by the hypervisor.
  1392	 * Any attempt to access such pages will likely crash the system.
  1393	 *
  1394	 * Return: true if the region was successfully invalidated, false otherwise.
  1395	 */
  1396	static bool
  1397	mshv_region_interval_invalidate(struct mmu_interval_notifier *mni,
  1398					const struct mmu_notifier_range *range,
  1399					unsigned long cur_seq)
  1400	{
  1401		struct mshv_mem_region *region = container_of(mni,
  1402							struct mshv_mem_region,
  1403							mni);
  1404		u64 page_offset, page_count;
  1405		unsigned long mstart, mend;
  1406		int ret;
  1407	
  1408		if (mmu_notifier_range_blockable(range))
  1409			mutex_lock(&region->mutex);
> 1410		else if (!mutex_trylock(&region->mutex))
  1411			goto out_fail;
  1412	
  1413		mmu_interval_set_seq(mni, cur_seq);
  1414	
  1415		mstart = max(range->start, region->start_uaddr);
  1416		mend = min(range->end, region->start_uaddr +
  1417			   (region->nr_pages << HV_HYP_PAGE_SHIFT));
  1418	
  1419		page_offset = HVPFN_DOWN(mstart - region->start_uaddr);
  1420		page_count = HVPFN_DOWN(mend - mstart);
  1421	
  1422		ret = mshv_region_remap_pages(region, HV_MAP_GPA_NO_ACCESS,
  1423					      page_offset, page_count);
  1424		if (ret)
  1425			goto out_fail;
  1426	
  1427		mshv_region_invalidate_pages(region, page_offset, page_count);
  1428	
  1429		mutex_unlock(&region->mutex);
  1430	
  1431		return true;
  1432	
  1433	out_fail:
  1434		WARN_ONCE(ret,
  1435			  "Failed to invalidate region %#llx-%#llx (range %#lx-%#lx, event: %u, pages %#llx-%#llx, mm: %#llx): %d\n",
  1436			  region->start_uaddr,
  1437			  region->start_uaddr + (region->nr_pages << HV_HYP_PAGE_SHIFT),
  1438			  range->start, range->end, range->event,
  1439			  page_offset, page_offset + page_count - 1, (u64)range->mm, ret);
  1440		return false;
  1441	}
  1442	

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

  reply	other threads:[~2025-10-10 17:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-06 15:06 [PATCH v4 0/5] Introduce movable pages for Hyper-V guests Stanislav Kinsburskii
2025-10-06 15:06 ` [PATCH v4 1/5] Drivers: hv: Refactor and rename memory region handling functions Stanislav Kinsburskii
2025-10-10 22:49   ` Nuno Das Neves
2025-10-06 15:06 ` [PATCH v4 2/5] Drivers: hv: Centralize guest memory region destruction Stanislav Kinsburskii
2025-10-10 22:54   ` Nuno Das Neves
2025-10-06 15:06 ` [PATCH v4 3/5] Drivers: hv: Batch GPA unmap operations to improve large region performance Stanislav Kinsburskii
2025-10-06 17:09   ` Michael Kelley
2025-10-06 23:32     ` Stanislav Kinsburskii
2025-10-07  0:02       ` Michael Kelley
2025-10-10 23:06   ` Nuno Das Neves
2025-10-06 15:06 ` [PATCH v4 4/5] Drivers: hv: Ensure large page GPA mapping is PMD-aligned Stanislav Kinsburskii
2025-10-10 23:07   ` Nuno Das Neves
2025-10-06 15:06 ` [PATCH v4 5/5] Drivers: hv: Add support for movable memory regions Stanislav Kinsburskii
2025-10-10 17:48   ` kernel test robot [this message]
2025-10-11  1:12   ` kernel test robot

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=202510110134.RmOV83Fz-lkp@intel.com \
    --to=lkp@intel.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=oe-kbuild-all@lists.linux.dev \
    --cc=skinsburskii@linux.microsoft.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.