Re: [PATCH 1/5] vhost: factor out IOTLB

From: kbuild test robot
Date: Fri Jan 17 2020 - 19:41:18 EST


Hi Jason,

I love your patch! Yet something to improve:

[auto build test ERROR on vhost/linux-next]
[also build test ERROR on linux/master linus/master v5.5-rc6 next-20200117]
[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/20200117-170243
base: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next
config: i386-randconfig-d002-20200117 (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=i386

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

All errors (new ones prefixed by >>):

ld: drivers/vhost/vhost.o: in function `iotlb_alloc':
>> drivers/vhost/vhost.c:582: undefined reference to `vhost_iotlb_alloc'
>> ld: drivers/vhost/vhost.c:582: undefined reference to `vhost_iotlb_alloc'
ld: drivers/vhost/vhost.o: in function `vhost_init_device_iotlb':
>> drivers/vhost/vhost.c:1667: undefined reference to `vhost_iotlb_free'
ld: drivers/vhost/vhost.o: in function `iotlb_access_ok':
>> drivers/vhost/vhost.c:1271: undefined reference to `vhost_iotlb_itree_first'
ld: drivers/vhost/vhost.o: in function `translate_desc':
drivers/vhost/vhost.c:1981: undefined reference to `vhost_iotlb_itree_first'
ld: drivers/vhost/vhost.o: in function `vhost_dev_cleanup':
drivers/vhost/vhost.c:658: undefined reference to `vhost_iotlb_free'
>> ld: drivers/vhost/vhost.c:660: undefined reference to `vhost_iotlb_free'
ld: drivers/vhost/vhost.o: in function `vhost_process_iotlb_msg':
>> drivers/vhost/vhost.c:1070: undefined reference to `vhost_iotlb_del_range'
>> ld: drivers/vhost/vhost.c:1056: undefined reference to `vhost_iotlb_add_range'
ld: drivers/vhost/vhost.o: in function `iotlb_alloc':
>> drivers/vhost/vhost.c:582: undefined reference to `vhost_iotlb_alloc'
ld: drivers/vhost/vhost.o: in function `vhost_set_memory':
>> drivers/vhost/vhost.c:1380: undefined reference to `vhost_iotlb_add_range'
ld: drivers/vhost/vhost.c:1407: undefined reference to `vhost_iotlb_free'
ld: drivers/vhost/vhost.c:1403: undefined reference to `vhost_iotlb_free'

vim +582 drivers/vhost/vhost.c

579
580 static struct vhost_iotlb *iotlb_alloc(void)
581 {
> 582 return vhost_iotlb_alloc(max_iotlb_entries,
583 VHOST_IOTLB_FLAG_RETIRE);
584 }
585
586 struct vhost_iotlb *vhost_dev_reset_owner_prepare(void)
587 {
588 return iotlb_alloc();
589 }
590 EXPORT_SYMBOL_GPL(vhost_dev_reset_owner_prepare);
591
592 /* Caller should have device mutex */
593 void vhost_dev_reset_owner(struct vhost_dev *dev, struct vhost_iotlb *umem)
594 {
595 int i;
596
597 vhost_dev_cleanup(dev);
598
599 dev->umem = umem;
600 /* We don't need VQ locks below since vhost_dev_cleanup makes sure
601 * VQs aren't running.
602 */
603 for (i = 0; i < dev->nvqs; ++i)
604 dev->vqs[i]->umem = umem;
605 }
606 EXPORT_SYMBOL_GPL(vhost_dev_reset_owner);
607
608 void vhost_dev_stop(struct vhost_dev *dev)
609 {
610 int i;
611
612 for (i = 0; i < dev->nvqs; ++i) {
613 if (dev->vqs[i]->kick && dev->vqs[i]->handle_kick) {
614 vhost_poll_stop(&dev->vqs[i]->poll);
615 vhost_poll_flush(&dev->vqs[i]->poll);
616 }
617 }
618 }
619 EXPORT_SYMBOL_GPL(vhost_dev_stop);
620
621 static void vhost_clear_msg(struct vhost_dev *dev)
622 {
623 struct vhost_msg_node *node, *n;
624
625 spin_lock(&dev->iotlb_lock);
626
627 list_for_each_entry_safe(node, n, &dev->read_list, node) {
628 list_del(&node->node);
629 kfree(node);
630 }
631
632 list_for_each_entry_safe(node, n, &dev->pending_list, node) {
633 list_del(&node->node);
634 kfree(node);
635 }
636
637 spin_unlock(&dev->iotlb_lock);
638 }
639
640 void vhost_dev_cleanup(struct vhost_dev *dev)
641 {
642 int i;
643
644 for (i = 0; i < dev->nvqs; ++i) {
645 if (dev->vqs[i]->error_ctx)
646 eventfd_ctx_put(dev->vqs[i]->error_ctx);
647 if (dev->vqs[i]->kick)
648 fput(dev->vqs[i]->kick);
649 if (dev->vqs[i]->call_ctx)
650 eventfd_ctx_put(dev->vqs[i]->call_ctx);
651 vhost_vq_reset(dev, dev->vqs[i]);
652 }
653 vhost_dev_free_iovecs(dev);
654 if (dev->log_ctx)
655 eventfd_ctx_put(dev->log_ctx);
656 dev->log_ctx = NULL;
657 /* No one will access memory at this point */
658 vhost_iotlb_free(dev->umem);
659 dev->umem = NULL;
> 660 vhost_iotlb_free(dev->iotlb);
661 dev->iotlb = NULL;
662 vhost_clear_msg(dev);
663 wake_up_interruptible_poll(&dev->wait, EPOLLIN | EPOLLRDNORM);
664 WARN_ON(!llist_empty(&dev->work_list));
665 if (dev->worker) {
666 kthread_stop(dev->worker);
667 dev->worker = NULL;
668 dev->kcov_handle = 0;
669 }
670 if (dev->mm)
671 mmput(dev->mm);
672 dev->mm = NULL;
673 }
674 EXPORT_SYMBOL_GPL(vhost_dev_cleanup);
675

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

Attachment: .config.gz
Description: application/gzip