Re: [PATCH 3/4] VSOCK DRIVER: support specifying additional cids for host

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

 



Hi fuguancheng,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on vhost/linux-next]
[also build test WARNING on linus/master v5.14-rc3 next-20210730]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/fuguancheng/Add-multi-cid-support-for-vsock-driver/20210802-201017
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next
config: powerpc64-randconfig-s032-20210801 (attached as .config)
compiler: powerpc-linux-gcc (GCC) 10.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://github.com/0day-ci/linux/commit/a6cda380458b3e954d0a80cbba0e0feb36f3d797
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review fuguancheng/Add-multi-cid-support-for-vsock-driver/20210802-201017
        git checkout a6cda380458b3e954d0a80cbba0e0feb36f3d797
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=powerpc64 

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


sparse warnings: (new ones prefixed by >>)
>> drivers/vhost/vsock.c:631:64: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected unsigned int [usertype] cid @@     got restricted __le64 [usertype] src_cid @@
   drivers/vhost/vsock.c:631:64: sparse:     expected unsigned int [usertype] cid
   drivers/vhost/vsock.c:631:64: sparse:     got restricted __le64 [usertype] src_cid
>> drivers/vhost/vsock.c:1082:62: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected unsigned long long [noderef] [usertype] __user *cids @@     got unsigned long long [usertype] *[addressable] cid @@
   drivers/vhost/vsock.c:1082:62: sparse:     expected unsigned long long [noderef] [usertype] __user *cids
   drivers/vhost/vsock.c:1082:62: sparse:     got unsigned long long [usertype] *[addressable] cid
>> drivers/vhost/vsock.c:1084:55: sparse: sparse: incorrect type in argument 4 (different address spaces) @@     expected unsigned long long [noderef] [usertype] __user *hostcids @@     got unsigned long long [usertype] *[addressable] hostcid @@
   drivers/vhost/vsock.c:1084:55: sparse:     expected unsigned long long [noderef] [usertype] __user *hostcids
   drivers/vhost/vsock.c:1084:55: sparse:     got unsigned long long [usertype] *[addressable] hostcid

vim +631 drivers/vhost/vsock.c

ced7b713711fdd Arseny Krasnov     2021-06-11  573  
433fc58e6bf2c8 Asias He           2016-07-28  574  static void vhost_vsock_handle_tx_kick(struct vhost_work *work)
433fc58e6bf2c8 Asias He           2016-07-28  575  {
433fc58e6bf2c8 Asias He           2016-07-28  576  	struct vhost_virtqueue *vq = container_of(work, struct vhost_virtqueue,
433fc58e6bf2c8 Asias He           2016-07-28  577  						  poll.work);
433fc58e6bf2c8 Asias He           2016-07-28  578  	struct vhost_vsock *vsock = container_of(vq->dev, struct vhost_vsock,
433fc58e6bf2c8 Asias He           2016-07-28  579  						 dev);
433fc58e6bf2c8 Asias He           2016-07-28  580  	struct virtio_vsock_pkt *pkt;
e79b431fb901ba Jason Wang         2019-05-17  581  	int head, pkts = 0, total_len = 0;
433fc58e6bf2c8 Asias He           2016-07-28  582  	unsigned int out, in;
433fc58e6bf2c8 Asias He           2016-07-28  583  	bool added = false;
433fc58e6bf2c8 Asias He           2016-07-28  584  
433fc58e6bf2c8 Asias He           2016-07-28  585  	mutex_lock(&vq->mutex);
433fc58e6bf2c8 Asias He           2016-07-28  586  
247643f85782fc Eugenio Pérez      2020-03-31  587  	if (!vhost_vq_get_backend(vq))
433fc58e6bf2c8 Asias He           2016-07-28  588  		goto out;
433fc58e6bf2c8 Asias He           2016-07-28  589  
e13a6915a03ffc Stefano Garzarella 2020-12-23  590  	if (!vq_meta_prefetch(vq))
e13a6915a03ffc Stefano Garzarella 2020-12-23  591  		goto out;
e13a6915a03ffc Stefano Garzarella 2020-12-23  592  
433fc58e6bf2c8 Asias He           2016-07-28  593  	vhost_disable_notify(&vsock->dev, vq);
e79b431fb901ba Jason Wang         2019-05-17  594  	do {
3fda5d6e580193 Stefan Hajnoczi    2016-08-04  595  		u32 len;
3fda5d6e580193 Stefan Hajnoczi    2016-08-04  596  
433fc58e6bf2c8 Asias He           2016-07-28  597  		if (!vhost_vsock_more_replies(vsock)) {
433fc58e6bf2c8 Asias He           2016-07-28  598  			/* Stop tx until the device processes already
433fc58e6bf2c8 Asias He           2016-07-28  599  			 * pending replies.  Leave tx virtqueue
433fc58e6bf2c8 Asias He           2016-07-28  600  			 * callbacks disabled.
433fc58e6bf2c8 Asias He           2016-07-28  601  			 */
433fc58e6bf2c8 Asias He           2016-07-28  602  			goto no_more_replies;
433fc58e6bf2c8 Asias He           2016-07-28  603  		}
433fc58e6bf2c8 Asias He           2016-07-28  604  
433fc58e6bf2c8 Asias He           2016-07-28  605  		head = vhost_get_vq_desc(vq, vq->iov, ARRAY_SIZE(vq->iov),
433fc58e6bf2c8 Asias He           2016-07-28  606  					 &out, &in, NULL, NULL);
433fc58e6bf2c8 Asias He           2016-07-28  607  		if (head < 0)
433fc58e6bf2c8 Asias He           2016-07-28  608  			break;
433fc58e6bf2c8 Asias He           2016-07-28  609  
433fc58e6bf2c8 Asias He           2016-07-28  610  		if (head == vq->num) {
433fc58e6bf2c8 Asias He           2016-07-28  611  			if (unlikely(vhost_enable_notify(&vsock->dev, vq))) {
433fc58e6bf2c8 Asias He           2016-07-28  612  				vhost_disable_notify(&vsock->dev, vq);
433fc58e6bf2c8 Asias He           2016-07-28  613  				continue;
433fc58e6bf2c8 Asias He           2016-07-28  614  			}
433fc58e6bf2c8 Asias He           2016-07-28  615  			break;
433fc58e6bf2c8 Asias He           2016-07-28  616  		}
433fc58e6bf2c8 Asias He           2016-07-28  617  
433fc58e6bf2c8 Asias He           2016-07-28  618  		pkt = vhost_vsock_alloc_pkt(vq, out, in);
433fc58e6bf2c8 Asias He           2016-07-28  619  		if (!pkt) {
433fc58e6bf2c8 Asias He           2016-07-28  620  			vq_err(vq, "Faulted on pkt\n");
433fc58e6bf2c8 Asias He           2016-07-28  621  			continue;
433fc58e6bf2c8 Asias He           2016-07-28  622  		}
433fc58e6bf2c8 Asias He           2016-07-28  623  
3fda5d6e580193 Stefan Hajnoczi    2016-08-04  624  		len = pkt->len;
3fda5d6e580193 Stefan Hajnoczi    2016-08-04  625  
82dfb540aeb277 Gerard Garcia      2017-04-21  626  		/* Deliver to monitoring devices all received packets */
82dfb540aeb277 Gerard Garcia      2017-04-21  627  		virtio_transport_deliver_tap_pkt(pkt);
82dfb540aeb277 Gerard Garcia      2017-04-21  628  
433fc58e6bf2c8 Asias He           2016-07-28  629  		/* Only accept correctly addressed packets */
90d7b074bb5d51 fuguancheng        2021-08-02  630  		if (vsock->num_cid > 0 &&
bd42e1584b47d1 fuguancheng        2021-08-02 @631  			vhost_vsock_contain_cid(vsock, pkt->hdr.src_cid) &&
90d7b074bb5d51 fuguancheng        2021-08-02  632  		    le64_to_cpu(pkt->hdr.dst_cid) == vhost_transport_get_local_cid())
4c7246dc45e270 Stefano Garzarella 2019-11-14  633  			virtio_transport_recv_pkt(&vhost_transport, pkt);
433fc58e6bf2c8 Asias He           2016-07-28  634  		else
433fc58e6bf2c8 Asias He           2016-07-28  635  			virtio_transport_free_pkt(pkt);
433fc58e6bf2c8 Asias He           2016-07-28  636  
e79b431fb901ba Jason Wang         2019-05-17  637  		len += sizeof(pkt->hdr);
e79b431fb901ba Jason Wang         2019-05-17  638  		vhost_add_used(vq, head, len);
e79b431fb901ba Jason Wang         2019-05-17  639  		total_len += len;
433fc58e6bf2c8 Asias He           2016-07-28  640  		added = true;
e79b431fb901ba Jason Wang         2019-05-17  641  	} while(likely(!vhost_exceeds_weight(vq, ++pkts, total_len)));
433fc58e6bf2c8 Asias He           2016-07-28  642  
433fc58e6bf2c8 Asias He           2016-07-28  643  no_more_replies:
433fc58e6bf2c8 Asias He           2016-07-28  644  	if (added)
433fc58e6bf2c8 Asias He           2016-07-28  645  		vhost_signal(&vsock->dev, vq);
433fc58e6bf2c8 Asias He           2016-07-28  646  
433fc58e6bf2c8 Asias He           2016-07-28  647  out:
433fc58e6bf2c8 Asias He           2016-07-28  648  	mutex_unlock(&vq->mutex);
433fc58e6bf2c8 Asias He           2016-07-28  649  }
433fc58e6bf2c8 Asias He           2016-07-28  650  

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

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