* Re: [PATCH v2 4/4] vfio-pci: Best-effort huge pfnmaps with !MAP_FIXED mappings
[not found] <20251204151003.171039-5-peterx@redhat.com>
@ 2025-12-05 7:45 ` kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-12-05 7:45 UTC (permalink / raw)
To: Peter Xu, kvm, linux-mm, linux-kernel
Cc: llvm, oe-kbuild-all, Jason Gunthorpe, Nico Pache, Zi Yan,
Alex Mastro, David Hildenbrand, Alex Williamson, Zhi Wang,
David Laight, Yi Liu, Ankit Agrawal, peterx, Kevin Tian,
Andrew Morton, Linux Memory Management List
Hi Peter,
kernel test robot noticed the following build warnings:
[auto build test WARNING on awilliam-vfio/for-linus]
[also build test WARNING on v6.18]
[cannot apply to akpm-mm/mm-everything awilliam-vfio/next brauner-vfs/vfs.all linus/master next-20251205]
[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/Peter-Xu/mm-thp-Allow-thp_get_unmapped_area_vmflags-to-take-alignment/20251204-231258
base: https://github.com/awilliam/linux-vfio.git for-linus
patch link: https://lore.kernel.org/r/20251204151003.171039-5-peterx%40redhat.com
patch subject: [PATCH v2 4/4] vfio-pci: Best-effort huge pfnmaps with !MAP_FIXED mappings
config: i386-randconfig-006-20251205 (https://download.01.org/0day-ci/archive/20251205/202512051509.bh8Oncoq-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/20251205/202512051509.bh8Oncoq-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/202512051509.bh8Oncoq-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/vfio/pci/vfio_pci_core.c:1670:44: warning: shift count >= width of type [-Wshift-count-overflow]
1670 | req_start = (pgoff << PAGE_SHIFT) & ((1UL << VFIO_PCI_OFFSET_SHIFT) - 1);
| ^ ~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
vim +1670 drivers/vfio/pci/vfio_pci_core.c
1642
1643 /*
1644 * Hint function for mmap() about the size of mapping to be carried out.
1645 * This helps to enable huge pfnmaps as much as possible on BAR mappings.
1646 *
1647 * This function does the minimum check on mmap() parameters to make the
1648 * hint valid only. The majority of mmap() sanity check will be done later
1649 * in mmap().
1650 */
1651 int vfio_pci_core_get_mapping_order(struct vfio_device *device,
1652 unsigned long pgoff, size_t len)
1653 {
1654 struct vfio_pci_core_device *vdev =
1655 container_of(device, struct vfio_pci_core_device, vdev);
1656 struct pci_dev *pdev = vdev->pdev;
1657 unsigned int index = pgoff >> (VFIO_PCI_OFFSET_SHIFT - PAGE_SHIFT);
1658 unsigned long req_start;
1659 size_t phys_len;
1660
1661 /* Currently, only bars 0-5 supports huge pfnmap */
1662 if (index >= VFIO_PCI_ROM_REGION_INDEX)
1663 return 0;
1664
1665 /*
1666 * NOTE: we're keeping things simple as of now, assuming the
1667 * physical address of BARs (aka, pci_resource_start(pdev, index))
1668 * should always be aligned with pgoff in vfio-pci's address space.
1669 */
> 1670 req_start = (pgoff << PAGE_SHIFT) & ((1UL << VFIO_PCI_OFFSET_SHIFT) - 1);
1671 phys_len = PAGE_ALIGN(pci_resource_len(pdev, index));
1672
1673 /*
1674 * If this happens, it will probably fail mmap() later.. mapping
1675 * hint isn't important anymore.
1676 */
1677 if (req_start >= phys_len)
1678 return 0;
1679
1680 phys_len = MIN(phys_len - req_start, len);
1681
1682 if (IS_ENABLED(CONFIG_ARCH_SUPPORTS_PUD_PFNMAP) && phys_len >= PUD_SIZE)
1683 return PUD_ORDER;
1684
1685 if (IS_ENABLED(CONFIG_ARCH_SUPPORTS_PMD_PFNMAP) && phys_len >= PMD_SIZE)
1686 return PMD_ORDER;
1687
1688 return 0;
1689 }
1690 EXPORT_SYMBOL_GPL(vfio_pci_core_get_mapping_order);
1691
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread