Skip to contentSkip to conversation

basic device IOTLB support

PATCH Superseded Jason Wang 2 participants 5 messages Jun 22, 2016

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jason Wang

author
#0 lore raw

cover basic device IOTLB support

This patch tries to implement an device IOTLB for vhost. This could be used with for co-operation with userspace IOMMU implementation (qemu) for a secure DMA environment (DMAR) in guest.

The idea is simple. When vhost meets an IOTLB miss, it will request the assistance of userspace to do the translation, this is done through:

- when there's a IOTLB miss, it will notify userspace through vhost_net fd and then userspace read the fault address, size and access from vhost fd.
- userspace write the translation result back to vhost fd, vhost can then update its IOTLB.

The codes were optimized for fixed mapping users e.g dpdk in guest. It will be slow if dynamic mappings were used in guest. We could do optimizations on top.

The codes were designed to be architecture independent. It should be easily ported to any architecture.

Stress tested with l2fwd/vfio in guest with 4K/2M/1G page size. On 1G hugepage case, 100% TLB hit rate were noticed.

Have a benchmark on this. Test was done with l2fwd in guest.For 2MB page, no difference in 64B performance and I notice a 4%-5% drop for 1500B performance compare to UIO in guest. We can add some shortcut to bypass the IOTLB for virtqueue accessing, but I think it's better to do this on top.

Changes from RFC V3:
- rebase on latest
- minor tweak on commit log
- use VHOST_ACCESS_RO instead of VHOST_ACCESS_WO in vhost_copy_from_user()
- switch to use atomic userspace access helper in vhost_get/put_user()
- remove debug codes in vhost_iotlb_miss()
- use FIFO instead of FILO when doing TLB replacement
- fix unbalanced lock in vhost_process_iotlb_msg()

Changes from RFC V2:
- introduce memory accessors for vhost
- switch from ioctls to oridinary file read/write for iotlb miss and updating
- do not assume virtqueue were virtually mapped contiguously, all virtqueue access were done throug IOTLB
- verify memory access during IOTLB update and fail early
- introduce a module parameter for the size of IOTLB

Changes from RFC V1:
- support any size/range of updating and invalidation through introducing the interval tree.
- convert from per device iotlb request to per virtqueue iotlb request, this solves the possible deadlock in V1.
- read/write permission check support.

Please review.

Jason Wang (3):
vhost: introduce vhost memory accessors
vhost: convert pre sorted vhost memory array to interval tree
vhost: device IOTLB API

 drivers/vhost/net.c        |  63 +++-
 drivers/vhost/vhost.c      | 799 +++++++++++++++++++++++++++++++++++++++------
 drivers/vhost/vhost.h      |  60 +++-
 include/uapi/linux/vhost.h |  28 ++
 4 files changed, 829 insertions(+), 121 deletions(-)
Signature · 1 line
1.8.3.1
author
#1 lore raw

PATCH 1/3 vhost: introduce vhost memory accessors

This patch introduces vhost memory accessors which were just wrappers for userspace address access helpers. This is a requirement for vhost device iotlb implementation which will add iotlb translations in those accessors.

---
 drivers/vhost/net.c   |  1 +
 drivers/vhost/vhost.c | 50 +++++++++++++++++++++++++++++++++++---------------
 2 files changed, 36 insertions(+), 15 deletions(-)
drivers/vhost/net.c +1 -0
index 1d3e45f..3893ad9 100644
@@ -987,6 +987,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
 
 		vhost_net_disable_vq(n, vq);
 		vq->private_data = sock;
+		/* FIXME: iotlb prefetch here? */
 		r = vhost_vq_init_access(vq);
 		if (r)
 			goto err_used;
drivers/vhost/vhost.c +35 -15

134 lines not on this page · raw message

Signature · 1 line
1.8.3.1
author
#2 lore raw

PATCH 2/3 vhost: convert pre sorted vhost memory array to interval tree

In reply to Jason Wang

Current pre-sorted memory region array has some limitations for future device IOTLB conversion:

1) need extra work for adding and removing a single region, and it's expected to be slow because of sorting or memory re-allocation.
2) need extra work of removing a large range which may intersect several regions with different size.
3) need trick for a replacement policy like LRU

To overcome the above shortcomings, this patch convert it to interval tree which can easily address the above issue with almost no extra work.

The patch could be used for:

- Extend the current API and only let the userspace to send diffs of memory table.
- Simplify Device IOTLB implementation.

---
 drivers/vhost/net.c   |   8 +--
 drivers/vhost/vhost.c | 182 ++++++++++++++++++++++++++++----------------------
 drivers/vhost/vhost.h |  27 ++++++--
 3 files changed, 128 insertions(+), 89 deletions(-)
drivers/vhost/net.c +4 -4
index 3893ad9..7641543 100644
@@ -1039,20 +1039,20 @@ static long vhost_net_reset_owner(struct vhost_net *n)
 	struct socket *tx_sock = NULL;
 	struct socket *rx_sock = NULL;
 	long err;
-	struct vhost_memory *memory;
+	struct vhost_umem *umem;
 
 	mutex_lock(&n->dev.mutex);
 	err = vhost_dev_check_owner(&n->dev);
 	if (err)
 		goto done;
-	memory = vhost_dev_reset_owner_prepare();
-	if (!memory) {
+	umem = vhost_dev_reset_owner_prepare();
+	if (!umem) {
 		err = -ENOMEM;
 		goto done;
 	}
 	vhost_net_stop(n, &tx_sock, &rx_sock);
 	vhost_net_flush(n);
-	vhost_dev_reset_owner(&n->dev, memory);
+	vhost_dev_reset_owner(&n->dev, umem);
 	vhost_net_vq_reset(n);
 done:
 	mutex_unlock(&n->dev.mutex);
drivers/vhost/vhost.c +101 -81

333 lines not on this page · raw message

drivers/vhost/vhost.h +23 -4
index d36d8be..b93b6a0 100644
@@ -53,6 +53,25 @@ struct vhost_log {
 	u64 len;
 };
 
+#define START(node) ((node)->start)
+#define LAST(node) ((node)->last)
+
+struct vhost_umem_node {
+	struct rb_node rb;
+	struct list_head link;
+	__u64 start;
+	__u64 last;
+	__u64 size;
+	__u64 userspace_addr;
+	__u64 flags_padding;
+	__u64 __subtree_last;
+};
+
+struct vhost_umem {
+	struct rb_root umem_tree;
+	struct list_head umem_list;
+};
+
 /* The virtqueue structure describes a queue attached to a device. */
 struct vhost_virtqueue {
 	struct vhost_dev *dev;
@@ -101,7 +120,7 @@ struct vhost_virtqueue {
 	struct iovec *indirect;
 	struct vring_used_elem *heads;
 	/* Protected by virtqueue mutex. */
-	struct vhost_memory *memory;
+	struct vhost_umem *umem;
 	void *private_data;
 	u64 acked_features;
 	/* Log write descriptors */
@@ -119,7 +138,6 @@ struct vhost_virtqueue {
 };
 
 struct vhost_dev {
-	struct vhost_memory *memory;
 	struct mm_struct *mm;
 	struct mutex mutex;
 	struct vhost_virtqueue **vqs;
@@ -129,14 +147,15 @@ struct vhost_dev {
 	spinlock_t work_lock;
 	struct list_head work_list;
 	struct task_struct *worker;
+	struct vhost_umem *umem;
 };
 
 void vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs, int nvqs);
 long vhost_dev_set_owner(struct vhost_dev *dev);
 bool vhost_dev_has_owner(struct vhost_dev *dev);
 long vhost_dev_check_owner(struct vhost_dev *);
-struct vhost_memory *vhost_dev_reset_owner_prepare(void);
-void vhost_dev_reset_owner(struct vhost_dev *, struct vhost_memory *);
+struct vhost_umem *vhost_dev_reset_owner_prepare(void);
+void vhost_dev_reset_owner(struct vhost_dev *, struct vhost_umem *);
 void vhost_dev_cleanup(struct vhost_dev *, bool locked);
 void vhost_dev_stop(struct vhost_dev *);
 long vhost_dev_ioctl(struct vhost_dev *, unsigned int ioctl, void __user *argp);
Signature · 1 line
1.8.3.1
author
#3 lore raw

PATCH 3/3 vhost: device IOTLB API

In reply to Jason Wang

This patch tries to implement an device IOTLB for vhost. This could be used with for co-operation with userspace(qemu) implementation of DMA remapping.

The idea is simple, cache the translation in a software device IOTLB (which was implemented as interval tree) in vhost and use vhost_net file descriptor for reporting IOTLB miss and IOTLB update/invalidation. When vhost meets an IOTLB miss, the fault address, size and access could be read from the file. After userspace finishes the translation, it write the translated address to the vhost_net file to update the device IOTLB.

When device IOTLB (VHOST_F_DEVICE_IOTLB) is enabled all vq address set by ioctl were treated as iova instead of virtual address and the accessing could only be done through IOTLB instead of direct userspace memory access. Before each rounds or vq processing, all vq metadata were prefetched in device IOTLB to make sure no translation fault happens during vq processing.

In most cases, virtqueue were mapped contiguous even in virtual address. So the IOTLB translation for virtqueue itself maybe a little bit slower. We can add fast path on top of this patch.

---
 drivers/vhost/net.c        |  54 +++-
 drivers/vhost/vhost.c      | 627 ++++++++++++++++++++++++++++++++++++++++++---
 drivers/vhost/vhost.h      |  35 ++-
 include/uapi/linux/vhost.h |  28 ++
 4 files changed, 696 insertions(+), 48 deletions(-)
drivers/vhost/net.c +50 -4
index 7641543..7ceea39 100644
@@ -61,7 +61,8 @@ MODULE_PARM_DESC(experimental_zcopytx, "Enable Zero Copy TX;"
 enum {
 	VHOST_NET_FEATURES = VHOST_FEATURES |
 			 (1ULL << VHOST_NET_F_VIRTIO_NET_HDR) |
-			 (1ULL << VIRTIO_NET_F_MRG_RXBUF)
+			 (1ULL << VIRTIO_NET_F_MRG_RXBUF) |
+			 (1ULL << VHOST_F_DEVICE_IOTLB)
 };
 
 enum {
@@ -334,7 +335,8 @@ static int vhost_net_tx_get_vq_desc(struct vhost_net *net,
 {
 	unsigned long uninitialized_var(endtime);
 	int r = vhost_get_vq_desc(vq, vq->iov, ARRAY_SIZE(vq->iov),
-				    out_num, in_num, NULL, NULL);
+				  out_num, in_num, NULL, NULL,
+				  VHOST_ACCESS_RO);
 
 	if (r == vq->num && vq->busyloop_timeout) {
 		preempt_disable();
@@ -344,7 +346,8 @@ static int vhost_net_tx_get_vq_desc(struct vhost_net *net,
 			cpu_relax_lowlatency();
 		preempt_enable();
 		r = vhost_get_vq_desc(vq, vq->iov, ARRAY_SIZE(vq->iov),
-					out_num, in_num, NULL, NULL);
+				      out_num, in_num, NULL, NULL,
+				      VHOST_ACCESS_RO);
 	}
 
 	return r;
@@ -377,6 +380,9 @@ static void handle_tx(struct vhost_net *net)
 	if (!sock)
 		goto out;
 
+	if (!vq_iotlb_prefetch(vq))
+		goto out;
+
 	vhost_disable_notify(&net->dev, vq);
 
 	hdr_size = nvq->vhost_hlen;
@@ -564,7 +570,7 @@ static int get_rx_bufs(struct vhost_virtqueue *vq,
 		}
 		r = vhost_get_vq_desc(vq, vq->iov + seg,
 				      ARRAY_SIZE(vq->iov) - seg, &out,
-				      &in, log, log_num);
+				      &in, log, log_num, VHOST_ACCESS_WO);
 		if (unlikely(r < 0))
 			goto err;
 
@@ -638,6 +644,10 @@ static void handle_rx(struct vhost_net *net)
 	sock = vq->private_data;
 	if (!sock)
 		goto out;
+
+	if (!vq_iotlb_prefetch(vq))
+		goto out;
+
 	vhost_disable_notify(&net->dev, vq);
 	vhost_net_disable_vq(net, vq);
 
@@ -1087,6 +1097,11 @@ static int vhost_net_set_features(struct vhost_net *n, u64 features)
 		mutex_unlock(&n->dev.mutex);
 		return -EFAULT;
 	}
+	if ((features & (1ULL << VHOST_F_DEVICE_IOTLB))) {
+		if (vhost_init_device_iotlb(&n->dev, true))
+			return -EFAULT;
+	}
+
 	for (i = 0; i < VHOST_NET_VQ_MAX; ++i) {
 		mutex_lock(&n->vqs[i].vq.mutex);
 		n->vqs[i].vq.acked_features = features;
@@ -1169,9 +1184,40 @@ static long vhost_net_compat_ioctl(struct file *f, unsigned int ioctl,
 }
 #endif
 
+static ssize_t vhost_net_chr_read_iter(struct kiocb *iocb, struct iov_iter *to)
+{
+	struct file *file = iocb->ki_filp;
+	struct vhost_net *n = file->private_data;
+	struct vhost_dev *dev = &n->dev;
+	int noblock = file->f_flags & O_NONBLOCK;
+
+	return vhost_chr_read_iter(dev, to, noblock);
+}
+
+static ssize_t vhost_net_chr_write_iter(struct kiocb *iocb,
+					struct iov_iter *from)
+{
+	struct file *file = iocb->ki_filp;
+	struct vhost_net *n = file->private_data;
+	struct vhost_dev *dev = &n->dev;
+
+	return vhost_chr_write_iter(dev, from);
+}
+
+static unsigned int vhost_net_chr_poll(struct file *file, poll_table *wait)
+{
+	struct vhost_net *n = file->private_data;
+	struct vhost_dev *dev = &n->dev;
+
+	return vhost_chr_poll(file, dev, wait);
+}
+
 static const struct file_operations vhost_net_fops = {
 	.owner          = THIS_MODULE,
 	.release        = vhost_net_release,
+	.read_iter      = vhost_net_chr_read_iter,
+	.write_iter     = vhost_net_chr_write_iter,
+	.poll           = vhost_net_chr_poll,
 	.unlocked_ioctl = vhost_net_ioctl,
 #ifdef CONFIG_COMPAT
 	.compat_ioctl   = vhost_net_compat_ioctl,
drivers/vhost/vhost.c +585 -42

818 lines not on this page · raw message

drivers/vhost/vhost.h +33 -2
index b93b6a0..85c1d78 100644
@@ -63,13 +63,15 @@ struct vhost_umem_node {
 	__u64 last;
 	__u64 size;
 	__u64 userspace_addr;
-	__u64 flags_padding;
+	__u32 perm;
+	__u32 flags_padding;
 	__u64 __subtree_last;
 };
 
 struct vhost_umem {
 	struct rb_root umem_tree;
 	struct list_head umem_list;
+	int numem;
 };
 
 /* The virtqueue structure describes a queue attached to a device. */
@@ -117,10 +119,12 @@ struct vhost_virtqueue {
 	u64 log_addr;
 
 	struct iovec iov[UIO_MAXIOV];
+	struct iovec iotlb_iov[64];
 	struct iovec *indirect;
 	struct vring_used_elem *heads;
 	/* Protected by virtqueue mutex. */
 	struct vhost_umem *umem;
+	struct vhost_umem *iotlb;
 	void *private_data;
 	u64 acked_features;
 	/* Log write descriptors */
@@ -137,6 +141,12 @@ struct vhost_virtqueue {
 	u32 busyloop_timeout;
 };
 
+struct vhost_msg_node {
+  struct vhost_msg msg;
+  struct vhost_virtqueue *vq;
+  struct list_head node;
+};
+
 struct vhost_dev {
 	struct mm_struct *mm;
 	struct mutex mutex;
@@ -148,6 +158,11 @@ struct vhost_dev {
 	struct list_head work_list;
 	struct task_struct *worker;
 	struct vhost_umem *umem;
+	struct vhost_umem *iotlb;
+	spinlock_t iotlb_lock;
+	struct list_head read_list;
+	struct list_head pending_list;
+	wait_queue_head_t wait;
 };
 
 void vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs, int nvqs);
@@ -166,7 +181,8 @@ int vhost_log_access_ok(struct vhost_dev *);
 int vhost_get_vq_desc(struct vhost_virtqueue *,
 		      struct iovec iov[], unsigned int iov_count,
 		      unsigned int *out_num, unsigned int *in_num,
-		      struct vhost_log *log, unsigned int *log_num);
+		      struct vhost_log *log, unsigned int *log_num,
+		      int access);
 void vhost_discard_vq_desc(struct vhost_virtqueue *, int n);
 
 int vhost_vq_init_access(struct vhost_virtqueue *);
@@ -184,6 +200,21 @@ bool vhost_enable_notify(struct vhost_dev *, struct vhost_virtqueue *);
 
 int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log,
 		    unsigned int log_num, u64 len);
+int vq_iotlb_prefetch(struct vhost_virtqueue *vq);
+
+struct vhost_msg_node *vhost_new_msg(struct vhost_virtqueue *vq, int type);
+void vhost_enqueue_msg(struct vhost_dev *dev,
+		       struct list_head *head,
+		       struct vhost_msg_node *node);
+struct vhost_msg_node *vhost_dequeue_msg(struct vhost_dev *dev,
+					 struct list_head *head);
+unsigned int vhost_chr_poll(struct file *file, struct vhost_dev *dev,
+			    poll_table *wait);
+ssize_t vhost_chr_read_iter(struct vhost_dev *dev, struct iov_iter *to,
+			    int noblock);
+ssize_t vhost_chr_write_iter(struct vhost_dev *dev,
+			     struct iov_iter *from);
+int vhost_init_device_iotlb(struct vhost_dev *d, bool enabled);
 
 #define vq_err(vq, fmt, ...) do {                                  \
 		pr_debug(pr_fmt(fmt), ##__VA_ARGS__);       \
include/uapi/linux/vhost.h +28 -0
index 61a8777..8cb0a65 100644
@@ -47,6 +47,32 @@ struct vhost_vring_addr {
 	__u64 log_guest_addr;
 };
 
+/* no alignment requirement */
+struct vhost_iotlb_msg {
+	__u64 iova;
+	__u64 size;
+	__u64 uaddr;
+#define VHOST_ACCESS_RO      0x1
+#define VHOST_ACCESS_WO      0x2
+#define VHOST_ACCESS_RW      0x3
+	__u8 perm;
+#define VHOST_IOTLB_MISS           1
+#define VHOST_IOTLB_UPDATE         2
+#define VHOST_IOTLB_INVALIDATE     3
+#define VHOST_IOTLB_ACCESS_FAIL    4
+	__u8 type;
+};
+
+#define VHOST_IOTLB_MSG 0x1
+
+struct vhost_msg {
+	int type;
+	union {
+		struct vhost_iotlb_msg iotlb;
+		__u8 padding[64];
+	};
+};
+
 struct vhost_memory_region {
 	__u64 guest_phys_addr;
 	__u64 memory_size; /* bytes */
@@ -146,6 +172,8 @@ struct vhost_memory {
 #define VHOST_F_LOG_ALL 26
 /* vhost-net should add virtio_net_hdr for RX, and strip for TX packets. */
 #define VHOST_NET_F_VIRTIO_NET_HDR 27
+/* Vhost have device IOTLB */
+#define VHOST_F_DEVICE_IOTLB 63
 
 /* VHOST_SCSI specific definitions */
 
Signature · 1 line
1.8.3.1
#4 lore raw

Re: [PATCH 3/3] vhost: device IOTLB API

url: https://github.com/0day-ci/linux/commits/Jason-Wang/basic-device-IOTLB-support/20160622-175522 config: i386-allmodconfig (attached as .config) compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430…

Hi,

[auto build test ERROR on next-20160622]
[also build test ERROR on v4.7-rc4]
[cannot apply to vhost/linux-next v4.7-rc4 v4.7-rc3 v4.7-rc2]
[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/Jason-Wang/basic-device-IOTLB-support/20160622-175522
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:

        # save the attached .config to linux build tree
        make ARCH=i386 

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

gcc-6: warning: '-mcpu=' is deprecated; use '-mtune=' or '-march=' instead drivers/vhost/vhost.c: In function 'vhost_copy_to_user':

>> drivers/vhost/vhost.c:742:28: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      ret = translate_desc(vq, (u64)to, size, vq->iotlb_iov,
                               ^
   drivers/vhost/vhost.c: In function 'vhost_copy_from_user':
   drivers/vhost/vhost.c:771:28: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      ret = translate_desc(vq, (u64)from, size, vq->iotlb_iov,
                               ^
   In file included from include/linux/printk.h:289:0,
                    from include/linux/kernel.h:13,
                    from include/linux/list.h:8,
                    from include/linux/wait.h:6,
                    from include/linux/eventfd.h:12,
                    from drivers/vhost/vhost.c:14:
   drivers/vhost/vhost.c:777:11: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
              (unsigned long long) from,
              ^
   include/linux/dynamic_debug.h:127:10: note: in definition of macro 'dynamic_pr_debug'
           ##__VA_ARGS__);  \
             ^~~~~~~~~~~
>> drivers/vhost/vhost.h:220:3: note: in expansion of macro 'pr_debug'
      pr_debug(pr_fmt(fmt), ##__VA_ARGS__);       \
      ^~~~~~~~
>> drivers/vhost/vhost.c:775:4: note: in expansion of macro 'vq_err'
       vq_err(vq, "IOTLB translation failure: uaddr "
       ^~~~~~
   drivers/vhost/vhost.c: In function '__vhost_get_user':
   drivers/vhost/vhost.c:802:27: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     ret = translate_desc(vq, (u64)addr, size, vq->iotlb_iov,
                              ^
   In file included from include/linux/printk.h:289:0,
                    from include/linux/kernel.h:13,
                    from include/linux/list.h:8,
                    from include/linux/wait.h:6,
                    from include/linux/eventfd.h:12,
                    from drivers/vhost/vhost.c:14:
   drivers/vhost/vhost.c:808:4: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
       (unsigned long long) addr,
       ^
   include/linux/dynamic_debug.h:127:10: note: in definition of macro 'dynamic_pr_debug'
           ##__VA_ARGS__);  \
             ^~~~~~~~~~~
>> drivers/vhost/vhost.h:220:3: note: in expansion of macro 'pr_debug'
      pr_debug(pr_fmt(fmt), ##__VA_ARGS__);       \
      ^~~~~~~~
   drivers/vhost/vhost.c:806:3: note: in expansion of macro 'vq_err'
      vq_err(vq, "IOTLB translation failure: uaddr "
      ^~~~~~
   drivers/vhost/vhost.c:816:4: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
       (unsigned long long) addr,
       ^
   include/linux/dynamic_debug.h:127:10: note: in definition of macro 'dynamic_pr_debug'
           ##__VA_ARGS__);  \
             ^~~~~~~~~~~
>> drivers/vhost/vhost.h:220:3: note: in expansion of macro 'pr_debug'
      pr_debug(pr_fmt(fmt), ##__VA_ARGS__);       \
      ^~~~~~~~
   drivers/vhost/vhost.c:814:3: note: in expansion of macro 'vq_err'
      vq_err(vq, "Non atomic userspace memory access: uaddr "
      ^~~~~~
   drivers/vhost/vhost.c: In function 'vq_iotlb_prefetch':
   drivers/vhost/vhost.c:1144:46: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     return iotlb_access_ok(vq, VHOST_ACCESS_RO, (u64)vq->desc,
                                                 ^
   drivers/vhost/vhost.c:1146:46: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
            iotlb_access_ok(vq, VHOST_ACCESS_RO, (u64)vq->avail,
                                                 ^
   drivers/vhost/vhost.c:1149:46: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
            iotlb_access_ok(vq, VHOST_ACCESS_WO, (u64)vq->used,
                                                 ^
   In file included from include/linux/printk.h:289:0,
                    from include/linux/kernel.h:13,
                    from include/linux/list.h:8,
                    from include/linux/wait.h:6,
                    from include/linux/eventfd.h:12,
                    from drivers/vhost/vhost.c:14:
   drivers/vhost/vhost.c: In function 'vhost_vq_init_access':
   drivers/vhost/vhost.c:1737:4: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
       (unsigned long long) &vq->used->idx);
       ^
   include/linux/dynamic_debug.h:127:10: note: in definition of macro 'dynamic_pr_debug'
           ##__VA_ARGS__);  \
             ^~~~~~~~~~~
>> drivers/vhost/vhost.h:220:3: note: in expansion of macro 'pr_debug'
      pr_debug(pr_fmt(fmt), ##__VA_ARGS__);       \
      ^~~~~~~~
   drivers/vhost/vhost.c:1736:3: note: in expansion of macro 'vq_err'
      vq_err(vq, "Can't access used idx at 0x%llx\n",
      ^~~~~~

gcc-6: warning: '-mcpu=' is deprecated; use '-mtune=' or '-march=' instead
--
gcc-6: warning: '-mcpu=' is deprecated; use '-mtune=' or '-march=' instead drivers/vhost/scsi.c: In function 'vhost_scsi_do_evt_work':

>> drivers/vhost/scsi.c:460:9: error: too few arguments to function 'vhost_get_vq_desc'
     head = vhost_get_vq_desc(vq, vq->iov,
            ^~~~~~~~~~~~~~~~~
   In file included from drivers/vhost/scsi.c:51:0:
   drivers/vhost/vhost.h:181:5: note: declared here
    int vhost_get_vq_desc(struct vhost_virtqueue *,
        ^~~~~~~~~~~~~~~~~
   drivers/vhost/scsi.c: In function 'vhost_scsi_handle_vq':
   drivers/vhost/scsi.c:867:10: error: too few arguments to function 'vhost_get_vq_desc'
      head = vhost_get_vq_desc(vq, vq->iov,
             ^~~~~~~~~~~~~~~~~

In file included from drivers/vhost/scsi.c:51:0:
drivers/vhost/vhost.h:181:5: note: declared here
int vhost_get_vq_desc(struct vhost_virtqueue *,
^~~~~~~~~~~~~~~~~

vim +/vhost_get_vq_desc +460 drivers/vhost/scsi.c

a6c9af87 drivers/vhost/tcm_vhost.c Asias He           2013-04-25  454  		vs->vs_events_missed = true;
a6c9af87 drivers/vhost/tcm_vhost.c Asias He           2013-04-25  455  		return;
a6c9af87 drivers/vhost/tcm_vhost.c Asias He           2013-04-25  456  	}
a6c9af87 drivers/vhost/tcm_vhost.c Asias He           2013-04-25  457  
a6c9af87 drivers/vhost/tcm_vhost.c Asias He           2013-04-25  458  again:
a6c9af87 drivers/vhost/tcm_vhost.c Asias He           2013-04-25  459  	vhost_disable_notify(&vs->dev, vq);
47283bef drivers/vhost/scsi.c      Michael S. Tsirkin 2014-06-05 @460  	head = vhost_get_vq_desc(vq, vq->iov,
a6c9af87 drivers/vhost/tcm_vhost.c Asias He           2013-04-25  461  			ARRAY_SIZE(vq->iov), &out, &in,
a6c9af87 drivers/vhost/tcm_vhost.c Asias He           2013-04-25  462  			NULL, NULL);
a6c9af87 drivers/vhost/tcm_vhost.c Asias He           2013-04-25  463  	if (head < 0) {

:::::: The code at line 460 was first introduced by commit
:::::: 47283bef7ed356629467d1fac61687756e48f254 vhost: move memory pointer to VQs

:::::: TO: Michael S. Tsirkin <[email protected]>
:::::: CC: Michael S. Tsirkin <[email protected]>

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

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization