lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202304060424.MtQM4udq-lkp@intel.com>
Date:   Thu, 6 Apr 2023 05:07:54 +0800
From:   kernel test robot <lkp@...el.com>
To:     ankita@...dia.com, jgg@...dia.com, alex.williamson@...hat.com,
        naoya.horiguchi@....com, maz@...nel.org, oliver.upton@...ux.dev
Cc:     oe-kbuild-all@...ts.linux.dev, aniketa@...dia.com, cjia@...dia.com,
        kwankhede@...dia.com, targupta@...dia.com, vsethi@...dia.com,
        acurrid@...dia.com, apopple@...dia.com, jhubbard@...dia.com,
        danw@...dia.com, kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, linux-mm@...ck.org
Subject: Re: [PATCH v3 2/6] vfio/nvgpu: expose GPU device memory as BAR1

Hi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on awilliam-vfio/for-linus]
[also build test WARNING on kvmarm/next akpm-mm/mm-everything linus/master v6.3-rc5 next-20230405]
[cannot apply to awilliam-vfio/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/ankita-nvidia-com/kvm-determine-memory-type-from-VMA/20230406-020404
base:   https://github.com/awilliam/linux-vfio.git for-linus
patch link:    https://lore.kernel.org/r/20230405180134.16932-3-ankita%40nvidia.com
patch subject: [PATCH v3 2/6] vfio/nvgpu: expose GPU device memory as BAR1
config: sparc-allyesconfig (https://download.01.org/0day-ci/archive/20230406/202304060424.MtQM4udq-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/09ea30fcd2fb02d13a38cab4bf3d903f902408f4
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review ankita-nvidia-com/kvm-determine-memory-type-from-VMA/20230406-020404
        git checkout 09ea30fcd2fb02d13a38cab4bf3d903f902408f4
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash drivers/vfio/pci/nvgpu/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304060424.MtQM4udq-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/vfio/pci/nvgpu/main.c:57:5: warning: no previous prototype for 'nvgpu_vfio_pci_mmap' [-Wmissing-prototypes]
      57 | int nvgpu_vfio_pci_mmap(struct vfio_device *core_vdev,
         |     ^~~~~~~~~~~~~~~~~~~
>> drivers/vfio/pci/nvgpu/main.c:100:6: warning: no previous prototype for 'nvgpu_vfio_pci_ioctl' [-Wmissing-prototypes]
     100 | long nvgpu_vfio_pci_ioctl(struct vfio_device *core_vdev, unsigned int cmd,
         |      ^~~~~~~~~~~~~~~~~~~~


vim +/nvgpu_vfio_pci_mmap +57 drivers/vfio/pci/nvgpu/main.c

    56	
  > 57	int nvgpu_vfio_pci_mmap(struct vfio_device *core_vdev,
    58				struct vm_area_struct *vma)
    59	{
    60		struct nvgpu_vfio_pci_core_device *nvdev = container_of(
    61			core_vdev, struct nvgpu_vfio_pci_core_device, core_device.vdev);
    62	
    63		unsigned long start_pfn;
    64		unsigned int index;
    65		u64 req_len, pgoff;
    66		int ret = 0;
    67	
    68		index = vma->vm_pgoff >> (VFIO_PCI_OFFSET_SHIFT - PAGE_SHIFT);
    69		if (index != nvdev->mem_prop.bar1_start_offset)
    70			return vfio_pci_core_mmap(core_vdev, vma);
    71	
    72		/*
    73		 * Request to mmap the BAR1. Map to the CPU accessible memory on the
    74		 * GPU using the memory information gathered from the system ACPI
    75		 * tables.
    76		 */
    77		start_pfn = nvdev->mem_prop.hpa >> PAGE_SHIFT;
    78		req_len = vma->vm_end - vma->vm_start;
    79		pgoff = vma->vm_pgoff &
    80			((1U << (VFIO_PCI_OFFSET_SHIFT - PAGE_SHIFT)) - 1);
    81		if (pgoff >= (nvdev->mem_prop.mem_length >> PAGE_SHIFT))
    82			return -EINVAL;
    83	
    84		/*
    85		 * Perform a PFN map to the memory. The device BAR1 is backed by the
    86		 * GPU memory now. Check that the mapping does not overflow out of
    87		 * the GPU memory size.
    88		 */
    89		ret = remap_pfn_range(vma, vma->vm_start, start_pfn + pgoff,
    90				      min(req_len, nvdev->mem_prop.mem_length - pgoff),
    91				      vma->vm_page_prot);
    92		if (ret)
    93			return ret;
    94	
    95		vma->vm_pgoff = start_pfn + pgoff;
    96	
    97		return 0;
    98	}
    99	
 > 100	long nvgpu_vfio_pci_ioctl(struct vfio_device *core_vdev, unsigned int cmd,
   101				  unsigned long arg)
   102	{
   103		struct nvgpu_vfio_pci_core_device *nvdev = container_of(
   104			core_vdev, struct nvgpu_vfio_pci_core_device, core_device.vdev);
   105	
   106		unsigned long minsz = offsetofend(struct vfio_region_info, offset);
   107		struct vfio_region_info info;
   108	
   109		switch (cmd) {
   110		case VFIO_DEVICE_GET_REGION_INFO:
   111			if (copy_from_user(&info, (void __user *)arg, minsz))
   112				return -EFAULT;
   113	
   114			if (info.argsz < minsz)
   115				return -EINVAL;
   116	
   117			if (info.index == nvdev->mem_prop.bar1_start_offset) {
   118				/*
   119				 * Request to determine the BAR1 region information. Send the
   120				 * GPU memory information.
   121				 */
   122				info.offset = VFIO_PCI_INDEX_TO_OFFSET(info.index);
   123				info.size = nvdev->mem_prop.mem_length;
   124				info.flags = VFIO_REGION_INFO_FLAG_READ |
   125					     VFIO_REGION_INFO_FLAG_WRITE |
   126					     VFIO_REGION_INFO_FLAG_MMAP;
   127				return copy_to_user((void __user *)arg, &info, minsz) ?
   128					       -EFAULT : 0;
   129			}
   130	
   131			if (info.index == nvdev->mem_prop.bar1_start_offset + 1) {
   132				/*
   133				 * The BAR1 region is 64b. Ignore this access.
   134				 */
   135				info.offset = VFIO_PCI_INDEX_TO_OFFSET(info.index);
   136				info.size = 0;
   137				info.flags = 0;
   138				return copy_to_user((void __user *)arg, &info, minsz) ?
   139					-EFAULT : 0;
   140			}
   141	
   142			return vfio_pci_core_ioctl(core_vdev, cmd, arg);
   143	
   144		default:
   145			return vfio_pci_core_ioctl(core_vdev, cmd, arg);
   146		}
   147	}
   148	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ