Some fixes on virtio-user/vhost
cover Some fixes on virtio-user/vhost
Patch 1: a trivial fix on reword a log message. Patch 2: fix the rxq interrupt mode when virtio-user is used
with vhost kernel.
Patch 3: a trivial fix on LSC fd init when virtio-user is used
with vhost kernel.
Jianfeng Tan (3):
net/vhost: fix incorrect log info net/virtio-user: fix not working with vhost kernel net/virtio-user: fix not proper initialized
drivers/net/vhost/rte_eth_vhost.c | 4 ++-- drivers/net/virtio/virtio_user/virtio_user_dev.c | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/3 net/vhost: fix incorrect log info
The original words are not accurate. For example, as destroy_device callback gets called, it does not necessarily mean that the connection is closed.
--- drivers/net/vhost/rte_eth_vhost.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/vhost/rte_eth_vhost.c +2 -2
@@ -607,7 +607,7 @@ new_device(int vid)rte_atomic32_set (&internal->dev_attached,1 );update_queuing_status (eth_dev); -RTE_LOG (INFO ,PMD ,"New connection established\n" ); +RTE_LOG (INFO ,PMD ,"Vhost device %d created\n" , vid);_rte_eth_dev_callback_process (eth_dev,RTE_ETH_EVENT_INTR_LSC ,NULL );
@@ -661,7 +661,7 @@ destroy_device(int vid) state->max_vring =0 ;rte_spinlock_unlock (&state->lock); -RTE_LOG (INFO ,PMD ,"Connection closed\n" ); +RTE_LOG (INFO ,PMD ,"Vhost device %d destroyed\n" , vid);_rte_eth_dev_callback_process (eth_dev,RTE_ETH_EVENT_INTR_LSC ,NULL ); }
Signature · 1 line
2.7.4
PATCH 2/3 net/virtio-user: fix not working with vhost kernel
In reply to Jianfeng TanAfter reset owner in below patch, we failed to set owner before sending further vhost messages. It is OK with vhost user implemented DPDK/VPP/Contrail, but it sees "Operation not permitted" error when used with vhost kernel.
We fix this by setting owner every time the device is started.
--- drivers/net/virtio/virtio_user/virtio_user_dev.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/virtio/virtio_user/virtio_user_dev.c +4 -0
@@ -99,6 +99,9 @@ virtio_user_start_device(struct virtio_user_dev *dev)uint64_t features;int ret; +/* Do not check return as already done in init, or reset in stop */ + dev->ops->send_request (dev,VHOST_USER_SET_OWNER ,NULL ); +/* Step 0: tell vhost to create queues */ if (virtio_user_queue_setup (dev, virtio_user_create_queue) <0 ) goto error;
@@ -332,6 +335,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,PMD_INIT_LOG (ERR ,"backend set up fails" );return -1 ; } +if (dev->ops->send_request (dev,VHOST_USER_SET_OWNER ,NULL ) <0 ) {PMD_INIT_LOG (ERR ,"set_owner fails: %s" ,strerror (errno));return -1 ;
Signature · 1 line
2.7.4
PATCH 3/3 net/virtio-user: fix not proper initialized
In reply to Jianfeng Tanintr_handle->fd was wrongly initialized as 0 (usually as the stdio fd) when virtio-user is used with vhost-kernel. So the interrupt thread might wrongly treat stdin events as LSC interrupts.
--- drivers/net/virtio/virtio_user/virtio_user_dev.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/virtio/virtio_user/virtio_user_dev.c +1 -0
@@ -251,6 +251,7 @@ virtio_user_fill_intr_handle(struct virtio_user_dev *dev) eth_dev->intr_handle->type =RTE_INTR_HANDLE_VDEV ;/* For virtio vdev, no need to read counter for clean */ eth_dev->intr_handle->efd_counter_size =0 ; + eth_dev->intr_handle->fd =-1 ;if (dev->vhostfd >=0 ) eth_dev->intr_handle->fd = dev->vhostfd;
Signature · 1 line
2.7.4
Quoted 6 lines · Jianfeng Tan
Patch 1: a trivial fix on reword a log message. Patch 2: fix the rxq interrupt mode when virtio-user is used
with vhost kernel.
Patch 3: a trivial fix on LSC fd init when virtio-user is used
with vhost kernel.
Quoted 9 lines
Jianfeng Tan (3):
net/vhost: fix incorrect log infonet/virtio-user: fix not working with vhost kernelnet/virtio-user: fix not proper initializeddrivers/net/vhost/rte_eth_vhost.c | 4 ++-- drivers/net/virtio/virtio_user/virtio_user_dev.c | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-)
For the series:
Thomas, I would suggest to pick this series for v18.02, as patch 2 fixes a bug introduced in this release cycle.
Thanks,
Maxime
13/02/2018 14:32, Maxime Coquelin:
Quoted 13 lines · Jianfeng Tan
Quoted 10 lines
Patch 1: a trivial fix on reword a log message. Patch 2: fix the rxq interrupt mode when virtio-user is used
with vhost kernel.
Patch 3: a trivial fix on LSC fd init when virtio-user is used
with vhost kernel.Jianfeng Tan (3):
net/vhost: fix incorrect log infonet/virtio-user: fix not working with vhost kernelnet/virtio-user: fix not proper initialized
Quoted 5 lines
For the series:
Reviewed-by Maxime Coquelin <[email protected]>Thomas, I would suggest to pick this series for v18.02, as patch 2 fixes a bug introduced in this release cycle.
Applied with these reworded titles:
net/vhost: fix log messages on create/destroynet/virtio-user: fix start with kernel vhostnet/virtio-user: fix interrupts with kernel vhost