Re: [PATCH 2/2] KVM: add support for page hinting

From: kbuild test robot
Date: Tue Feb 18 2020 - 06:46:41 EST


Hi weiqi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on kvm/linux-next]
[also build test ERROR on vfio/next vhost/linux-next]
[cannot apply to v5.6-rc2 next-20200217]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/weiqi/page-hinting-add-passthrough-support/20200108-152941
base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git linux-next
config: x86_64-lkp (attached as .config)
compiler: gcc-7 (Debian 7.5.0-3) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

ld: arch/x86/kvm/x86.o: in function `kvm_vfio_ummap_range':
>> arch/x86/kvm/x86.c:4880: undefined reference to `vfio_dma_find'
>> ld: arch/x86/kvm/x86.c:4889: undefined reference to `vfio_munmap_pages'
ld: arch/x86/kvm/mmu/mmu.o: in function `kvm_vfio_mmap_range':
>> arch/x86/kvm/mmu/mmu.c:4302: undefined reference to `vfio_dma_find'
>> ld: arch/x86/kvm/mmu/mmu.c:4321: undefined reference to `vfio_mmap_pages'

vim +4880 arch/x86/kvm/x86.c

4838
4839 #include <linux/vfio.h>
4840 static void kvm_vfio_ummap_range(struct kvm *kvm, struct kvm_device *tmp,
4841 gfn_t gfn, int npages, unsigned long hva)
4842 {
4843 struct kvm_vfio *kv = tmp->private;
4844 struct kvm_vfio_group *kvg;
4845
4846 list_for_each_entry(kvg, &kv->group_list, node) {
4847 struct vfio_group *group = kvg->vfio_group;
4848 struct vfio_device *it, *device = NULL;
4849
4850 list_for_each_entry(it, &group->device_list, group_next) {
4851 unsigned long page_size, page_size_base;
4852 unsigned long addr;
4853 int size;
4854 unsigned long old_pfn = 0;
4855 int ret = 0;
4856 size_t unmapped = npages;
4857 gfn_t iova_gfn = gfn;
4858 unsigned long iova_hva = hva;
4859
4860 device = it;
4861 while (unmapped) {
4862 addr = gfn_to_hva(kvm, iova_gfn);
4863 page_size_base = page_size =
4864 kvm_host_page_size(kvm,
4865 iova_gfn);
4866
4867 if (addr != iova_hva)
4868 return;
4869
4870 while ((iova_gfn << PAGE_SHIFT) &
4871 (page_size - 1))
4872 page_size >>= 1;
4873
4874 while (addr & (page_size - 1))
4875 page_size >>= 1;
4876
4877 if (page_size_base != page_size)
4878 return;
4879
> 4880 size = vfio_dma_find(device->dev, iova_gfn,
4881 page_size >> PAGE_SHIFT,
4882 &old_pfn);
4883 if (!size)
4884 return;
4885
4886 if (!old_pfn)
4887 return;
4888
> 4889 ret = vfio_munmap_pages(device->dev,
4890 iova_gfn, page_size);
4891 unmapped -= page_size >> PAGE_SHIFT;
4892 iova_hva += page_size;
4893 iova_gfn += page_size >> PAGE_SHIFT;
4894 }
4895 }
4896 }
4897 }
4898

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip