Skip to contentSkip to conversation

virtio changes for 17.11-rc1

GIT PULL Yuanhan Liu 5 participants 14 messages Oct 6, 2017 – Oct 9, 2017 Network drivers

lore
Share & tools
lore
#0 lore raw

Hi Thomas,

Please consider pulling following virtio changes for 17.11-rc1 at
git://dpdk.org/next/dpdk-next-virtio master

Thanks.

	--yliu

---
Daniel Mrzyglod (1):
net/virtio: fix of untrusted scalar value

Jay Zhou (1):
net/virtio: fix a typo

Maxime Coquelin (19):
Revert "vhost: workaround MQ fails to startup"
vhost: make error handling consistent in Rx path
vhost: prepare for slave requests
vhost: add support to slave requests channel
vhost: add IOMMU-related macros for old kernels
vhost: add iotlb helper functions
vhost: iotlb: add pending miss request list and helpers
vhost-user: add support to IOTLB miss slave requests
vhost: initialize vrings IOTLB caches
vhost-user: handle IOTLB update and invalidate requests
vhost: introduce guest IOVA to backend VA helper
vhost: use the guest IOVA to host VA helper
vhost: enable rings at the right time
vhost: fix dereferencing invalid pointer after reallocation
vhost: postpone rings addresses translation
vhost-user: translate ring addresses when IOMMU enabled
vhost: postpone device creation until ring are mapped
vhost: invalidate vring in case of matching IOTLB invalidate
vhost: enable IOMMU support

Olivier Matz (10):
net/virtio: revert "do not claim to support LRO" net/virtio: revert "do not falsely claim to do IP checksum"
doc: fix description of L4 Rx checksum offload net/virtio: fix log levels in configure net/virtio: fix mbuf port for simple Rx function net/virtio: fix queue setup consistency net/virtio: rationalize setting of Rx/Tx handlers net/virtio: remove SSE check
net/virtio: keep Rx handler whatever the Tx queue config net/virtio: fix Rx handler when checksum is requested

Steven (1):
net/virtio-user: send kick notify backend on initialization

Tiwei Bie (1):
vhost: batch small guest memory copies

Zhiyong Yang (3):
net/virtio: fix the wrong indent net/virtio: use macro to replace magic number net/virtio: use pointer to replace memcpy

---
 doc/guides/nics/features.rst                |   1 +
 doc/guides/rel_notes/release_17_11.rst      |   4 +
 drivers/net/virtio/virtio_ethdev.c          | 123 ++++++++--
 drivers/net/virtio/virtio_ethdev.h          |   6 +
 drivers/net/virtio/virtio_pci.c             |   2 +-
 drivers/net/virtio/virtio_pci.h             |   3 +-
 drivers/net/virtio/virtio_rxtx.c            |  73 +++---
 drivers/net/virtio/virtio_rxtx.h            |   2 +-
 drivers/net/virtio/virtio_rxtx_simple.c     |   2 +
 drivers/net/virtio/virtio_user/vhost_user.c |   4 +
 drivers/net/virtio/virtio_user_ethdev.c     |   3 +-
 drivers/net/virtio/virtqueue.h              |   4 +-
 lib/librte_vhost/Makefile                   |   4 +-
 lib/librte_vhost/iotlb.c                    | 352 ++++++++++++++++++++++++++++
 lib/librte_vhost/iotlb.h                    |  76 ++++++
 lib/librte_vhost/vhost.c                    | 117 ++++++++-
 lib/librte_vhost/vhost.h                    |  74 +++++-
 lib/librte_vhost/vhost_user.c               | 324 ++++++++++++++++++++++---
 lib/librte_vhost/vhost_user.h               |  20 +-
 lib/librte_vhost/virtio_net.c               | 336 ++++++++++++++++++++------
 20 files changed, 1328 insertions(+), 202 deletions(-)
#1 lore raw

06/10/2017 08:45, Yuanhan Liu:

Quoted 4 lines

Hi Thomas,

Please consider pulling following virtio changes for 17.11-rc1 at
git://dpdk.org/next/dpdk-next-virtio master

What about the other virtio/vhost patches pending in patchwork?

#2 lore raw
Quoted 8 lines · Thomas Monjalon

06/10/2017 08:45, Yuanhan Liu:

Quoted 4 lines

Hi Thomas,

Please consider pulling following virtio changes for 17.11-rc1 at
git://dpdk.org/next/dpdk-next-virtio master

What about the other virtio/vhost patches pending in patchwork?

Just my 2c here, is that there is currently a lot of code merged to the *-next trees that is staged for the mainline, so whatever state it is in, I'd like to see it all pulled ASAP. That way we all can work off a common baseline.

Perhaps for the 18.02 release, we can see more frequent pulls of the subtrees, so as to avoid having unsynced patches throughout all trees?

/Bruce

#3 lore raw

06/10/2017 12:50, Bruce Richardson:

Quoted 7 lines · Thomas Monjalon
Quoted 6 lines

06/10/2017 08:45, Yuanhan Liu:

Quoted 4 lines

Hi Thomas,

Please consider pulling following virtio changes for 17.11-rc1 at
git://dpdk.org/next/dpdk-next-virtio master

Quoted 6 lines
Quoted 2 lines

What about the other virtio/vhost patches pending in patchwork?

Just my 2c here, is that there is currently a lot of code merged to the *-next trees that is staged for the mainline, so whatever state it is in, I'd like to see it all pulled ASAP. That way we all can work off a common baseline.

Yes I am going to pull them today and tomorrow.

Quoted 3 lines

Perhaps for the 18.02 release, we can see more frequent pulls of the subtrees, so as to avoid having unsynced patches throughout all trees?

Yes it was the plan to have more frequent pulls. The plans have not been respected during the last two months. That's why Ferruh will help to avoid such delay.

#4 lore raw
In reply to Thomas Monjalon
Quoted 7 lines · Thomas Monjalon

06/10/2017 08:45, Yuanhan Liu:

Quoted 4 lines

Hi Thomas,

Please consider pulling following virtio changes for 17.11-rc1 at
git://dpdk.org/next/dpdk-next-virtio master

What about the other virtio/vhost patches pending in patchwork?

Due to my bad: not reviewing them in time, they are not in this pull request. I will consider to merge them (if they are good) later (say rc2). OTOH, I just saw 6 patches are pending in my list (and 2 of them are very old, that they are not in my list for this release).

One big patchset hasn't been merged yet is the generic interface for vdev multiple process model. I still have some comments about the vhost part, thus it's not included in this pull request. It was also asked for more review about the EAL changes. Also, it may not be my duty to send merge this patchset: the core changes lie in EAL and vdev bus.

	--yliu
#5 lore raw
In reply to Yuanhan Liu

06/10/2017 08:45, Yuanhan Liu:

Quoted 4 lines

Hi Thomas,

Please consider pulling following virtio changes for 17.11-rc1 at
git://dpdk.org/next/dpdk-next-virtio master

There is a compilation error on ARM with "net/virtio: rationalize setting of Rx/Tx handlers" An include of rte_cpuflags.h is missing.

There is also an error seen by clang in
"vhost-user: add support to IOTLB miss slave requests"
implicit conversion from enumeration type 'enum VhostUserSlaveRequest' to different enumeration type 'VhostUserRequest'

This last error may be a real issue because VHOST_USER_SLAVE_IOTLB_MSG in VhostUserSlaveRequest can be understood as VHOST_USER_GET_FEATURES in VhostUserRequest.

Please advise

#6 lore raw

07/10/2017 16:37, Thomas Monjalon:

Quoted 15 lines

06/10/2017 08:45, Yuanhan Liu:

Quoted 4 lines

Hi Thomas,

Please consider pulling following virtio changes for 17.11-rc1 at
git://dpdk.org/next/dpdk-next-virtio master

There is a compilation error on ARM with "net/virtio: rationalize setting of Rx/Tx handlers" An include of rte_cpuflags.h is missing.

There is also an error seen by clang in
"vhost-user: add support to IOTLB miss slave requests"
implicit conversion from enumeration type 'enum VhostUserSlaveRequest' to different enumeration type 'VhostUserRequest'

Quoted 5 lines

This last error may be a real issue because VHOST_USER_SLAVE_IOTLB_MSG in VhostUserSlaveRequest can be understood as VHOST_USER_GET_FEATURES in VhostUserRequest.

Please advise

One more error with 32-bit compilation this time:
"vhost: postpone device creation until ring are mapped" lib/librte_vhost/vhost.c:147:13: error:
cast to pointer from integer of different size

Please work together to have a tree which can be compiled for ARM and x86, 32-bit or 64-bit, with gcc or clang.

#7 lore raw

Hi Yuanhan,

Quoted 22 lines · Thomas Monjalon

07/10/2017 16:37, Thomas Monjalon:

Quoted 15 lines

06/10/2017 08:45, Yuanhan Liu:

Quoted 4 lines

Hi Thomas,

Please consider pulling following virtio changes for 17.11-rc1 at
git://dpdk.org/next/dpdk-next-virtio master

There is a compilation error on ARM with "net/virtio: rationalize setting of Rx/Tx handlers" An include of rte_cpuflags.h is missing.

There is also an error seen by clang in
"vhost-user: add support to IOTLB miss slave requests"
implicit conversion from enumeration type 'enum VhostUserSlaveRequest' to different enumeration type 'VhostUserRequest'

Quoted 5 lines

This last error may be a real issue because VHOST_USER_SLAVE_IOTLB_MSG in VhostUserSlaveRequest can be understood as VHOST_USER_GET_FEATURES in VhostUserRequest.

Please advise

Quoted 8 lines

One more error with 32-bit compilation this time:
"vhost: postpone device creation until ring are mapped" lib/librte_vhost/vhost.c:147:13: error:
cast to pointer from integer of different size

Please work together to have a tree which can be compiled for ARM and x86, 32-bit or 64-bit, with gcc or clang.

Sorry for the 32bits compilation failure, I'll add 32bits build to my check script for next time.

Please find below the diff patch fixing these issues (build tested on both 32/64b). I can send new version of the series if you prefer. Just let me know.

Thanks,
Maxime

---------------------------------------------------------------------

lib/librte_vhost/vhost.c +1 -1
index e1f75feca..cbccf2390 100644
@@ -144,7 +144,7 @@ vring_translate(struct virtio_net *dev, struct vhost_virtqueue *vq)
                goto out;
 
        size = sizeof(struct vring_desc) * vq->size;
-       vq->desc = (struct vring_desc *)vhost_iova_to_vva(dev, vq,
+       vq->desc = (struct vring_desc *)(uintptr_t)vhost_iova_to_vva(dev, vq,
 

vq->ring_addrs.desc_user_addr,

                                                size, VHOST_ACCESS_RW);
        if (!vq->desc)

@@ -152,7 +152,7 @@ vring_translate(struct virtio_net *dev, struct vhost_virtqueue *vq)

        size = sizeof(struct vring_avail);
        size += sizeof(uint16_t) * vq->size;

- vq->avail = (struct vring_avail *)vhost_iova_to_vva(dev, vq,
+ vq->avail = (struct vring_avail *)(uintptr_t)vhost_iova_to_vva(dev, vq,

vq->ring_addrs.avail_user_addr,

                                                size, VHOST_ACCESS_RW);
        if (!vq->avail)

@@ -160,7 +160,7 @@ vring_translate(struct virtio_net *dev, struct vhost_virtqueue *vq)

        size = sizeof(struct vring_used);
        size += sizeof(struct vring_used_elem) * vq->size;

- vq->used = (struct vring_used *)vhost_iova_to_vva(dev, vq,
+ vq->used = (struct vring_used *)(uintptr_t)vhost_iova_to_vva(dev, vq,

vq->ring_addrs.used_user_addr,

                                                size, VHOST_ACCESS_RW);
        if (!vq->used)
lib/librte_vhost/vhost_user.c +3 -3
index 363e20245..a37e99d8f 100644
@@ -1017,18 +1017,18 @@ is_vring_iotlb_invalidate(struct vhost_virtqueue *vq,
        istart = imsg->iova;
        iend = istart + imsg->size - 1;
 
-       vstart = (uint64_t)vq->desc;
+       vstart = (uintptr_t)vq->desc;
        vend = vstart + sizeof(struct vring_desc) * vq->size - 1;
        if (vstart <= iend && istart <= vend)
                return 1;
 
-       vstart = (uint64_t)vq->avail;
+       vstart = (uintptr_t)vq->avail;
        vend = vstart + sizeof(struct vring_avail);
        vend += sizeof(uint16_t) * vq->size - 1;
        if (vstart <= iend && istart <= vend)
                return 1;
 
-       vstart = (uint64_t)vq->used;
+       vstart = (uintptr_t)vq->used;
        vend = vstart + sizeof(struct vring_used);
        vend += sizeof(struct vring_used_elem) * vq->size - 1;
        if (vstart <= iend && istart <= vend)
#8 lore raw
In reply to Thomas Monjalon

Hi Thomas,

Quoted 9 lines · Thomas Monjalon

06/10/2017 08:45, Yuanhan Liu:

Quoted 4 lines

Hi Thomas,

Please consider pulling following virtio changes for 17.11-rc1 at
git://dpdk.org/next/dpdk-next-virtio master

There is a compilation error on ARM with "net/virtio: rationalize setting of Rx/Tx handlers" An include of rte_cpuflags.h is missing.

I confirm that this include is missing in virtio_ethdev.c, breaking compilation on arm (thanks for spotting it):

virtio_ethdev.c: In function 'virtio_dev_configure':
virtio_ethdev.c:1748:7: error: implicit declaration of function
'rte_cpu_get_flag_enabled' [-Werror=implicit-function-declaration]

   if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_NEON)) {
        ^

Thomas, about this issue, what do you expect? I can send another patch if required.

Olivier

#9 lore raw

08/10/2017 22:10, Olivier MATZ:

Quoted 16 lines

Hi Thomas,

Quoted 9 lines · Thomas Monjalon

06/10/2017 08:45, Yuanhan Liu:

Quoted 4 lines

Hi Thomas,

Please consider pulling following virtio changes for 17.11-rc1 at
git://dpdk.org/next/dpdk-next-virtio master

There is a compilation error on ARM with "net/virtio: rationalize setting of Rx/Tx handlers" An include of rte_cpuflags.h is missing.

I confirm that this include is missing in virtio_ethdev.c, breaking compilation on arm (thanks for spotting it):

Quoted 8 lines

virtio_ethdev.c: In function 'virtio_dev_configure':
virtio_ethdev.c:1748:7: error: implicit declaration of function
'rte_cpu_get_flag_enabled' [-Werror=implicit-function-declaration]

   if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_NEON)) {
        ^

Thomas, about this issue, what do you expect? I can send another patch if required.

It can be fixed by Yuanhan in next-virtio tree.

#10 lore raw
Quoted 23 lines · Thomas Monjalon

08/10/2017 22:10, Olivier MATZ:

Quoted 22 lines

Hi Thomas,

Quoted 9 lines · Thomas Monjalon

06/10/2017 08:45, Yuanhan Liu:

Quoted 4 lines

Hi Thomas,

Please consider pulling following virtio changes for 17.11-rc1 at
git://dpdk.org/next/dpdk-next-virtio master

There is a compilation error on ARM with "net/virtio: rationalize setting of Rx/Tx handlers" An include of rte_cpuflags.h is missing.

I confirm that this include is missing in virtio_ethdev.c, breaking compilation on arm (thanks for spotting it):

virtio_ethdev.c: In function 'virtio_dev_configure':
virtio_ethdev.c:1748:7: error: implicit declaration of function
'rte_cpu_get_flag_enabled' [-Werror=implicit-function-declaration]

   if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_NEON)) {
        ^
Quoted 4 lines
Quoted 2 lines

Thomas, about this issue, what do you expect? I can send another patch if required.

It can be fixed by Yuanhan in next-virtio tree.

Yes, I will fix them and then send another pull request.

Olivier and Maxime, please confirm the following fixes.

Thanks.

	--yliu

---

drivers/net/virtio/virtio_ethdev.c +1 -0
index 9fb71e6..42c2836 100644
@@ -49,6 +49,7 @@
 #include <rte_ether.h>
 #include <rte_common.h>
 #include <rte_errno.h>
+#include <rte_cpuflags.h>
 
 #include <rte_memory.h>
 #include <rte_eal.h>
drivers/net/virtio/virtio_rxtx.c +0 -1
index 45a9c91..609b413 100644
@@ -50,7 +50,6 @@
 #include <rte_string_fns.h>
 #include <rte_errno.h>
 #include <rte_byteorder.h>
-#include <rte_cpuflags.h>
 #include <rte_net.h>
 #include <rte_ip.h>
 #include <rte_udp.h>
lib/librte_vhost/vhost_user.c +1 -1
index f891f57..207fda5 100644
@@ -1352,7 +1352,7 @@ int vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm)
 {
        int ret;
        struct VhostUserMsg msg = {
-               .request = VHOST_USER_SLAVE_IOTLB_MSG,
+               .request = (enum VhostUserRequest)VHOST_USER_SLAVE_IOTLB_MSG,
                .flags = VHOST_USER_VERSION,
                .size = sizeof(msg.payload.iotlb),
                .payload.iotlb = {
#11 lore raw
Quoted 13 lines · Yuanhan Liu

Olivier and Maxime, please confirm the following fixes.

Thanks.

	--yliu

---

lib/librte_vhost/vhost_user.c +0 -0
index f891f57..207fda5 100644

lib/librte_vhost/vhost_user.c int vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm) · line 1358

Quoted 8 lines
lib/librte_vhost/vhost_user.c +1 -1
@@ -1352,7 +1352,7 @@ int vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm)
  {
         int ret;
         struct VhostUserMsg msg = {
-               .request = VHOST_USER_SLAVE_IOTLB_MSG,
+               .request = (enum VhostUserRequest)VHOST_USER_SLAVE_IOTLB_MSG,
                 .flags = VHOST_USER_VERSION,
                 .size = sizeof(msg.payload.iotlb),
                 .payload.iotlb = {

Thanks!
Maxime

#12 lore raw
In reply to Thomas Monjalon
Quoted 10 lines · Thomas Monjalon

06/10/2017 08:45, Yuanhan Liu:

Quoted 4 lines

Hi Thomas,

Please consider pulling following virtio changes for 17.11-rc1 at
git://dpdk.org/next/dpdk-next-virtio master

There is a compilation error on ARM with "net/virtio: rationalize setting of Rx/Tx handlers" An include of rte_cpuflags.h is missing.

Quoted 8 lines

There is also an error seen by clang in
"vhost-user: add support to IOTLB miss slave requests"
implicit conversion from enumeration type 'enum VhostUserSlaveRequest' to different enumeration type 'VhostUserRequest'

This last error may be a real issue because VHOST_USER_SLAVE_IOTLB_MSG in VhostUserSlaveRequest can be understood as VHOST_USER_GET_FEATURES in VhostUserRequest.

It won't be an issue, as the vhost-user frontend can distinguish it:
the two different kind of messages are sent over by two different fd.

	--yliu
#13 lore raw
Quoted 16 lines · Yuanhan Liu
Quoted 15 lines · Thomas Monjalon

06/10/2017 08:45, Yuanhan Liu:

Quoted 4 lines

Hi Thomas,

Please consider pulling following virtio changes for 17.11-rc1 at
git://dpdk.org/next/dpdk-next-virtio master

There is a compilation error on ARM with "net/virtio: rationalize setting of Rx/Tx handlers" An include of rte_cpuflags.h is missing.

There is also an error seen by clang in
"vhost-user: add support to IOTLB miss slave requests"
implicit conversion from enumeration type 'enum VhostUserSlaveRequest' to different enumeration type 'VhostUserRequest'

Quoted 6 lines
Quoted 3 lines

This last error may be a real issue because VHOST_USER_SLAVE_IOTLB_MSG in VhostUserSlaveRequest can be understood as VHOST_USER_GET_FEATURES in VhostUserRequest.

It won't be an issue, as the vhost-user frontend can distinguish it:
the two different kind of messages are sent over by two different fd.

I agree this is not an issue.

Thanks,
Maxime