Skip to contentSkip to conversation

vhost: fix silent queue enabling with legacy guests

PATCH Applied Ilya Maximets 2 participants 3 messages Apr 12, 2019 – Apr 17, 2019 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20190412130955eucas1p114cc8050bf475c1df7b50572da718fb8@eucas1p1.samsung.com

#1 lore raw

PATCH 1/1 vhost: fix silent queue enabling with legacy guests

vhost should notify the application in case of all vring state changes.

In general, application should not care about negotiation of VHOST_USER_F_PROTOCOL_FEATURES. Protocol details like this should be hidden by the vhost library.

With this patch applications like OVS will be able to assume that all vrings disabled by default and only process 'vring_state_changed' events.

Fixes 321203a54ba7 ("vhost: enable rings at the right time")
---
 lib/librte_vhost/vhost_user.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
lib/librte_vhost/vhost_user.c +5 -1
index 23beed97d..c9e29ece8 100644
@@ -1231,8 +1231,12 @@ vhost_user_set_vring_kick(struct virtio_net **pdev, struct VhostUserMsg *msg,
 	 * the ring starts already enabled. Otherwise, it is enabled via
 	 * the SET_VRING_ENABLE message.
 	 */
-	if (!(dev->features & (1ULL << VHOST_USER_F_PROTOCOL_FEATURES)))
+	if (!(dev->features & (1ULL << VHOST_USER_F_PROTOCOL_FEATURES))) {
 		vq->enabled = 1;
+		if (dev->notify_ops->vring_state_changed)
+			dev->notify_ops->vring_state_changed(
+				dev->vid, file.index, 1);
+	}
 
 	if (vq->kickfd >= 0)
 		close(vq->kickfd);
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#2 lore raw
Quoted 27 lines · Ilya Maximets

vhost should notify the application in case of all vring state changes.

In general, application should not care about negotiation of VHOST_USER_F_PROTOCOL_FEATURES. Protocol details like this should be hidden by the vhost library.

With this patch applications like OVS will be able to assume that all vrings disabled by default and only process 'vring_state_changed' events.

Fixes 321203a54ba7 ("vhost: enable rings at the right time")
---
  lib/librte_vhost/vhost_user.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
lib/librte_vhost/vhost_user.c +0 -0
index 23beed97d..c9e29ece8 100644
@@ -1231,8 +1231,12 @@ vhost_user_set_vring_kick(struct virtio_net **pdev, struct VhostUserMsg *msg,
  	 * the ring starts already enabled. Otherwise, it is enabled via
  	 * the SET_VRING_ENABLE message.
  	 */

lib/librte_vhost/vhost_user.c vhost_user_set_vring_kick(struct virtio_net **pdev, struct VhostUserMsg *msg, · line 1242

Quoted 10 lines
lib/librte_vhost/vhost_user.c +5 -1
-	if (!(dev->features & (1ULL << VHOST_USER_F_PROTOCOL_FEATURES)))
+	if (!(dev->features & (1ULL << VHOST_USER_F_PROTOCOL_FEATURES))) {
  		vq->enabled = 1;
+		if (dev->notify_ops->vring_state_changed)
+			dev->notify_ops->vring_state_changed(
+				dev->vid, file.index, 1);
+	}
 
  	if (vq->kickfd >= 0)
  		close(vq->kickfd);

Nice, this is indeed the right thing to do:

Thanks,
Maxime

#3 lore raw
In reply to Ilya Maximets
Quoted 10 lines · Ilya Maximets

vhost should notify the application in case of all vring state changes.

In general, application should not care about negotiation of VHOST_USER_F_PROTOCOL_FEATURES. Protocol details like this should be hidden by the vhost library.

With this patch applications like OVS will be able to assume that all vrings disabled by default and only process 'vring_state_changed' events.

Quoted 7 lines
Fixes 321203a54ba7 ("vhost: enable rings at the right time")
---
  lib/librte_vhost/vhost_user.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)

Applied to dpdk-next-virtio/master.

Thanks,
Maxime