Re: [PATCH 15/52] fuse: map virtio_fs DAX window BAR

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Stefan,

I love your patch! Yet something to improve:

[auto build test ERROR on fuse/for-next]
[also build test ERROR on v4.20-rc6]
[cannot apply to next-20181213]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Vivek-Goyal/virtio-fs-shared-file-system-for-virtual-machines/20181211-103034
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git for-next
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=sh 

All errors (new ones prefixed by >>):

   fs/fuse/virtio_fs.c: In function 'virtio_fs_setup_dax':
>> fs/fuse/virtio_fs.c:465:8: error: implicit declaration of function 'pcim_enable_device'; did you mean 'pci_enable_device'? [-Werror=implicit-function-declaration]
     ret = pcim_enable_device(pci_dev);
           ^~~~~~~~~~~~~~~~~~
           pci_enable_device
>> fs/fuse/virtio_fs.c:470:8: error: implicit declaration of function 'pci_request_region'; did you mean 'pci_request_regions'? [-Werror=implicit-function-declaration]
     ret = pci_request_region(pci_dev, VIRTIO_FS_WINDOW_BAR,
           ^~~~~~~~~~~~~~~~~~
           pci_request_regions
   In file included from include/linux/printk.h:336:0,
                    from include/linux/kernel.h:14,
                    from include/linux/list.h:9,
                    from include/linux/wait.h:7,
                    from include/linux/wait_bit.h:8,
                    from include/linux/fs.h:6,
                    from fs/fuse/virtio_fs.c:7:
   fs/fuse/virtio_fs.c:528:22: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 6 has type 'phys_addr_t {aka unsigned int}' [-Wformat=]
     dev_dbg(&vdev->dev, "%s: window kaddr 0x%px phys_addr 0x%llx len %zu\n",
                         ^
   include/linux/dynamic_debug.h:135:39: note: in definition of macro 'dynamic_dev_dbg'
      __dynamic_dev_dbg(&descriptor, dev, fmt, \
                                          ^~~
   include/linux/device.h:1463:23: note: in expansion of macro 'dev_fmt'
     dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
                          ^~~~~~~
   fs/fuse/virtio_fs.c:528:2: note: in expansion of macro 'dev_dbg'
     dev_dbg(&vdev->dev, "%s: window kaddr 0x%px phys_addr 0x%llx len %zu\n",
     ^~~~~~~
   At top level:
   fs/fuse/virtio_fs.c:604:12: warning: 'virtio_fs_restore' defined but not used [-Wunused-function]
    static int virtio_fs_restore(struct virtio_device *vdev)
               ^~~~~~~~~~~~~~~~~
   fs/fuse/virtio_fs.c:599:12: warning: 'virtio_fs_freeze' defined but not used [-Wunused-function]
    static int virtio_fs_freeze(struct virtio_device *vdev)
               ^~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +465 fs/fuse/virtio_fs.c

   445	
   446	static int virtio_fs_setup_dax(struct virtio_device *vdev, struct virtio_fs *fs)
   447	{
   448		struct virtio_fs_memremap_info *mi;
   449		struct dev_pagemap *pgmap;
   450		struct pci_dev *pci_dev;
   451		phys_addr_t phys_addr;
   452		size_t len;
   453		int ret;
   454	
   455		if (!IS_ENABLED(CONFIG_DAX_DRIVER))
   456			return 0;
   457	
   458		/* HACK implement VIRTIO shared memory regions instead of
   459		 * directly accessing the PCI BAR from a virtio device driver.
   460		 */
   461		pci_dev = container_of(vdev->dev.parent, struct pci_dev, dev);
   462	
   463		/* TODO Is this safe - the virtio_pci_* driver doesn't use managed
   464		 * device APIs? */
 > 465		ret = pcim_enable_device(pci_dev);
   466		if (ret < 0)
   467			return ret;
   468	
   469		/* TODO handle case where device doesn't expose BAR? */
 > 470		ret = pci_request_region(pci_dev, VIRTIO_FS_WINDOW_BAR,
   471					 "virtio-fs-window");
   472		if (ret < 0) {
   473			dev_err(&vdev->dev, "%s: failed to request window BAR\n",
   474				__func__);
   475			return ret;
   476		}
   477	
   478		phys_addr = pci_resource_start(pci_dev, VIRTIO_FS_WINDOW_BAR);
   479		len = pci_resource_len(pci_dev, VIRTIO_FS_WINDOW_BAR);
   480	
   481		mi = devm_kzalloc(&pci_dev->dev, sizeof(*mi), GFP_KERNEL);
   482		if (!mi)
   483			return -ENOMEM;
   484	
   485		init_completion(&mi->completion);
   486		ret = percpu_ref_init(&mi->ref, virtio_fs_percpu_release, 0,
   487				      GFP_KERNEL);
   488		if (ret < 0) {
   489			dev_err(&vdev->dev, "%s: percpu_ref_init failed (%d)\n",
   490				__func__, ret);
   491			return ret;
   492		}
   493	
   494		ret = devm_add_action(&pci_dev->dev, virtio_fs_percpu_exit, mi);
   495		if (ret < 0) {
   496			percpu_ref_exit(&mi->ref);
   497			return ret;
   498		}
   499	
   500		pgmap = &mi->pgmap;
   501		pgmap->altmap_valid = false;
   502		pgmap->ref = &mi->ref;
   503		pgmap->type = MEMORY_DEVICE_FS_DAX;
   504	
   505		/* Ideally we would directly use the PCI BAR resource but
   506		 * devm_memremap_pages() wants its own copy in pgmap.  So
   507		 * initialize a struct resource from scratch (only the start
   508		 * and end fields will be used).
   509		 */
   510		pgmap->res = (struct resource){
   511			.name = "virtio-fs dax window",
   512			.start = phys_addr,
   513			.end = phys_addr + len,
   514		};
   515	
   516		fs->window_kaddr = devm_memremap_pages(&pci_dev->dev, pgmap);
   517		if (IS_ERR(fs->window_kaddr))
   518			return PTR_ERR(fs->window_kaddr);
   519	
   520		ret = devm_add_action_or_reset(&pci_dev->dev, virtio_fs_percpu_kill,
   521					       &mi->ref);
   522		if (ret < 0)
   523			return ret;
   524	
   525		fs->window_phys_addr = phys_addr;
   526		fs->window_len = len;
   527	
   528		dev_dbg(&vdev->dev, "%s: window kaddr 0x%px phys_addr 0x%llx len %zu\n",
   529			__func__, fs->window_kaddr, phys_addr, len);
   530	
   531		fs->dax_dev = alloc_dax(fs, NULL, &virtio_fs_dax_ops);
   532		if (!fs->dax_dev)
   533			return -ENOMEM;
   534	
   535		return devm_add_action_or_reset(&vdev->dev, virtio_fs_cleanup_dax, fs);
   536	}
   537	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux