virtio-user: fix virtio-user server mode
v2 cover virtio-user: fix virtio-user server mode
This series addresses some issues identified in the virtio-user driver when configured in server mode.
Firstly, properly identify the backend type in this mode.
Secondly, ensure no get/set status commands are sent before protocol feature negotiation to avoid sending them to a backend that does not support them
And finally, add get/set status as per virtio spec so that it can work with modern vhost-user backends that rely on this message to start the device.
--v1->v2:
Added patch 2 and 3 addressing additional issues
Check errno to select vhost-user backend and log the detected backend type
Adrian Moreno (3):
virtio-user: fix backend selection if stat fails
virtio_user: don't set/get_status until FEATURES_OK
virtio-user: set status on virtio-user reconnect
drivers/net/virtio/virtio_user/vhost_user.c | 10 ++++++---- .../net/virtio/virtio_user/virtio_user_dev.c | 7 +++++++ .../net/virtio/virtio_user/virtio_user_dev.h | 1 + drivers/net/virtio/virtio_user_ethdev.c | 20 ++++++++++++++++--- 4 files changed, 31 insertions(+), 7 deletions(-)
Signature · 1 line
2.26.2
PATCH v2 1/3 virtio-user: fix backend selection if stat fails
If stat fails because the file does not exist, it means that the backend must be vhost-user in server mode.
Also, log the detected backend type.
Bugzilla ID: 559
--- drivers/net/virtio/virtio_user/virtio_user_dev.c | 7 +++++++ drivers/net/virtio/virtio_user/virtio_user_dev.h | 1 + drivers/net/virtio/virtio_user_ethdev.c | 6 +++++- 3 files changed, 13 insertions(+), 1 deletion(-)
drivers/net/virtio/virtio_user/virtio_user_dev.c +7 -0
@@ -22,6 +22,13 @@#define VIRTIO_USER_MEM_EVENT_CLB_NAME "virtio_user_mem_event_clb" +const char *const virtio_user_backend_strings[] = { + [VIRTIO_USER_BACKEND_UNKNOWN ] ="VIRTIO_USER_BACKEND_UNKNOWN" , + [VIRTIO_USER_BACKEND_VHOST_USER ] ="VHOST_USER" , + [VIRTIO_USER_BACKEND_VHOST_KERNEL ] ="VHOST_NET" , + [VIRTIO_USER_BACKEND_VHOST_VDPA ] ="VHOST_VDPA" , +}; +static int virtio_user_create_queue (struct virtio_user_dev *dev,uint32_t queue_sel) {
drivers/net/virtio/virtio_user/virtio_user_dev.h +1 -0
@@ -83,4 +83,5 @@ void virtio_user_handle_cq_packed(struct virtio_user_dev *dev,uint8_t virtio_user_handle_mq (struct virtio_user_dev *dev,uint16_t q_pairs);int virtio_user_send_status_update (struct virtio_user_dev *dev,uint8_t status);int virtio_user_update_status (struct virtio_user_dev *dev); +extern const char *const virtio_user_backend_strings[];#endif
drivers/net/virtio/virtio_user_ethdev.c +5 -1
@@ -560,6 +560,9 @@ virtio_user_backend_type(const char *path)struct stat sb;if (stat (path, &sb) ==-1 ) { +if (errno ==ENOENT ) +return VIRTIO_USER_BACKEND_VHOST_USER ; +PMD_INIT_LOG (ERR ,"Stat fails: %s (%s)\n" , path,strerror (errno));return VIRTIO_USER_BACKEND_UNKNOWN ;
@@ -697,7 +700,8 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev) path); goto end; } - +PMD_INIT_LOG (INFO ,"Backend type detected: %s" , + virtio_user_backend_strings[backend_type]);if (rte_kvargs_count (kvlist,VIRTIO_USER_ARG_INTERFACE_NAME ) ==1 ) {if (backend_type !=VIRTIO_USER_BACKEND_VHOST_KERNEL ) {
Signature · 1 line
2.26.2
Re: [dpdk-dev] [PATCH v2 1/3] virtio-user: fix backend selection if stat fails
Quoted 9 lines · Adrian Moreno
If stat fails because the file does not exist, it means that the backend must be vhost-user in server mode.
Also, log the detected backend type.
Bugzilla ID: 559
Fixes f908b22ea47a ("net/virtio: move backend type selection to ethdev")
Quoted 7 lines
Signed-off-by Adrian Moreno <[email protected]>--- drivers/net/virtio/virtio_user/virtio_user_dev.c | 7 +++++++ drivers/net/virtio/virtio_user/virtio_user_dev.h | 1 + drivers/net/virtio/virtio_user_ethdev.c | 6 +++++- 3 files changed, 13 insertions(+), 1 deletion(-)
Thanks,
Maxime
Re: [dpdk-dev] [PATCH v2 1/3] virtio-user: fix backend selection if stat fails
In reply to Adrian MorenoQuoted 9 lines · Adrian Moreno
If stat fails because the file does not exist, it means that the backend must be vhost-user in server mode.
Also, log the detected backend type.
Bugzilla ID: 559
Fixes f908b22ea47a ("net/virtio: move backend type selection to ethdev")
Quoted 6 lines
Signed-off-by Adrian Moreno <[email protected]>--- drivers/net/virtio/virtio_user/virtio_user_dev.c | 7 +++++++ drivers/net/virtio/virtio_user/virtio_user_dev.h | 1 + drivers/net/virtio/virtio_user_ethdev.c | 6 +++++- 3 files changed, 13 insertions(+), 1 deletion(-)
PATCH v2 2/3 virtio_user: don't set/get_status until FEATURES_OK
In reply to Adrian MorenoAccording to the virtio spec, ACK and DRIVER status bits should be set before feature negotiation.
However, until the protocol features are negotiated, the driver does not know if the device actually supports the those vhost-user messages. Therefore, until FEATURES_OK is set, the GET/SET_STATUS messages should not be sent.
--- drivers/net/virtio/virtio_user/vhost_user.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/virtio/virtio_user/vhost_user.c +6 -4
@@ -278,8 +278,9 @@ vhost_user_sock(struct virtio_user_dev *dev,switch (req) {case VHOST_USER_GET_STATUS : -if (!(dev->protocol_features & - (1ULL <<VHOST_USER_PROTOCOL_F_STATUS ))) +if (!(dev->status &VIRTIO_CONFIG_STATUS_FEATURES_OK ) || + (!(dev->protocol_features & + (1ULL <<VHOST_USER_PROTOCOL_F_STATUS ))))return 0 ;/* Fallthrough */ case VHOST_USER_GET_FEATURES :
@@ -288,8 +289,9 @@ vhost_user_sock(struct virtio_user_dev *dev,break ;case VHOST_USER_SET_STATUS : -if (!(dev->protocol_features & - (1ULL <<VHOST_USER_PROTOCOL_F_STATUS ))) +if (!(dev->status &VIRTIO_CONFIG_STATUS_FEATURES_OK ) || + (!(dev->protocol_features & + (1ULL <<VHOST_USER_PROTOCOL_F_STATUS ))))return 0 ;if (has_reply_ack)
Signature · 1 line
2.26.2
Re: [dpdk-dev] [PATCH v2 2/3] virtio_user: don't set/get_status until FEATURES_OK
Quoted 5 lines · Adrian Moreno
According to the virtio spec, ACK and DRIVER status bits should be set before feature negotiation.
However, until the protocol features are negotiated, the driver does not know if the device actually supports the those vhost-user messages.
s/the those/those/
Quoted 31 lines
Therefore, until
FEATURES_OKis set, the GET/SET_STATUS messages should not be sent.Fixes 57912824615f ("net/virtio-user: support vhost status setting")Signed-off-by Adrian Moreno <[email protected]>--- drivers/net/virtio/virtio_user/vhost_user.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)drivers/net/virtio/virtio_user/vhost_user.c +3
-2@@ -278,8 +278,9 @@ vhost_user_sock(struct virtio_user_dev *dev,switch (req) {case VHOST_USER_GET_STATUS : -if (!(dev->protocol_features & - (1ULL <<VHOST_USER_PROTOCOL_F_STATUS ))) +if (!(dev->status &VIRTIO_CONFIG_STATUS_FEATURES_OK ) || + (!(dev->protocol_features & + (1ULL <<VHOST_USER_PROTOCOL_F_STATUS ))))return 0 ;/* Fallthrough */ case VHOST_USER_GET_FEATURES :@@ -288,8 +289,9 @@ vhost_user_sock(struct virtio_user_dev *dev,break ;
drivers/net/virtio/virtio_user/vhost_user.c vhost_user_sock(struct virtio_user_dev *dev, · line 297
Quoted 10 lines
drivers/net/virtio/virtio_user/vhost_user.c +3
-2case VHOST_USER_SET_STATUS : -if (!(dev->protocol_features & - (1ULL <<VHOST_USER_PROTOCOL_F_STATUS ))) +if (!(dev->status &VIRTIO_CONFIG_STATUS_FEATURES_OK ) || + (!(dev->protocol_features & + (1ULL <<VHOST_USER_PROTOCOL_F_STATUS ))))return 0 ;if (has_reply_ack)
Thanks,
Maxime
PATCH v2 3/3 virtio-user: set status on virtio-user reconnect
In reply to Adrian MorenoNewer vhost-user backends will rely on SET_STATUS to start the device so this required to support them.
--- drivers/net/virtio/virtio_user_ethdev.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/net/virtio/virtio_user_ethdev.c +12 -2
@@ -78,6 +78,13 @@ virtio_user_server_reconnect(struct virtio_user_dev *dev)return -1 ; dev->vhostfd = connectfd; + +vtpci_reset (hw); + +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_ACK ); + +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_DRIVER ); +if (dev->ops->send_request (dev,VHOST_USER_GET_FEATURES , &dev->device_features) <0 ) { PMD_INIT_LOG(ERR, "get_features failed: %s",
@@ -111,6 +118,8 @@ virtio_user_server_reconnect(struct virtio_user_dev *dev) dev->features &= dev->device_features; +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_FEATURES_OK ); +/* For packed ring, resetting queues is required in reconnection. */ if (vtpci_packed_queue (hw) && (vtpci_get_status (hw) &VIRTIO_CONFIG_STATUS_DRIVER_OK )) {
@@ -119,8 +128,9 @@ virtio_user_server_reconnect(struct virtio_user_dev *dev)virtio_user_reset_queues_packed (eth_dev); } - ret =virtio_user_start_device (dev); -if (ret <0 ) +/* Start the device */ +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_DRIVER_OK ); +if (!dev->started)return -1 ;if (dev->queue_pairs >1 ) {
Signature · 1 line
2.26.2
Re: [dpdk-dev] [PATCH v2 3/3] virtio-user: set status on virtio-user reconnect
Quoted 42 lines · Adrian Moreno
Newer vhost-user backends will rely on
SET_STATUSto start the device so this required to support them.Fixes 57912824615f ("net/virtio-user: support vhost status setting")Signed-off-by Adrian Moreno <[email protected]>--- drivers/net/virtio/virtio_user_ethdev.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)drivers/net/virtio/virtio_user_ethdev.c +9
-0@@ -78,6 +78,13 @@ virtio_user_server_reconnect(struct virtio_user_dev *dev)return -1 ; dev->vhostfd = connectfd; + +vtpci_reset (hw); + +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_ACK ); + +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_DRIVER ); +if (dev->ops->send_request (dev,VHOST_USER_GET_FEATURES , &dev->device_features) <0 ) { PMD_INIT_LOG(ERR, "get_features failed: %s",@@ -111,6 +118,8 @@ virtio_user_server_reconnect(struct virtio_user_dev *dev) dev->features &= dev->device_features; +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_FEATURES_OK ); +/* For packed ring, resetting queues is required in reconnection. */ if (vtpci_packed_queue (hw) && (vtpci_get_status (hw) &VIRTIO_CONFIG_STATUS_DRIVER_OK )) {@@ -119,8 +128,9 @@ virtio_user_server_reconnect(struct virtio_user_dev *dev)virtio_user_reset_queues_packed (eth_dev);
drivers/net/virtio/virtio_user_ethdev.c virtio_user_server_reconnect(struct virtio_user_dev *dev) · line 136
Quoted 10 lines
drivers/net/virtio/virtio_user_ethdev.c +3
-2} - ret =virtio_user_start_device (dev); -if (ret <0 ) +/* Start the device */ +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_DRIVER_OK ); +if (!dev->started)return -1 ;if (dev->queue_pairs >1 ) {
Thanks,
Maxime
Re: [dpdk-dev] [PATCH v2 3/3] virtio-user: set status on virtio-user reconnect
Hi Maxime/ Adrian,
Thanks for the patch. we can launch vhost-user with client mode with this fix patch.
But still fail to get throughput with basic vhost/virtio-user server mode loopback test. This is another problem which introduced by 57912824615fd7787a48a7b18e40661466.
Bugzilla: https://bugs.dpdk.org/show_bug.cgi?id=541
BR,
Yinan
Quoted 73 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: 2020年10月21日 0:43
To: Adrian Moreno <[email protected]>; [email protected]
Cc: Wang, Yinan <[email protected]>; Fu, Patrick <[email protected]>; [email protected]; Xia, Chenbo <[email protected]>; Wang, Zhihong <[email protected]>
Subject: Re: [PATCH v2 3/3] virtio-user: set status on virtio-user reconnectQuoted 7 lines · Adrian Moreno
Newer vhost-user backends will rely on
SET_STATUSto start the device so this required to support them.Fixes 57912824615f ("net/virtio-user: support vhost status setting")Review
Quoted 6 lines
Signed-off-by Adrian Moreno <[email protected]>--- drivers/net/virtio/virtio_user_ethdev.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/net/virtio/virtio_user_ethdev.cdrivers/net/virtio/virtio_user_ethdev.c virtio_user_server_reconnect(struct virtio_user_dev
Quoted 4 lines
index
e870fb2ff..d8bea4537100644drivers/net/virtio/virtio_user_ethdev.c +0
-0@@ -78,6 +78,13 @@ virtio_user_server_reconnect(struct virtio_user_dev*dev)
drivers/net/virtio/virtio_user_ethdev.c virtio_user_server_reconnect(struct virtio_user_dev
Quoted 14 lines
drivers/net/virtio/virtio_user_ethdev.c +7
-0return -1 ; dev->vhostfd = connectfd; + +vtpci_reset (hw); + +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_ACK ); + +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_DRIVER ); +if (dev->ops->send_request (dev,VHOST_USER_GET_FEATURES , &dev->device_features) <0 ) { PMD_INIT_LOG(ERR, "get_features failed: %s",@@ -111,6 +118,8 @@ virtio_user_server_reconnect(struct virtio_user_dev*dev)
drivers/net/virtio/virtio_user_ethdev.c virtio_user_server_reconnect(struct virtio_user_dev
Quoted 9 lines
drivers/net/virtio/virtio_user_ethdev.c +2
-0dev->features &= dev->device_features; +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_FEATURES_OK ); +/* For packed ring, resetting queues is required in reconnection. */ if (vtpci_packed_queue (hw) && (vtpci_get_status (hw) &VIRTIO_CONFIG_STATUS_DRIVER_OK )) {@@ -119,8 +128,9 @@ virtio_user_server_reconnect(struct virtio_user_dev*dev)
drivers/net/virtio/virtio_user_ethdev.c virtio_user_server_reconnect(struct virtio_user_dev *dev) · line 136
Quoted 12 lines
drivers/net/virtio/virtio_user_ethdev.c +3
-2virtio_user_reset_queues_packed (eth_dev); } - ret =virtio_user_start_device (dev); -if (ret <0 ) +/* Start the device */ +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_DRIVER_OK ); +if (!dev->started)return -1 ;if (dev->queue_pairs >1 ) {Reviewed-by Maxime Coquelin <[email protected]>Thanks,
Maxime
Re: [dpdk-dev] [PATCH v2 3/3] virtio-user: set status on virtio-user reconnect
Hi Yinan,
Quoted 5 lines · Yinan
Hi Maxime/ Adrian,
Thanks for the patch. we can launch vhost-user with client mode with this fix patch.
But still fail to get throughput with basic vhost/virtio-user server mode loopback test. This is another problem which introduced by57912824615fd7787a48a7b18e40661466.
Bugzilla: https://bugs.dpdk.org/show_bug.cgi?id=541
Thanks for reporting the issue, I will look at it this morning.
BTW, this virtio-user server mode is broken by design, we should really fix it.
For example, it assumes features to be supported by the backend before the negotiation took place:
https://git.dpdk.org/dpdk/tree/drivers/net/virtio/virtio_user/virtio_user_dev.c#n513
As part of my rework, I suggest we implement the same behaviour as QEMU does, which will be reliable and consistent with QEMU. It means that if server mode is enabled in device command-line, the driver waits until the socket is ready.
Chenbo, Adrian, what do you think?
Thanks,
Maxime
Quoted 76 lines
BR,
YinanQuoted 73 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: 2020年10月21日 0:43
To: Adrian Moreno <[email protected]>; [email protected]
Cc: Wang, Yinan <[email protected]>; Fu, Patrick <[email protected]>; [email protected]; Xia, Chenbo <[email protected]>; Wang, Zhihong <[email protected]>
Subject: Re: [PATCH v2 3/3] virtio-user: set status on virtio-user reconnectQuoted 7 lines · Adrian Moreno
Newer vhost-user backends will rely on
SET_STATUSto start the device so this required to support them.Fixes 57912824615f ("net/virtio-user: support vhost status setting")Review
Quoted 6 lines
Signed-off-by Adrian Moreno <[email protected]>--- drivers/net/virtio/virtio_user_ethdev.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/net/virtio/virtio_user_ethdev.cdrivers/net/virtio/virtio_user_ethdev.c virtio_user_server_reconnect(struct virtio_user_dev
Quoted 4 lines
index
e870fb2ff..d8bea4537100644drivers/net/virtio/virtio_user_ethdev.c +0
-0@@ -78,6 +78,13 @@ virtio_user_server_reconnect(struct virtio_user_dev*dev)
drivers/net/virtio/virtio_user_ethdev.c virtio_user_server_reconnect(struct virtio_user_dev
Quoted 14 lines
drivers/net/virtio/virtio_user_ethdev.c +7
-0return -1 ; dev->vhostfd = connectfd; + +vtpci_reset (hw); + +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_ACK ); + +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_DRIVER ); +if (dev->ops->send_request (dev,VHOST_USER_GET_FEATURES , &dev->device_features) <0 ) { PMD_INIT_LOG(ERR, "get_features failed: %s",@@ -111,6 +118,8 @@ virtio_user_server_reconnect(struct virtio_user_dev*dev)
drivers/net/virtio/virtio_user_ethdev.c virtio_user_server_reconnect(struct virtio_user_dev
Quoted 9 lines
drivers/net/virtio/virtio_user_ethdev.c +2
-0dev->features &= dev->device_features; +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_FEATURES_OK ); +/* For packed ring, resetting queues is required in reconnection. */ if (vtpci_packed_queue (hw) && (vtpci_get_status (hw) &VIRTIO_CONFIG_STATUS_DRIVER_OK )) {@@ -119,8 +128,9 @@ virtio_user_server_reconnect(struct virtio_user_dev*dev)
drivers/net/virtio/virtio_user_ethdev.c virtio_user_server_reconnect(struct virtio_user_dev *dev) · line 136
Quoted 12 lines
drivers/net/virtio/virtio_user_ethdev.c +3
-2virtio_user_reset_queues_packed (eth_dev); } - ret =virtio_user_start_device (dev); -if (ret <0 ) +/* Start the device */ +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_DRIVER_OK ); +if (!dev->started)return -1 ;if (dev->queue_pairs >1 ) {Reviewed-by Maxime Coquelin <[email protected]>Thanks,
Maxime
Re: [dpdk-dev] [PATCH v2 3/3] virtio-user: set status on virtio-user reconnect
Hi Maxime,
Quoted 32 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Thursday, October 22, 2020 3:14 PM
To: Wang, Yinan <[email protected]>; Adrian Moreno <[email protected]>; [email protected]; Xia, Chenbo <[email protected]>
Cc: Fu, Patrick <[email protected]>; [email protected]; Wang, Zhihong <[email protected]>; Xu, Qian Q <[email protected]>
Subject: Re: [PATCH v2 3/3] virtio-user: set status on virtio-user reconnectHi Yinan,
Quoted 3 lines · Yinan
Hi Maxime/ Adrian,
Thanks for the patch. we can launch vhost-user with client mode with
this fix patch.
Quoted 1 line
But still fail to get throughput with basic vhost/virtio-user server
mode loopback test. This is another problem which introduced by
57912824615fd7787a48a7b18e40661466.Quoted 1 line
Thanks for reporting the issue, I will look at it this morning.
BTW, this virtio-user server mode is broken by design, we should really fix it.
For example, it assumes features to be supported by the backend before the negotiation took place:
https://git.dpdk.org/dpdk/tree/drivers/net/virtio/virtio_user/virtio_user_
dev.c#n513
Quoted 6 lines
As part of my rework, I suggest we implement the same behaviour as QEMU does, which will be reliable and consistent with QEMU. It means that if server mode is enabled in device command-line, the driver waits until the socket is ready.
Chenbo, Adrian, what do you think?
Yes! I totally agree and have the same opinion for a long time. As I remember, this feature assumption has caused problems before and I notice the new STATUS feature is also affected. It's good to make this consistent with QEMU 😊.
Cheers,
Chenbo
Quoted 84 lines
Thanks,
MaximeQuoted 7 lines
BR,
YinanQuoted 5 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: 2020年10月21日 0:43
To: Adrian Moreno <[email protected]>; [email protected]
Cc: Wang, Yinan <[email protected]>; Fu, PatrickQuoted 3 lines
Quoted 3 lines
[email protected]; Xia, Chenbo <[email protected]>; Wang, Zhihong <[email protected]>
Subject: Re: [PATCH v2 3/3] virtio-user: set status on virtio-userreconnect
Quoted 25 lines
Quoted 25 lines · Adrian Moreno
Quoted 7 lines
Newer vhost-user backends will rely on
SET_STATUSto start the device so this required to support them.Fixes 57912824615f ("net/virtio-user: support vhost status setting")Review
Quoted 6 lines
Signed-off-by Adrian Moreno <[email protected]>--- drivers/net/virtio/virtio_user_ethdev.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/net/virtio/virtio_user_ethdev.cdrivers/net/virtio/virtio_user_ethdev.c virtio_user_server_reconnect(struct virtio_user_dev
Quoted 4 lines
index
e870fb2ff..d8bea4537100644drivers/net/virtio/virtio_user_ethdev.c +0
-0@@ -78,6 +78,13 @@ virtio_user_server_reconnect(struct virtio_user_dev*dev)
Quoted 2 lines
drivers/net/virtio/virtio_user_ethdev.c +0
-0return -1 ;Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
drivers/net/virtio/virtio_user_ethdev.c +3
-0dev->vhostfd = connectfd; + +vtpci_reset (hw); +Quoted 8 lines
drivers/net/virtio/virtio_user_ethdev.c virtio_user_server_reconnect(struct
Quoted 8 lines
drivers/net/virtio/virtio_user_ethdev.c +4
-0+vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_ACK ); + +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_DRIVER ); +if (dev->ops->send_request (dev,VHOST_USER_GET_FEATURES , &dev->device_features) <0 ) { PMD_INIT_LOG(ERR, "get_features failed: %s",@@ -111,6 +118,8 @@ virtio_user_server_reconnect(struct
virtio_user_devQuoted 10 lines
Quoted 10 lines
*dev)
drivers/net/virtio/virtio_user_ethdev.c virtio_user_server_reconnect(struct
Quoted 9 lines
drivers/net/virtio/virtio_user_ethdev.c +2
-0dev->features &= dev->device_features; +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_FEATURES_OK ); +/* For packed ring, resetting queues is required in reconnection. */ if (vtpci_packed_queue (hw) && (vtpci_get_status (hw) &VIRTIO_CONFIG_STATUS_DRIVER_OK )) {@@ -119,8 +128,9 @@ virtio_user_server_reconnect(struct
virtio_user_devQuoted 19 lines
Quoted 18 lines
*dev)
drivers/net/virtio/virtio_user_ethdev.c virtio_user_server_reconnect(struct virtio_user_dev *dev) · line 136
Quoted 12 lines
drivers/net/virtio/virtio_user_ethdev.c +3
-2virtio_user_reset_queues_packed (eth_dev); } - ret =virtio_user_start_device (dev); -if (ret <0 ) +/* Start the device */ +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_DRIVER_OK ); +if (!dev->started)return -1 ;if (dev->queue_pairs >1 ) {Reviewed-by Maxime Coquelin <[email protected]>Thanks,
Maxime
Re: [dpdk-dev] [PATCH v2 3/3] virtio-user: set status on virtio-user reconnect
Quoted 39 lines · Chenbo
Hi Maxime,
Quoted 37 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Thursday, October 22, 2020 3:14 PM
To: Wang, Yinan <[email protected]>; Adrian Moreno <[email protected]>; [email protected]; Xia, Chenbo <[email protected]>
Cc: Fu, Patrick <[email protected]>; [email protected]; Wang, Zhihong <[email protected]>; Xu, Qian Q <[email protected]>
Subject: Re: [PATCH v2 3/3] virtio-user: set status on virtio-user reconnectHi Yinan,
Quoted 3 lines · Yinan
Hi Maxime/ Adrian,
Thanks for the patch. we can launch vhost-user with client mode with
this fix patch.
Quoted 1 line
But still fail to get throughput with basic vhost/virtio-user server
mode loopback test. This is another problem which introduced by
57912824615fd7787a48a7b18e40661466.Quoted 1 line
Thanks for reporting the issue, I will look at it this morning.
BTW, this virtio-user server mode is broken by design, we should really fix it.
For example, it assumes features to be supported by the backend before the negotiation took place:
https://git.dpdk.org/dpdk/tree/drivers/net/virtio/virtio_user/virtio_user_
dev.c#n513As part of my rework, I suggest we implement the same behaviour as QEMU does, which will be reliable and consistent with QEMU. It means that if server mode is enabled in device command-line, the driver waits until the socket is ready.
Quoted 6 lines
Quoted 1 line
Chenbo, Adrian, what do you think?
Yes! I totally agree and have the same opinion for a long time. As I remember, this feature assumption has caused problems before and I notice the new STATUS feature is also affected. It's good to make this consistent with QEMU 😊.
+1
In fact, I was looking into how to get rid of some error messages originated during the initialization of the virtio-pci layer when the socket is still not ready.
Quoted 88 lines
Cheers,
ChenboQuoted 84 lines
Thanks,
MaximeQuoted 7 lines
BR,
YinanQuoted 5 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: 2020年10月21日 0:43
To: Adrian Moreno <[email protected]>; [email protected]
Cc: Wang, Yinan <[email protected]>; Fu, PatrickQuoted 3 lines
Quoted 3 lines
[email protected]; Xia, Chenbo <[email protected]>; Wang, Zhihong <[email protected]>
Subject: Re: [PATCH v2 3/3] virtio-user: set status on virtio-userreconnect
Quoted 25 lines
Quoted 25 lines · Adrian Moreno
Quoted 7 lines
Newer vhost-user backends will rely on
SET_STATUSto start the device so this required to support them.Fixes 57912824615f ("net/virtio-user: support vhost status setting")Review
Quoted 6 lines
Signed-off-by Adrian Moreno <[email protected]>--- drivers/net/virtio/virtio_user_ethdev.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/net/virtio/virtio_user_ethdev.cdrivers/net/virtio/virtio_user_ethdev.c virtio_user_server_reconnect(struct virtio_user_dev
Quoted 4 lines
index
e870fb2ff..d8bea4537100644drivers/net/virtio/virtio_user_ethdev.c +0
-0@@ -78,6 +78,13 @@ virtio_user_server_reconnect(struct virtio_user_dev*dev)
Quoted 2 lines
drivers/net/virtio/virtio_user_ethdev.c +0
-0return -1 ;Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
drivers/net/virtio/virtio_user_ethdev.c +3
-0dev->vhostfd = connectfd; + +vtpci_reset (hw); +Quoted 8 lines
drivers/net/virtio/virtio_user_ethdev.c virtio_user_server_reconnect(struct
Quoted 8 lines
drivers/net/virtio/virtio_user_ethdev.c +4
-0+vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_ACK ); + +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_DRIVER ); +if (dev->ops->send_request (dev,VHOST_USER_GET_FEATURES , &dev->device_features) <0 ) { PMD_INIT_LOG(ERR, "get_features failed: %s",@@ -111,6 +118,8 @@ virtio_user_server_reconnect(struct
virtio_user_devQuoted 10 lines
Quoted 10 lines
*dev)
drivers/net/virtio/virtio_user_ethdev.c virtio_user_server_reconnect(struct
Quoted 9 lines
drivers/net/virtio/virtio_user_ethdev.c +2
-0dev->features &= dev->device_features; +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_FEATURES_OK ); +/* For packed ring, resetting queues is required in reconnection. */ if (vtpci_packed_queue (hw) && (vtpci_get_status (hw) &VIRTIO_CONFIG_STATUS_DRIVER_OK )) {@@ -119,8 +128,9 @@ virtio_user_server_reconnect(struct
virtio_user_devQuoted 19 lines
Quoted 18 lines
*dev)
drivers/net/virtio/virtio_user_ethdev.c virtio_user_server_reconnect(struct virtio_user_dev *dev) · line 136
Quoted 12 lines
drivers/net/virtio/virtio_user_ethdev.c +3
-2virtio_user_reset_queues_packed (eth_dev); } - ret =virtio_user_start_device (dev); -if (ret <0 ) +/* Start the device */ +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_DRIVER_OK ); +if (!dev->started)return -1 ;if (dev->queue_pairs >1 ) {Reviewed-by Maxime Coquelin <[email protected]>Thanks,
Maxime
Signature · 1 line
Adrián Moreno
Re: [dpdk-dev] [PATCH v2 3/3] virtio-user: set status on virtio-user reconnect
Quoted 48 lines · Adrian Moreno
Quoted 39 lines · Chenbo
Hi Maxime,
Quoted 37 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Thursday, October 22, 2020 3:14 PM
To: Wang, Yinan <[email protected]>; Adrian Moreno <[email protected]>; [email protected]; Xia, Chenbo <[email protected]>
Cc: Fu, Patrick <[email protected]>; [email protected]; Wang, Zhihong <[email protected]>; Xu, Qian Q <[email protected]>
Subject: Re: [PATCH v2 3/3] virtio-user: set status on virtio-user reconnectHi Yinan,
Quoted 3 lines · Yinan
Hi Maxime/ Adrian,
Thanks for the patch. we can launch vhost-user with client mode with
this fix patch.
Quoted 1 line
But still fail to get throughput with basic vhost/virtio-user server
mode loopback test. This is another problem which introduced by
57912824615fd7787a48a7b18e40661466.Quoted 1 line
Thanks for reporting the issue, I will look at it this morning.
BTW, this virtio-user server mode is broken by design, we should really fix it.
For example, it assumes features to be supported by the backend before the negotiation took place:
https://git.dpdk.org/dpdk/tree/drivers/net/virtio/virtio_user/virtio_user_
dev.c#n513As part of my rework, I suggest we implement the same behaviour as QEMU does, which will be reliable and consistent with QEMU. It means that if server mode is enabled in device command-line, the driver waits until the socket is ready.
Quoted 6 lines
Quoted 1 line
Chenbo, Adrian, what do you think?
Yes! I totally agree and have the same opinion for a long time. As I remember, this feature assumption has caused problems before and I notice the new STATUS feature is also affected. It's good to make this consistent with QEMU 😊.
Quoted 5 lines
+1
In fact, I was looking into how to get rid of some error messages originated during the initialization of the virtio-pci layer when the socket is still not ready.
Is that the error messages you meant?
virtio_user_send_status_update(): VHOST_USER_SET_STATUS failed (-1): Success virtio_user_update_status(): VHOST_USER_GET_STATUS failed (-1): Success virtio_user_update_status(): VHOST_USER_GET_STATUS failed (-1): Success virtio_user_send_status_update(): VHOST_USER_SET_STATUS failed (-1): Success virtio_user_update_status(): VHOST_USER_GET_STATUS failed (-1): Success virtio_user_send_status_update(): VHOST_USER_SET_STATUS failed (-1): Success virtio_user_update_status(): VHOST_USER_GET_STATUS failed (-1): Success virtio_user_send_status_update(): VHOST_USER_SET_STATUS failed (-1): Success virtio_user_update_status(): VHOST_USER_GET_STATUS failed (-1): Success virtio_user_update_status(): VHOST_USER_GET_STATUS failed (-1): Success virtio_user_send_status_update(): VHOST_USER_SET_STATUS failed (-1): Success
That would be good to have them fixed
Quoted 90 lines
Quoted 89 lines
Cheers,
ChenboQuoted 84 lines
Thanks,
MaximeQuoted 7 lines
BR,
YinanQuoted 5 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: 2020年10月21日 0:43
To: Adrian Moreno <[email protected]>; [email protected]
Cc: Wang, Yinan <[email protected]>; Fu, PatrickQuoted 3 lines
Quoted 3 lines
[email protected]; Xia, Chenbo <[email protected]>; Wang, Zhihong <[email protected]>
Subject: Re: [PATCH v2 3/3] virtio-user: set status on virtio-userreconnect
Quoted 25 lines
Quoted 25 lines · Adrian Moreno
Quoted 7 lines
Newer vhost-user backends will rely on
SET_STATUSto start the device so this required to support them.Fixes 57912824615f ("net/virtio-user: support vhost status setting")Review
Quoted 6 lines
Signed-off-by Adrian Moreno <[email protected]>--- drivers/net/virtio/virtio_user_ethdev.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/net/virtio/virtio_user_ethdev.cdrivers/net/virtio/virtio_user_ethdev.c virtio_user_server_reconnect(struct virtio_user_dev
Quoted 4 lines
index
e870fb2ff..d8bea4537100644drivers/net/virtio/virtio_user_ethdev.c +0
-0@@ -78,6 +78,13 @@ virtio_user_server_reconnect(struct virtio_user_dev*dev)
Quoted 2 lines
drivers/net/virtio/virtio_user_ethdev.c +0
-0return -1 ;Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
drivers/net/virtio/virtio_user_ethdev.c +3
-0dev->vhostfd = connectfd; + +vtpci_reset (hw); +Quoted 8 lines
drivers/net/virtio/virtio_user_ethdev.c virtio_user_server_reconnect(struct
Quoted 8 lines
drivers/net/virtio/virtio_user_ethdev.c +4
-0+vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_ACK ); + +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_DRIVER ); +if (dev->ops->send_request (dev,VHOST_USER_GET_FEATURES , &dev->device_features) <0 ) { PMD_INIT_LOG(ERR, "get_features failed: %s",@@ -111,6 +118,8 @@ virtio_user_server_reconnect(struct
virtio_user_devQuoted 10 lines
Quoted 10 lines
*dev)
drivers/net/virtio/virtio_user_ethdev.c virtio_user_server_reconnect(struct
Quoted 9 lines
drivers/net/virtio/virtio_user_ethdev.c +2
-0dev->features &= dev->device_features; +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_FEATURES_OK ); +/* For packed ring, resetting queues is required in reconnection. */ if (vtpci_packed_queue (hw) && (vtpci_get_status (hw) &VIRTIO_CONFIG_STATUS_DRIVER_OK )) {@@ -119,8 +128,9 @@ virtio_user_server_reconnect(struct
virtio_user_devQuoted 19 lines
Quoted 18 lines
*dev)
drivers/net/virtio/virtio_user_ethdev.c virtio_user_server_reconnect(struct virtio_user_dev *dev) · line 136
Quoted 12 lines
drivers/net/virtio/virtio_user_ethdev.c +3
-2virtio_user_reset_queues_packed (eth_dev); } - ret =virtio_user_start_device (dev); -if (ret <0 ) +/* Start the device */ +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_DRIVER_OK ); +if (!dev->started)return -1 ;if (dev->queue_pairs >1 ) {Reviewed-by Maxime Coquelin <[email protected]>Thanks,
Maxime
Jiang, YuX
Tested-byRe: [dpdk-dev] [PATCH v2 3/3] virtio-user: set status on virtio-user reconnect
Best Regards
Jiang yu
Quoted 194 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Maxime Coquelin
Sent: Thursday, October 22, 2020 4:32 PM
To: Adrian Moreno <[email protected]>; Xia, Chenbo <[email protected]>; Wang, Yinan <[email protected]>; [email protected]
Cc: Fu, Patrick <[email protected]>; [email protected]; Wang, Zhihong <[email protected]>; Xu, Qian Q <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2 3/3] virtio-user: set status on virtio-user reconnectQuoted 46 lines · Adrian Moreno
Quoted 43 lines · Chenbo
Hi Maxime,
Quoted 41 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Thursday, October 22, 2020 3:14 PM
To: Wang, Yinan <[email protected]>; Adrian Moreno <[email protected]>; [email protected]; Xia, Chenbo <[email protected]>
Cc: Fu, Patrick <[email protected]>; [email protected]; Wang, Zhihong <[email protected]>; Xu, Qian Q <[email protected]>
Subject: Re: [PATCH v2 3/3] virtio-user: set status on virtio-user reconnectHi Yinan,
Quoted 4 lines · Yinan
Hi Maxime/ Adrian,
Thanks for the patch. we can launch vhost-user with client mode with
this fix patch.
Quoted 2 lines
But still fail to get throughput with basic vhost/virtio-user server
mode loopback test. This is another problem which introduced by
57912824615fd7787a48a7b18e40661466.Quoted 1 line
Thanks for reporting the issue, I will look at it this morning.
BTW, this virtio-user server mode is broken by design, we should really fix it.
For example, it assumes features to be supported by the backend before the negotiation took place:
https://git.dpdk.org/dpdk/tree/drivers/net/virtio/virtio_user/virtio
_user_
dev.c#n513As part of my rework, I suggest we implement the same behaviour as QEMU does, which will be reliable and consistent with QEMU. It means that if server mode is enabled in device command-line, the driver waits until the socket is ready.
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Chenbo, Adrian, what do you think?
Yes! I totally agree and have the same opinion for a long time. As I remember, this feature assumption has caused problems before and I notice the new STATUS feature is also affected. It's good to make this
consistent with QEMU 😊.
Quoted 6 lines
Quoted 1 line
+1
In fact, I was looking into how to get rid of some error messages originated during the initialization of the virtio-pci layer when the socket is still not ready.
Is that the error messages you meant?
virtio_user_send_status_update():VHOST_USER_SET_STATUSfailed (-1):
Successvirtio_user_update_status():VHOST_USER_GET_STATUSfailed (-1): Successvirtio_user_update_status():VHOST_USER_GET_STATUSfailed (-1): Successvirtio_user_send_status_update():VHOST_USER_SET_STATUSfailed (-1):
Successvirtio_user_update_status():VHOST_USER_GET_STATUSfailed (-1): Successvirtio_user_send_status_update():VHOST_USER_SET_STATUSfailed (-1):
Successvirtio_user_update_status():VHOST_USER_GET_STATUSfailed (-1): Successvirtio_user_send_status_update():VHOST_USER_SET_STATUSfailed (-1):
Successvirtio_user_update_status():VHOST_USER_GET_STATUSfailed (-1): Successvirtio_user_update_status():VHOST_USER_GET_STATUSfailed (-1): Successvirtio_user_send_status_update():VHOST_USER_SET_STATUSfailed (-1):
SuccessThat would be good to have them fixed
Quoted 10 lines
Quoted 10 lines
Cheers,
ChenboQuoted 6 lines
Thanks,
MaximeQuoted 2 lines
BR,
YinanQuoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: 2020年10月21日 0:43
To: Adrian Moreno <[email protected]>; [email protected]
Cc: Wang, Yinan <[email protected]>; Fu, PatrickQuoted 1 line
Quoted 1 line
[email protected]; Xia, Chenbo <[email protected]>; Wang,
Zhihong
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 2 lines
Quoted 2 lines
<[email protected]>
Subject: Re: [PATCH v2 3/3] virtio-user: set status on virtio-userreconnect
Quoted 27 lines
Quoted 27 lines · Adrian Moreno
Quoted 8 lines
Newer vhost-user backends will rely on
SET_STATUSto start the device so this required to support them.Fixes 57912824615f ("net/virtio-user: support vhost statussetting")
Cc: [email protected]
Cc: [email protected]Review
Quoted 6 lines
Signed-off-by Adrian Moreno <[email protected]>--- drivers/net/virtio/virtio_user_ethdev.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/net/virtio/virtio_user_ethdev.cQuoted 5 lines
index
e870fb2ff..d8bea4537100644drivers/net/virtio/virtio_user_ethdev.c +0
-0@@ -78,6 +78,13 @@ virtio_user_server_reconnect(struct
virtio_user_dev*dev)
Quoted 2 lines
return -1;
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/net/virtio/virtio_user_ethdev.c
Quoted 9 lines
drivers/net/virtio/virtio_user_ethdev.c +7
-0dev->vhostfd = connectfd; + +vtpci_reset (hw); + +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_ACK ); + +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_DRIVER ); + if (dev->ops->send_request(dev,
VHOST_USER_GET_FEATURES,Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/net/virtio/virtio_user_ethdev.c
Quoted 2 lines
drivers/net/virtio/virtio_user_ethdev.c +0
-0&dev->device_features) < 0) { PMD_INIT_LOG(ERR, "get_features failed: %s", @@ -111,6 +118,8
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
@@ virtio_user_server_reconnect(struct
virtio_user_devQuoted 5 lines
Quoted 5 lines
*dev)
drivers/net/virtio/virtio_user_ethdev.c
Quoted 4 lines
drivers/net/virtio/virtio_user_ethdev.c +1
-0dev->features &= dev->device_features; + vtpci_set_status(hw,
VIRTIO_CONFIG_STATUS_FEATURES_OK);Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/net/virtio/virtio_user_ethdev.c
Quoted 2 lines
drivers/net/virtio/virtio_user_ethdev.c +1
-0+/* For packed ring, resetting queues is required in reconnection. */
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/net/virtio/virtio_user_ethdev.c
Quoted 2 lines
drivers/net/virtio/virtio_user_ethdev.c +0
-0if (vtpci_packed_queue(hw) && (vtpci_get_status(hw) &
VIRTIO_CONFIG_STATUS_DRIVER_OK)) {Quoted 23 lines
Quoted 22 lines
Quoted 21 lines
Quoted 1 line
Quoted 1 line
drivers/net/virtio/virtio_user_ethdev.c virtio_user_server_reconnect(struct
Quoted 1 line
drivers/net/virtio/virtio_user_ethdev.c +0
-0@@ -119,8 +128,9 @@ virtio_user_server_reconnect(struct
virtio_user_devQuoted 19 lines
Quoted 18 lines
*dev)
drivers/net/virtio/virtio_user_ethdev.c virtio_user_server_reconnect(struct · line 136
Quoted 12 lines
drivers/net/virtio/virtio_user_ethdev.c +3
-2virtio_user_reset_queues_packed (eth_dev); } - ret =virtio_user_start_device (dev); -if (ret <0 ) +/* Start the device */ +vtpci_set_status (hw,VIRTIO_CONFIG_STATUS_DRIVER_OK ); +if (!dev->started)return -1 ;if (dev->queue_pairs >1 ) {Reviewed-by Maxime Coquelin <[email protected]>Thanks,
Maxime