Re: [PATCH V5 5/5] vdpasim: vDPA device simulator

From: kbuild test robot
Date: Wed Feb 26 2020 - 18:56:22 EST


Hi Jason,

I love your patch! Yet something to improve:

[auto build test ERROR on linux/master]
[also build test ERROR on linus/master v5.6-rc3]
[cannot apply to vhost/linux-next next-20200226]
[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/Jason-Wang/vDPA-support/20200226-173606
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git f5ae2ea6347a308cfe91f53b53682ce635497d0d
config: um-allyesconfig (attached as .config)
compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=um

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

All errors (new ones prefixed by >>):

drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c: In function 'vdpasim_create':
>> drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:335:2: error: implicit declaration of function 'set_dma_ops'; did you mean 'set_groups'? [-Werror=implicit-function-declaration]
set_dma_ops(dev, &vdpasim_dma_ops);
^~~~~~~~~~~
set_groups
Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls64
Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u64
Cyclomatic Complexity 1 include/linux/list.h:INIT_LIST_HEAD
Cyclomatic Complexity 1 arch/um/include/shared/mem.h:to_phys
Cyclomatic Complexity 1 arch/um/include/shared/mem.h:to_virt
Cyclomatic Complexity 1 include/linux/spinlock.h:spinlock_check
Cyclomatic Complexity 1 include/linux/spinlock.h:spin_lock
Cyclomatic Complexity 1 include/linux/spinlock.h:spin_unlock
Cyclomatic Complexity 1 include/linux/err.h:ERR_PTR
Cyclomatic Complexity 1 include/linux/err.h:PTR_ERR
Cyclomatic Complexity 1 include/linux/slab.h:kmalloc_type
Cyclomatic Complexity 28 include/linux/slab.h:kmalloc_index
Cyclomatic Complexity 1 include/linux/slab.h:kmalloc_large
Cyclomatic Complexity 4 include/linux/slab.h:kmalloc
Cyclomatic Complexity 1 include/linux/slab.h:kzalloc
Cyclomatic Complexity 1 include/asm-generic/io.h:virt_to_phys
Cyclomatic Complexity 1 include/asm-generic/io.h:phys_to_virt
Cyclomatic Complexity 1 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:dev_to_sim
Cyclomatic Complexity 1 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpa_to_sim
Cyclomatic Complexity 4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:dir_to_perm
Cyclomatic Complexity 1 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_set_vq_address
Cyclomatic Complexity 1 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_set_vq_num
Cyclomatic Complexity 1 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_set_vq_cb
Cyclomatic Complexity 1 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_get_vq_ready
Cyclomatic Complexity 1 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_set_vq_state
Cyclomatic Complexity 1 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_get_vq_state
Cyclomatic Complexity 1 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_get_vq_align
Cyclomatic Complexity 1 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_get_features
Cyclomatic Complexity 2 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_set_features
Cyclomatic Complexity 1 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_set_config_cb
Cyclomatic Complexity 1 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_get_vq_num_max
Cyclomatic Complexity 1 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_get_device_id
Cyclomatic Complexity 1 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_get_vendor_id
Cyclomatic Complexity 1 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_get_status
Cyclomatic Complexity 1 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_set_config
Cyclomatic Complexity 1 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_get_generation
Cyclomatic Complexity 1 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_dev_exit
Cyclomatic Complexity 1 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_dma_map
Cyclomatic Complexity 3 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_map_page
Cyclomatic Complexity 3 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_set_map
Cyclomatic Complexity 1 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_queue_ready
Cyclomatic Complexity 2 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_set_vq_ready
Cyclomatic Complexity 1 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_vq_reset
Cyclomatic Complexity 2 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_reset
Cyclomatic Complexity 2 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_set_status
Cyclomatic Complexity 1 include/linux/workqueue.h:queue_work
Cyclomatic Complexity 1 include/linux/workqueue.h:schedule_work
Cyclomatic Complexity 2 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_kick_vq
Cyclomatic Complexity 2 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_get_config
Cyclomatic Complexity 1 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_dma_unmap
Cyclomatic Complexity 1 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_unmap_page
Cyclomatic Complexity 1 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_free_coherent
Cyclomatic Complexity 3 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_alloc_coherent
Cyclomatic Complexity 2 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_device_release
Cyclomatic Complexity 1 include/linux/bottom_half.h:local_bh_disable
Cyclomatic Complexity 1 include/linux/bottom_half.h:local_bh_enable
Cyclomatic Complexity 11 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_work
Cyclomatic Complexity 68 include/asm-generic/getorder.h:get_order
Cyclomatic Complexity 1 include/linux/etherdevice.h:eth_random_addr
Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
Cyclomatic Complexity 7 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_create
Cyclomatic Complexity 2 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c:vdpasim_dev_init
cc1: some warnings being treated as errors

vim +335 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c

317
318 static struct vdpasim *vdpasim_create(void)
319 {
320 struct virtio_net_config *config;
321 struct vdpasim *vdpasim;
322 struct device *dev;
323 int ret = -ENOMEM;
324
325 vdpasim = kzalloc(sizeof(*vdpasim), GFP_KERNEL);
326 if (!vdpasim)
327 goto err_alloc;
328
329 INIT_WORK(&vdpasim->work, vdpasim_work);
330 spin_lock_init(&vdpasim->lock);
331
332 dev = &vdpasim->dev;
333 dev->release = vdpasim_device_release;
334 dev->coherent_dma_mask = DMA_BIT_MASK(64);
> 335 set_dma_ops(dev, &vdpasim_dma_ops);
336 dev_set_name(dev, "%s", VDPASIM_NAME);
337
338 device_initialize(&vdpasim->dev);
339
340 vdpasim->iommu = vhost_iotlb_alloc(2048, 0);
341 if (!vdpasim->iommu)
342 goto err_iommu;
343
344 vdpasim->buffer = kmalloc(PAGE_SIZE, GFP_KERNEL);
345 if (!vdpasim->buffer)
346 goto err_iommu;
347
348 config = &vdpasim->config;
349 config->mtu = 1500;
350 config->status = VIRTIO_NET_S_LINK_UP;
351 eth_random_addr(config->mac);
352
353 vringh_set_iotlb(&vdpasim->vqs[0].vring, vdpasim->iommu);
354 vringh_set_iotlb(&vdpasim->vqs[1].vring, vdpasim->iommu);
355
356 ret = device_add(&vdpasim->dev);
357 if (ret)
358 goto err_iommu;
359
360 vdpasim->vdpa = vdpa_alloc_device(dev, dev, &vdpasim_net_config_ops);
361 if (IS_ERR(vdpasim->vdpa))
362 goto err_vdpa;
363
364 ret = vdpa_register_device(vdpasim->vdpa);
365 if (ret)
366 goto err_register;
367
368 return vdpasim;
369
370 err_register:
371 put_device(&vdpasim->vdpa->dev);
372 err_vdpa:
373 device_del(&vdpasim->dev);
374 goto err_alloc;
375 err_iommu:
376 put_device(&vdpasim->dev);
377 err_alloc:
378 return ERR_PTR(ret);
379 }
380

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

Attachment: .config.gz
Description: application/gzip