Skip to contentSkip to conversation

vhost: zero_copy incompatible with client mode

PATCH Applied Xuan Ding 3 participants 5 messages Apr 29, 2020 – Apr 30, 2020

lore
Share & tools
lore

Xuan Ding

author
#0 lore raw

PATCH 1/1 vhost: zero_copy incompatible with client mode

In server mode, virtio-user inits under the assumption that vhost-user supports a list of features. However, this could be problematic when in_order feature is negotiated but not supported by vhost-user when enables dequeue_zero_copy later.

Add handling when vhost-user enables dequeue_zero_copy as client.

---
 lib/librte_vhost/socket.c | 6 ++++++
 1 file changed, 6 insertions(+)
lib/librte_vhost/socket.c +6 -0
index 7c8012179..bb8d0d780 100644
@@ -926,6 +926,12 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
 			ret = -1;
 			goto out_mutex;
 		}
+		if (!vsocket->is_server) {
+			VHOST_LOG_CONFIG(ERR,
+			"error: zero copy is incompatible with vhost client mode\n");
+			ret = -1;
+			goto out_mutex;
+		}
 		vsocket->supported_features &= ~(1ULL << VIRTIO_F_IN_ORDER);
 		vsocket->features &= ~(1ULL << VIRTIO_F_IN_ORDER);
 
Signature · 1 line
2.17.1
Tested-by on v1 1/1
#1 lore raw
Quoted 42 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Xuan Ding
Sent: 2020年4月29日 11:00
To: [email protected]; Wang, Zhihong <[email protected]>; Ye, Xiaolong <[email protected]>
Cc: [email protected]; Ding, Xuan <[email protected]>
Subject: [dpdk-dev] [PATCH] vhost: zero_copy incompatible with client mode

In server mode, virtio-user inits under the assumption that vhost-user supports a list of features. However, this could be problematic when in_order feature is negotiated but not supported by vhost-user when enables dequeue_zero_copy later.

Add handling when vhost-user enables dequeue_zero_copy as client.

---
 lib/librte_vhost/socket.c | 6 ++++++
 1 file changed, 6 insertions(+)
lib/librte_vhost/socket.c index renamed from lib/librte_vhost/socket.c +0 -0

7c8012179..bb8d0d780 100644

lib/librte_vhost/socket.c +6 -0
@@ -926,6 +926,12 @@ rte_vhost_driver_register(const char *path, uint64_t
 flags)
 			ret = -1;
 			goto out_mutex;
 		}
+		if (!vsocket->is_server) {
+			VHOST_LOG_CONFIG(ERR,
+			"error: zero copy is incompatible with vhost client
 mode\n");
+			ret = -1;
+			goto out_mutex;
+		}
 		vsocket->supported_features &= ~(1ULL <<

VIRTIO_F_IN_ORDER);
vsocket->features &= ~(1ULL << VIRTIO_F_IN_ORDER);

--
2.17.1

#2 lore raw

Hi Yinan,

Quoted 1 line · Yinan

Thanks for running tests on Vhost patches, that's much appreciated.

Could you provide more information on the test run?
Does it consist in reproducing the issue the patch is aiming to fix, apply patch and check issue is fixed?
Or does it consist in running a generic Vhost/Virtio test suite?

Regards,
Maxime

Quoted 43 lines
Quoted 42 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Xuan Ding
Sent: 2020年4月29日 11:00
To: [email protected]; Wang, Zhihong <[email protected]>; Ye, Xiaolong <[email protected]>
Cc: [email protected]; Ding, Xuan <[email protected]>
Subject: [dpdk-dev] [PATCH] vhost: zero_copy incompatible with client mode

In server mode, virtio-user inits under the assumption that vhost-user supports a list of features. However, this could be problematic when in_order feature is negotiated but not supported by vhost-user when enables dequeue_zero_copy later.

Add handling when vhost-user enables dequeue_zero_copy as client.

---
 lib/librte_vhost/socket.c | 6 ++++++
 1 file changed, 6 insertions(+)
lib/librte_vhost/socket.c index renamed from lib/librte_vhost/socket.c +0 -0

7c8012179..bb8d0d780 100644

lib/librte_vhost/socket.c +6 -0
@@ -926,6 +926,12 @@ rte_vhost_driver_register(const char *path, uint64_t
 flags)
 			ret = -1;
 			goto out_mutex;
 		}
+		if (!vsocket->is_server) {
+			VHOST_LOG_CONFIG(ERR,
+			"error: zero copy is incompatible with vhost client
 mode\n");
+			ret = -1;
+			goto out_mutex;
+		}
 		vsocket->supported_features &= ~(1ULL <<

VIRTIO_F_IN_ORDER);
vsocket->features &= ~(1ULL << VIRTIO_F_IN_ORDER);

--
2.17.1

#3 lore raw
In reply to Xuan Ding
Quoted 11 lines · Xuan Ding

In server mode, virtio-user inits under the assumption that vhost-user supports a list of features. However, this could be problematic when in_order feature is negotiated but not supported by vhost-user when enables dequeue_zero_copy later.

Add handling when vhost-user enables dequeue_zero_copy as client.

---
 lib/librte_vhost/socket.c | 6 ++++++
 1 file changed, 6 insertions(+)

Thanks,
Maxime

#4 lore raw
In reply to Xuan Ding
Quoted 11 lines · Xuan Ding

In server mode, virtio-user inits under the assumption that vhost-user supports a list of features. However, this could be problematic when in_order feature is negotiated but not supported by vhost-user when enables dequeue_zero_copy later.

Add handling when vhost-user enables dequeue_zero_copy as client.

---
 lib/librte_vhost/socket.c | 6 ++++++
 1 file changed, 6 insertions(+)

Applied to dpdk-next-virtio/master.

Thanks,
Maxime