vhost: call rte_vhost_enable_guest_notification only on enabled queues
PATCH 1/1 vhost: call rte_vhost_enable_guest_notification only on enabled queues
If the vhost PMD were configured with more queues than the guest, the old code would segfault in rte_vhost_enable_guest_notification due to a NULL virtqueue pointer.
--- drivers/net/vhost/rte_eth_vhost.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/vhost/rte_eth_vhost.c +3 -2
@@ -265,7 +265,6 @@ new_device(struct virtio_net *dev) vq->device = dev; vq->internal = internal; vq->port = eth_dev->data->port_id; -rte_vhost_enable_guest_notification (dev, vq->virtqueue_id,0 ); }for (i =0 ; i < eth_dev->data->nb_tx_queues; i++) { vq = eth_dev->data->tx_queues[i];
@@ -274,9 +273,11 @@ new_device(struct virtio_net *dev) vq->device = dev; vq->internal = internal; vq->port = eth_dev->data->port_id; -rte_vhost_enable_guest_notification (dev, vq->virtqueue_id,0 ); } +for (i =0 ; i < dev->virt_qp_nb *VIRTIO_QNUM ; i++) +rte_vhost_enable_guest_notification (dev, i,0 ); + dev->flags |=VIRTIO_DEV_RUNNING ; dev->priv = eth_dev; eth_dev->data->dev_link.link_status =ETH_LINK_UP ;
Signature · 1 line
1.9.1
Quoted 38 lines
If the vhost PMD were configured with more queues than the guest, the old code would segfault in
rte_vhost_enable_guest_notificationdue to a NULL virtqueue pointer.Fixes ee584e9710b9 ("vhost: add driver on top of the library")Signed-off-by Rich Lane <[email protected]>--- drivers/net/vhost/rte_eth_vhost.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/net/vhost/rte_eth_vhost.c +0
-1@@ -265,7 +265,6 @@ new_device(struct virtio_net *dev) vq->device = dev; vq->internal = internal; vq->port = eth_dev->data->port_id; -rte_vhost_enable_guest_notification (dev, vq- >virtqueue_id, 0); }for (i =0 ; i < eth_dev->data->nb_tx_queues; i++) {drivers/net/vhost/rte_eth_vhost.c +3
-1vq = eth_dev->data->tx_queues[i];@@ -274,9 +273,11 @@ new_device(struct virtio_net *dev) vq->device = dev; vq->internal = internal; vq->port = eth_dev->data->port_id; -rte_vhost_enable_guest_notification (dev, vq- >virtqueue_id, 0); } +for (i =0 ; i < dev->virt_qp_nb *VIRTIO_QNUM ; i++) +rte_vhost_enable_guest_notification (dev, i,0 ); + dev->flags |=VIRTIO_DEV_RUNNING ; dev->priv = eth_dev;
Quoted 3 lines
eth_dev->data->dev_link.link_status=ETH_LINK_UP;
--
1.9.1
I see the same issue, and verified that this patch solves it. Thanks!
Thanks,
Ciara
Hi,
Quoted 25 lines · Rich Lane
If the vhost PMD were configured with more queues than the guest, the old code would segfault in
rte_vhost_enable_guest_notificationdue to a NULL virtqueue pointer.Fixes ee584e9710b9 ("vhost: add driver on top of the library")Signed-off-by Rich Lane <[email protected]>--- drivers/net/vhost/rte_eth_vhost.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/net/vhost/rte_eth_vhost.c +0
-1@@ -265,7 +265,6 @@ new_device(struct virtio_net *dev) vq->device = dev; vq->internal = internal; vq->port = eth_dev->data->port_id; -rte_vhost_enable_guest_notification (dev, vq->virtqueue_id,0 ); }for (i =0 ; i < eth_dev->data->nb_tx_queues; i++) { vq = eth_dev->data->tx_queues[i];@@ -274,9 +273,11 @@ new_device(struct virtio_net *dev) vq->device = dev; vq->internal = internal;
drivers/net/vhost/rte_eth_vhost.c new_device(struct virtio_net *dev) · line 283
Quoted 10 lines
drivers/net/vhost/rte_eth_vhost.c +3
-1vq->port = eth_dev->data->port_id; -rte_vhost_enable_guest_notification (dev, vq->virtqueue_id,0 ); } +for (i =0 ; i < dev->virt_qp_nb *VIRTIO_QNUM ; i++) +rte_vhost_enable_guest_notification (dev, i,0 ); + dev->flags |=VIRTIO_DEV_RUNNING ; dev->priv = eth_dev; eth_dev->data->dev_link.link_status =ETH_LINK_UP ;
Just one question, when qemu starts a vm, usually, only one queue is enabled, then only 1 tx and 1 rx are called rte_vhost_enable_guest_notification; but after system is up, we use "ethtool -K eth0 combined x" to enable multiqueues, there's no chance to call rte_vhost_enable_guest_notification for other queues, right?
Thanks,
Jianfeng
Quoted 34 lines · Rich Lane
Quoted 1 line
If the vhost PMD were configured with more queues than the guest, the
old
Review
Quoted 10 lines
code would segfault in
rte_vhost_enable_guest_notificationdue to a NULL virtqueue pointer.Fixes ee584e9710b9 ("vhost: add driver on top of the library")Signed-off-by Rich Lane <[email protected]>--- drivers/net/vhost/rte_eth_vhost.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/net/vhost/rte_eth_vhost.cQuoted 20 lines
index b1eb082..310cbef 100644
drivers/net/vhost/rte_eth_vhost.c +0
-1@@ -265,7 +265,6 @@ new_device(struct virtio_net *dev) vq->device = dev; vq->internal = internal; vq->port = eth_dev->data->port_id; -rte_vhost_enable_guest_notification (dev, vq- virtqueue_id, 0); }for (i =0 ; i < eth_dev->data->nb_tx_queues; i++) {vq = eth_dev->data->tx_queues[i];drivers/net/vhost/rte_eth_vhost.c +0
-1@@ -274,9 +273,11 @@ new_device(struct virtio_net *dev) vq->device = dev; vq->internal = internal; vq->port = eth_dev->data->port_id; -rte_vhost_enable_guest_notification (dev, vq- virtqueue_id, 0); }
Quoted 12 lines
Quoted 6 lines
drivers/net/vhost/rte_eth_vhost.c +3
-0+for (i =0 ; i < dev->virt_qp_nb *VIRTIO_QNUM ; i++) +rte_vhost_enable_guest_notification (dev, i,0 ); + dev->flags |=VIRTIO_DEV_RUNNING ; dev->priv = eth_dev;eth_dev->data->dev_link.link_status = ETH_LINK_UP;Just one question, when qemu starts a vm, usually, only one queue is enabled, then only 1 tx and 1 rx are called
rte_vhost_enable_guest_notification; but after system is up, we use "ethtool -K eth0 combined x" to enable multiqueues, there's no chance to callrte_vhost_enable_guest_notificationfor other queues, right?
As far as I know, virt_qp_nb will report the number of queues available, regardless of their state enabled/disabled. So for example if we have 4 queues, but only one enabled, virt_qp_nb should still = 4 and rte_vhost_enable_guest_notification() will be called for all of these queues.
Thanks,
Ciara
Quoted 3 lines
Thanks,
Jianfeng
Quoted 47 lines · Ciara
Quoted 34 lines · Rich Lane
Quoted 1 line
If the vhost PMD were configured with more queues than the guest, the
old
Review
Quoted 10 lines
code would segfault in
rte_vhost_enable_guest_notificationdue to a NULL virtqueue pointer.Fixes ee584e9710b9 ("vhost: add driver on top of the library")Signed-off-by Rich Lane <[email protected]>--- drivers/net/vhost/rte_eth_vhost.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/net/vhost/rte_eth_vhost.cQuoted 20 lines
index b1eb082..310cbef 100644
drivers/net/vhost/rte_eth_vhost.c +0
-1@@ -265,7 +265,6 @@ new_device(struct virtio_net *dev) vq->device = dev; vq->internal = internal; vq->port = eth_dev->data->port_id; -rte_vhost_enable_guest_notification (dev, vq- virtqueue_id, 0); }for (i =0 ; i < eth_dev->data->nb_tx_queues; i++) {vq = eth_dev->data->tx_queues[i];drivers/net/vhost/rte_eth_vhost.c +0
-1@@ -274,9 +273,11 @@ new_device(struct virtio_net *dev) vq->device = dev; vq->internal = internal; vq->port = eth_dev->data->port_id; -rte_vhost_enable_guest_notification (dev, vq- virtqueue_id, 0); }Quoted 12 lines
Quoted 6 lines
drivers/net/vhost/rte_eth_vhost.c +3
-0+for (i =0 ; i < dev->virt_qp_nb *VIRTIO_QNUM ; i++) +rte_vhost_enable_guest_notification (dev, i,0 ); + dev->flags |=VIRTIO_DEV_RUNNING ; dev->priv = eth_dev;eth_dev->data->dev_link.link_status = ETH_LINK_UP;Just one question, when qemu starts a vm, usually, only one queue is enabled, then only 1 tx and 1 rx are called
rte_vhost_enable_guest_notification; but after system is up, we use "ethtool -K eth0 combined x" to enable multiqueues, there's no chance to callrte_vhost_enable_guest_notificationfor other queues, right?
Quoted 1 line
As far as I know,
virt_qp_nbwill report the number of queues available, regardless of their state enabled/disabled. So for example if we have 4 queues, but only one enabled,virt_qp_nbshould still = 4 andrte_vhost_enable_guest_notification()will be called for all of these queues.
Yes.
--yliu
Quoted 6 lines · Rich Lane
If the vhost PMD were configured with more queues than the guest, the old code would segfault in
rte_vhost_enable_guest_notificationdue to a NULL virtqueue pointer.Fixes ee584e9710b9 ("vhost: add driver on top of the library")Signed-off-by Rich Lane <[email protected]>
Thanks.
--yliu
Quoted 45 lines · Ciara
Quoted 34 lines · Rich Lane
Quoted 1 line
If the vhost PMD were configured with more queues than the guest, the
old
Review
Quoted 10 lines
code would segfault in
rte_vhost_enable_guest_notificationdue to a NULL virtqueue pointer.Fixes ee584e9710b9 ("vhost: add driver on top of the library")Signed-off-by Rich Lane <[email protected]>--- drivers/net/vhost/rte_eth_vhost.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/net/vhost/rte_eth_vhost.cQuoted 20 lines
index b1eb082..310cbef 100644
drivers/net/vhost/rte_eth_vhost.c +0
-1@@ -265,7 +265,6 @@ new_device(struct virtio_net *dev) vq->device = dev; vq->internal = internal; vq->port = eth_dev->data->port_id; -rte_vhost_enable_guest_notification (dev, vq- virtqueue_id, 0); }for (i =0 ; i < eth_dev->data->nb_tx_queues; i++) {vq = eth_dev->data->tx_queues[i];drivers/net/vhost/rte_eth_vhost.c +0
-1@@ -274,9 +273,11 @@ new_device(struct virtio_net *dev) vq->device = dev; vq->internal = internal; vq->port = eth_dev->data->port_id; -rte_vhost_enable_guest_notification (dev, vq- virtqueue_id, 0); }Quoted 11 lines
Quoted 6 lines
drivers/net/vhost/rte_eth_vhost.c +3
-0+for (i =0 ; i < dev->virt_qp_nb *VIRTIO_QNUM ; i++) +rte_vhost_enable_guest_notification (dev, i,0 ); + dev->flags |=VIRTIO_DEV_RUNNING ; dev->priv = eth_dev;eth_dev->data->dev_link.link_status = ETH_LINK_UP;Just one question, when qemu starts a vm, usually, only one queue is enabled, then only 1 tx and 1 rx are called
rte_vhost_enable_guest_notification; but after system is up, we use "ethtool -K eth0 combined x" to enable multiqueues, there's no chance to callrte_vhost_enable_guest_notificationfor other queues, right?
Quoted 1 line
As far as I know,
virt_qp_nbwill report the number of queues available, regardless of their state enabled/disabled. So for example if we have 4 queues, but only one enabled,virt_qp_nbshould still = 4 andrte_vhost_enable_guest_notification()will be called for all of these queues.
Oh, yes. I failed to really get multiqueue configured right, which leads to the wrong conclusion. Sorry.
Thanks,
Jianfeng
Quoted 6 lines
Thanks,
CiaraQuoted 2 lines
Thanks,
Jianfeng
Thomas Monjalon
AppliedQuoted 8 lines
Quoted 6 lines
If the vhost PMD were configured with more queues than the guest, the old code would segfault in
rte_vhost_enable_guest_notificationdue to a NULL virtqueue pointer.Fixes ee584e9710b9 ("vhost: add driver on top of the library")Signed-off-by Rich Lane <[email protected]>Acked-by Yuanhan Liu <[email protected]>
Applied, thanks
Quoted 8 lines · Thomas Monjalon
Quoted 7 lines
Quoted 6 lines
If the vhost PMD were configured with more queues than the guest, the old code would segfault in
rte_vhost_enable_guest_notificationdue to a NULL virtqueue pointer.Fixes ee584e9710b9 ("vhost: add driver on top of the library")Signed-off-by Rich Lane <[email protected]>Acked-by Yuanhan Liu <[email protected]>Applied, thanks
Hi Rich and Yuanhan,
I am sorry for late reply. I was out of office yesterday. I've tested it also today, and seems to be good.
Thanks,
Tetsuya
Quoted 5 lines · Tetsuya Mukawa
Quoted 4 lines · Thomas Monjalon
Quoted 4 lines
Quoted 4 lines
If the vhost PMD were configured with more queues than the guest, the old code would segfault in
rte_vhost_enable_guest_notificationdue to a NULL virtqueue pointer.
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Fixes ee584e9710b9 ("vhost: add driver on top of the library")Signed-off-by Rich Lane <[email protected]>Acked-by Yuanhan Liu <[email protected]>Applied, thanks
Hi Rich and Yuanhan,
I am sorry for late reply. I was out of office yesterday.
Tetsuya, no worry! Man takes leaves, and isn't the reason we have 2 or more maintainers on some blocks? :)
--yliu
Quoted 4 lines
I've tested it also today, and seems to be good.
Thanks,
Tetsuya
Quoted 9 lines · Yuanhan Liu
Quoted 8 lines · Tetsuya Mukawa
Quoted 7 lines · Thomas Monjalon
Quoted 7 lines
Quoted 6 lines
If the vhost PMD were configured with more queues than the guest, the old code would segfault in
rte_vhost_enable_guest_notificationdue to a NULL virtqueue pointer.Fixes ee584e9710b9 ("vhost: add driver on top of the library")Signed-off-by Rich Lane <[email protected]>Acked-by Yuanhan Liu <[email protected]>
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Applied, thanks
Hi Rich and Yuanhan,
I am sorry for late reply. I was out of office yesterday.
Tetsuya, no worry! Man takes leaves, and isn't the reason we have 2 or more maintainers on some blocks? :)
--yliu
Yeah, thanks!
Tetsuya