Re: [PATCH 1/1] Add vhost_blk driver

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

 



Hi Vitaly,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on vhost/linux-next]
[also build test ERROR on v4.19 next-20181102]
[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/Vitaly-Mayatskikh/vhost-add-vhost_blk-driver/20181103-084141
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next
config: mips-allyesconfig (attached as .config)
compiler: mips-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=mips 

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

   drivers/vhost/blk.c: In function 'vhost_blk_iocb_complete':
>> drivers/vhost/blk.c:129:2: error: implicit declaration of function 'vhost_vq_work_queue'; did you mean 'vhost_work_queue'? [-Werror=implicit-function-declaration]
     vhost_vq_work_queue(&req->q->vq, &req->q->w);
     ^~~~~~~~~~~~~~~~~~~
     vhost_work_queue
   In file included from include/linux/kernel.h:14:0,
                    from include/linux/list.h:9,
                    from include/linux/module.h:9,
                    from drivers/vhost/blk.c:11:
   drivers/vhost/blk.c: In function 'vhost_blk_req_handle':
>> drivers/vhost/blk.c:153:12: warning: format '%ld' expects argument of type 'long int', but argument 8 has type 'ssize_t {aka int}' [-Wformat=]
      pr_debug("%s: [pid:%d %s] %s sector %lld, len %ld\n",
               ^
   include/linux/printk.h:292:21: note: in definition of macro 'pr_fmt'
    #define pr_fmt(fmt) fmt
                        ^~~
   include/linux/printk.h:340:2: note: in expansion of macro 'dynamic_pr_debug'
     dynamic_pr_debug(fmt, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~
>> drivers/vhost/blk.c:153:3: note: in expansion of macro 'pr_debug'
      pr_debug("%s: [pid:%d %s] %s sector %lld, len %ld\n",
      ^~~~~~~~
   cc1: some warnings being treated as errors

vim +129 drivers/vhost/blk.c

   118	
   119	static void vhost_blk_iocb_complete(struct kiocb *iocb, long ret, long ret2)
   120	{
   121		struct vhost_blk_req *req = container_of(iocb, struct vhost_blk_req,
   122							 iocb);
   123	
   124		pr_debug("%s vq[%d] req->index %d ret %ld ret2 %ld\n", __func__,
   125			 req->q->index, req->index, ret, ret2);
   126	
   127		req->res = (ret == req->len) ? VIRTIO_BLK_S_OK : VIRTIO_BLK_S_IOERR;
   128		llist_add(&req->list, &req->q->wl);
 > 129		vhost_vq_work_queue(&req->q->vq, &req->q->w);
   130	}
   131	
   132	static int vhost_blk_req_handle(struct vhost_blk_req *req)
   133	{
   134		struct vhost_blk *blk = req->q->blk;
   135		struct vhost_virtqueue *vq = &req->q->vq;
   136		int type = le32_to_cpu(req->hdr.type);
   137		int ret;
   138		u8 status;
   139	
   140		if ((type == VIRTIO_BLK_T_IN) || (type == VIRTIO_BLK_T_OUT)) {
   141			bool write = (type == VIRTIO_BLK_T_OUT);
   142			int nr_seg = (write ? req->out_num : req->in_num) - 1;
   143			unsigned long sector = le64_to_cpu(req->hdr.sector);
   144			ssize_t len, rem_len;
   145	
   146			if (!req->q->blk->backend) {
   147				vq_err(vq, "blk %p no backend!\n", req->q->blk);
   148				ret = -EINVAL;
   149				goto out_err;
   150			}
   151	
   152			len = iov_length(&vq->iov[1], nr_seg);
 > 153			pr_debug("%s: [pid:%d %s] %s sector %lld, len %ld\n",
   154				 __func__, current->pid, current->comm,
   155				 write ? "WRITE" : "READ", req->hdr.sector, len);
   156	
   157			req->len = len;
   158			rem_len = len;
   159			iov_iter_init(&req->i, (write ? WRITE : READ),
   160				      write ? &req->out_iov[0] : &req->in_iov[0],
   161				      nr_seg, len);
   162	
   163			req->iocb.ki_pos = sector << 9;
   164			req->iocb.ki_filp = blk->backend;
   165			req->iocb.ki_complete = vhost_blk_iocb_complete;
   166			req->iocb.ki_flags = IOCB_DIRECT;
   167	
   168			if (write)
   169				ret = call_write_iter(blk->backend, &req->iocb,
   170						      &req->i);
   171			else
   172				ret = call_read_iter(blk->backend, &req->iocb,
   173						     &req->i);
   174	
   175			if (ret != -EIOCBQUEUED)
   176				vhost_blk_iocb_complete(&req->iocb, ret, 0);
   177	
   178			ret = 0;
   179			goto out;
   180		}
   181	
   182		if (type == VIRTIO_BLK_T_GET_ID) {
   183			char s[] = "vhost_blk";
   184			size_t len = min_t(size_t, req->in_iov[0].iov_len,
   185					   strlen(s));
   186	
   187			ret = copy_to_user(req->in_iov[0].iov_base, s, len);
   188			status = ret ? VIRTIO_BLK_S_IOERR : VIRTIO_BLK_S_OK;
   189			if (put_user(status, (unsigned char __user *)req->status)) {
   190				ret = -EFAULT;
   191				goto out_err;
   192			}
   193			vhost_add_used_and_signal(&blk->dev, vq, req->index, 1);
   194			ret = 0;
   195			goto out;
   196		} else {
   197			pr_warn("Unsupported request type %d\n", type);
   198			vhost_discard_vq_desc(vq, 1);
   199			ret = -EINVAL;
   200			return ret;
   201		}
   202	out_err:
   203		vhost_discard_vq_desc(vq, 1);
   204	out:
   205		return ret;
   206	}
   207	

---
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