Re: [PATCH] vhost: do not enable VHOST_MENU by default

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

 



Hi Jason,

I love your patch! Yet something to improve:

[auto build test ERROR on vhost/linux-next]
[also build test ERROR on next-20200414]
[cannot apply to powerpc/next s390/features v5.7-rc1]
[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/vhost-do-not-enable-VHOST_MENU-by-default/20200414-110807
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next
config: ia64-randconfig-a001-20200415 (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.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=9.3.0 make.cross ARCH=ia64 

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

All error/warnings (new ones prefixed by >>):

   drivers/vhost/vhost.c: In function 'vhost_vring_ioctl':
>> drivers/vhost/vhost.c:1577:33: error: implicit declaration of function 'eventfd_fget'; did you mean 'eventfd_signal'? [-Werror=implicit-function-declaration]
    1577 |   eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd);
         |                                 ^~~~~~~~~~~~
         |                                 eventfd_signal
>> drivers/vhost/vhost.c:1577:31: warning: pointer/integer type mismatch in conditional expression
    1577 |   eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd);
         |                               ^
   cc1: some warnings being treated as errors

vim +1577 drivers/vhost/vhost.c

feebcaeac79ad8 Jason Wang         2019-05-24  1493  
feebcaeac79ad8 Jason Wang         2019-05-24  1494  static long vhost_vring_set_num_addr(struct vhost_dev *d,
feebcaeac79ad8 Jason Wang         2019-05-24  1495  				     struct vhost_virtqueue *vq,
feebcaeac79ad8 Jason Wang         2019-05-24  1496  				     unsigned int ioctl,
feebcaeac79ad8 Jason Wang         2019-05-24  1497  				     void __user *argp)
feebcaeac79ad8 Jason Wang         2019-05-24  1498  {
feebcaeac79ad8 Jason Wang         2019-05-24  1499  	long r;
feebcaeac79ad8 Jason Wang         2019-05-24  1500  
feebcaeac79ad8 Jason Wang         2019-05-24  1501  	mutex_lock(&vq->mutex);
feebcaeac79ad8 Jason Wang         2019-05-24  1502  
feebcaeac79ad8 Jason Wang         2019-05-24  1503  	switch (ioctl) {
feebcaeac79ad8 Jason Wang         2019-05-24  1504  	case VHOST_SET_VRING_NUM:
feebcaeac79ad8 Jason Wang         2019-05-24  1505  		r = vhost_vring_set_num(d, vq, argp);
feebcaeac79ad8 Jason Wang         2019-05-24  1506  		break;
feebcaeac79ad8 Jason Wang         2019-05-24  1507  	case VHOST_SET_VRING_ADDR:
feebcaeac79ad8 Jason Wang         2019-05-24  1508  		r = vhost_vring_set_addr(d, vq, argp);
feebcaeac79ad8 Jason Wang         2019-05-24  1509  		break;
feebcaeac79ad8 Jason Wang         2019-05-24  1510  	default:
feebcaeac79ad8 Jason Wang         2019-05-24  1511  		BUG();
feebcaeac79ad8 Jason Wang         2019-05-24  1512  	}
feebcaeac79ad8 Jason Wang         2019-05-24  1513  
feebcaeac79ad8 Jason Wang         2019-05-24  1514  	mutex_unlock(&vq->mutex);
feebcaeac79ad8 Jason Wang         2019-05-24  1515  
feebcaeac79ad8 Jason Wang         2019-05-24  1516  	return r;
feebcaeac79ad8 Jason Wang         2019-05-24  1517  }
26b36604523f4a Sonny Rao          2018-03-14  1518  long vhost_vring_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp)
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1519  {
cecb46f194460d Al Viro            2012-08-27  1520  	struct file *eventfp, *filep = NULL;
cecb46f194460d Al Viro            2012-08-27  1521  	bool pollstart = false, pollstop = false;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1522  	struct eventfd_ctx *ctx = NULL;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1523  	u32 __user *idxp = argp;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1524  	struct vhost_virtqueue *vq;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1525  	struct vhost_vring_state s;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1526  	struct vhost_vring_file f;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1527  	u32 idx;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1528  	long r;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1529  
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1530  	r = get_user(idx, idxp);
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1531  	if (r < 0)
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1532  		return r;
0f3d9a17469d71 Krishna Kumar      2010-05-25  1533  	if (idx >= d->nvqs)
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1534  		return -ENOBUFS;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1535  
ff002269a4ee9c Jason Wang         2018-10-30  1536  	idx = array_index_nospec(idx, d->nvqs);
3ab2e420ec1caf Asias He           2013-04-27  1537  	vq = d->vqs[idx];
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1538  
feebcaeac79ad8 Jason Wang         2019-05-24  1539  	if (ioctl == VHOST_SET_VRING_NUM ||
feebcaeac79ad8 Jason Wang         2019-05-24  1540  	    ioctl == VHOST_SET_VRING_ADDR) {
feebcaeac79ad8 Jason Wang         2019-05-24  1541  		return vhost_vring_set_num_addr(d, vq, ioctl, argp);
feebcaeac79ad8 Jason Wang         2019-05-24  1542  	}
feebcaeac79ad8 Jason Wang         2019-05-24  1543  
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1544  	mutex_lock(&vq->mutex);
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1545  
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1546  	switch (ioctl) {
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1547  	case VHOST_SET_VRING_BASE:
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1548  		/* Moving base with an active backend?
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1549  		 * You don't want to do that. */
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1550  		if (vq->private_data) {
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1551  			r = -EBUSY;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1552  			break;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1553  		}
7ad9c9d2704854 Takuya Yoshikawa   2010-05-27  1554  		if (copy_from_user(&s, argp, sizeof s)) {
7ad9c9d2704854 Takuya Yoshikawa   2010-05-27  1555  			r = -EFAULT;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1556  			break;
7ad9c9d2704854 Takuya Yoshikawa   2010-05-27  1557  		}
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1558  		if (s.num > 0xffff) {
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1559  			r = -EINVAL;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1560  			break;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1561  		}
8d65843c44269c Jason Wang         2017-07-27  1562  		vq->last_avail_idx = s.num;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1563  		/* Forget the cached index value. */
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1564  		vq->avail_idx = vq->last_avail_idx;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1565  		break;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1566  	case VHOST_GET_VRING_BASE:
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1567  		s.index = idx;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1568  		s.num = vq->last_avail_idx;
7ad9c9d2704854 Takuya Yoshikawa   2010-05-27  1569  		if (copy_to_user(argp, &s, sizeof s))
7ad9c9d2704854 Takuya Yoshikawa   2010-05-27  1570  			r = -EFAULT;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1571  		break;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1572  	case VHOST_SET_VRING_KICK:
7ad9c9d2704854 Takuya Yoshikawa   2010-05-27  1573  		if (copy_from_user(&f, argp, sizeof f)) {
7ad9c9d2704854 Takuya Yoshikawa   2010-05-27  1574  			r = -EFAULT;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1575  			break;
7ad9c9d2704854 Takuya Yoshikawa   2010-05-27  1576  		}
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14 @1577  		eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd);
535297a6ae4c3b Michael S. Tsirkin 2010-03-17  1578  		if (IS_ERR(eventfp)) {
535297a6ae4c3b Michael S. Tsirkin 2010-03-17  1579  			r = PTR_ERR(eventfp);
535297a6ae4c3b Michael S. Tsirkin 2010-03-17  1580  			break;
535297a6ae4c3b Michael S. Tsirkin 2010-03-17  1581  		}
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1582  		if (eventfp != vq->kick) {
cecb46f194460d Al Viro            2012-08-27  1583  			pollstop = (filep = vq->kick) != NULL;
cecb46f194460d Al Viro            2012-08-27  1584  			pollstart = (vq->kick = eventfp) != NULL;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1585  		} else
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1586  			filep = eventfp;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1587  		break;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1588  	case VHOST_SET_VRING_CALL:
7ad9c9d2704854 Takuya Yoshikawa   2010-05-27  1589  		if (copy_from_user(&f, argp, sizeof f)) {
7ad9c9d2704854 Takuya Yoshikawa   2010-05-27  1590  			r = -EFAULT;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1591  			break;
7ad9c9d2704854 Takuya Yoshikawa   2010-05-27  1592  		}
e050c7d93f4adb Eric Biggers       2018-01-06  1593  		ctx = f.fd == -1 ? NULL : eventfd_ctx_fdget(f.fd);
e050c7d93f4adb Eric Biggers       2018-01-06  1594  		if (IS_ERR(ctx)) {
e050c7d93f4adb Eric Biggers       2018-01-06  1595  			r = PTR_ERR(ctx);
535297a6ae4c3b Michael S. Tsirkin 2010-03-17  1596  			break;
535297a6ae4c3b Michael S. Tsirkin 2010-03-17  1597  		}
e050c7d93f4adb Eric Biggers       2018-01-06  1598  		swap(ctx, vq->call_ctx);
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1599  		break;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1600  	case VHOST_SET_VRING_ERR:
7ad9c9d2704854 Takuya Yoshikawa   2010-05-27  1601  		if (copy_from_user(&f, argp, sizeof f)) {
7ad9c9d2704854 Takuya Yoshikawa   2010-05-27  1602  			r = -EFAULT;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1603  			break;
7ad9c9d2704854 Takuya Yoshikawa   2010-05-27  1604  		}
09f332a589232f Eric Biggers       2018-01-06  1605  		ctx = f.fd == -1 ? NULL : eventfd_ctx_fdget(f.fd);
09f332a589232f Eric Biggers       2018-01-06  1606  		if (IS_ERR(ctx)) {
09f332a589232f Eric Biggers       2018-01-06  1607  			r = PTR_ERR(ctx);
535297a6ae4c3b Michael S. Tsirkin 2010-03-17  1608  			break;
535297a6ae4c3b Michael S. Tsirkin 2010-03-17  1609  		}
09f332a589232f Eric Biggers       2018-01-06  1610  		swap(ctx, vq->error_ctx);
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1611  		break;
2751c9882b9472 Greg Kurz          2015-04-24  1612  	case VHOST_SET_VRING_ENDIAN:
2751c9882b9472 Greg Kurz          2015-04-24  1613  		r = vhost_set_vring_endian(vq, argp);
2751c9882b9472 Greg Kurz          2015-04-24  1614  		break;
2751c9882b9472 Greg Kurz          2015-04-24  1615  	case VHOST_GET_VRING_ENDIAN:
2751c9882b9472 Greg Kurz          2015-04-24  1616  		r = vhost_get_vring_endian(vq, idx, argp);
2751c9882b9472 Greg Kurz          2015-04-24  1617  		break;
03088137246065 Jason Wang         2016-03-04  1618  	case VHOST_SET_VRING_BUSYLOOP_TIMEOUT:
03088137246065 Jason Wang         2016-03-04  1619  		if (copy_from_user(&s, argp, sizeof(s))) {
03088137246065 Jason Wang         2016-03-04  1620  			r = -EFAULT;
03088137246065 Jason Wang         2016-03-04  1621  			break;
03088137246065 Jason Wang         2016-03-04  1622  		}
03088137246065 Jason Wang         2016-03-04  1623  		vq->busyloop_timeout = s.num;
03088137246065 Jason Wang         2016-03-04  1624  		break;
03088137246065 Jason Wang         2016-03-04  1625  	case VHOST_GET_VRING_BUSYLOOP_TIMEOUT:
03088137246065 Jason Wang         2016-03-04  1626  		s.index = idx;
03088137246065 Jason Wang         2016-03-04  1627  		s.num = vq->busyloop_timeout;
03088137246065 Jason Wang         2016-03-04  1628  		if (copy_to_user(argp, &s, sizeof(s)))
03088137246065 Jason Wang         2016-03-04  1629  			r = -EFAULT;
03088137246065 Jason Wang         2016-03-04  1630  		break;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1631  	default:
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1632  		r = -ENOIOCTLCMD;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1633  	}
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1634  
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1635  	if (pollstop && vq->handle_kick)
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1636  		vhost_poll_stop(&vq->poll);
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1637  
e050c7d93f4adb Eric Biggers       2018-01-06  1638  	if (!IS_ERR_OR_NULL(ctx))
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1639  		eventfd_ctx_put(ctx);
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1640  	if (filep)
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1641  		fput(filep);
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1642  
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1643  	if (pollstart && vq->handle_kick)
2b8b328b61c799 Jason Wang         2013-01-28  1644  		r = vhost_poll_start(&vq->poll, vq->kick);
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1645  
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1646  	mutex_unlock(&vq->mutex);
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1647  
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1648  	if (pollstop && vq->handle_kick)
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1649  		vhost_poll_flush(&vq->poll);
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1650  	return r;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1651  }
6ac1afbf6132df Asias He           2013-05-06  1652  EXPORT_SYMBOL_GPL(vhost_vring_ioctl);
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14  1653  

:::::: The code at line 1577 was first introduced by commit
:::::: 3a4d5c94e959359ece6d6b55045c3f046677f55c vhost_net: a kernel-level virtio server

:::::: TO: Michael S. Tsirkin <mst@xxxxxxxxxx>
:::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip

_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux