Skip to contentSkip to conversation

virtio-net: correctly enable multiqueue

PATCH Applied Jason Wang 3 participants 5 messages Dec 13, 2016

Subsystems (4)
lore
Share & tools
lore

Jason Wang

author
#0 lore raw

PATCH 1/1 virtio-net: correctly enable multiqueue

Commit 4490001029012539937ff02778fe6180613fa949 ("virtio-net: enable multiqueue by default") blindly set the affinity instead of queues during probe which can cause a mismatch of #queues between guest and host. This patch fixes it by setting queues.

Cc Neil Horman <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Fixes 49000102901 ("virtio-net: enable multiqueue by default")
---
 drivers/net/virtio_net.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/virtio_net.c +3 -1
index b425fa1..fe9f772 100644
@@ -1930,7 +1930,9 @@ static int virtnet_probe(struct virtio_device *vdev)
 		goto free_unregister_netdev;
 	}
 
-	virtnet_set_affinity(vi);
+	rtnl_lock();
+	virtnet_set_queues(vi, vi->curr_queue_pairs);
+	rtnl_unlock();
 
 	/* Assume link up if device can't report link status,
 	   otherwise get link status from config. */
Signature · 1 line
2.7.4
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Jason Wang

Commit 4490001029012539937ff02778fe6180613fa949 ("virtio-net: enable multiqueue by default") blindly set the affinity instead of queues during probe which can cause a mismatch of #queues between guest and host. This patch fixes it by setting queues.

Cc Neil Horman <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Fixes 49000102901 ("virtio-net: enable multiqueue by default")
Quoted 9 lines
---
 drivers/net/virtio_net.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/virtio_net.c +0 -0
index b425fa1..fe9f772 100644

drivers/net/virtio_net.c static int virtnet_probe(struct virtio_device *vdev) · line 1938

Quoted 10 lines
drivers/net/virtio_net.c +3 -1
@@ -1930,7 +1930,9 @@ static int virtnet_probe(struct virtio_device *vdev)
 		goto free_unregister_netdev;
 	}
 
-	virtnet_set_affinity(vi);
+	rtnl_lock();
+	virtnet_set_queues(vi, vi->curr_queue_pairs);
+	rtnl_unlock();
 
 	/* Assume link up if device can't report link status,
 	   otherwise get link status from config. */

I note that virtnet_set_channels also plays with affinity directly. Can this be changed to rely on cpu notifiers somehow?

Quoted 2 lines
Signature · 1 line
2.7.4
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Jason Wang
Quoted 11 lines · Jason Wang

Commit 4490001029012539937ff02778fe6180613fa949 ("virtio-net: enable multiqueue by default") blindly set the affinity instead of queues during probe which can cause a mismatch of #queues between guest and host. This patch fixes it by setting queues.

Cc Neil Horman <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Fixes 49000102901 ("virtio-net: enable multiqueue by default")
Quoted 9 lines
---
 drivers/net/virtio_net.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/virtio_net.c +0 -0
index b425fa1..fe9f772 100644

drivers/net/virtio_net.c static int virtnet_probe(struct virtio_device *vdev) · line 1938

Quoted 10 lines
drivers/net/virtio_net.c +3 -1
@@ -1930,7 +1930,9 @@ static int virtnet_probe(struct virtio_device *vdev)
 		goto free_unregister_netdev;
 	}
 
-	virtnet_set_affinity(vi);
+	rtnl_lock();
+	virtnet_set_queues(vi, vi->curr_queue_pairs);
+	rtnl_unlock();
 
 	/* Assume link up if device can't report link status,
 	   otherwise get link status from config. */

I note that virtnet_set_channels also plays with affinity directly. Can this be changed to rely on cpu notifiers somehow?

Quoted 2 lines
Signature · 1 line
2.7.4
maintainer Applied
#3 lore raw
In reply to Jason Wang

From: Jason Wang <[email protected]>
Date: Tue, 13 Dec 2016 14:23:05 +0800

Quoted 11 lines

Commit 4490001029012539937ff02778fe6180613fa949 ("virtio-net: enable multiqueue by default") blindly set the affinity instead of queues during probe which can cause a mismatch of #queues between guest and host. This patch fixes it by setting queues.

Cc Neil Horman <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Fixes 49000102901 ("virtio-net: enable multiqueue by default")

Applied, thanks Jason.

maintainer Applied
#4 lore raw
In reply to Jason Wang

From: Jason Wang <[email protected]>
Date: Tue, 13 Dec 2016 14:23:05 +0800

Quoted 11 lines

Commit 4490001029012539937ff02778fe6180613fa949 ("virtio-net: enable multiqueue by default") blindly set the affinity instead of queues during probe which can cause a mismatch of #queues between guest and host. This patch fixes it by setting queues.

Cc Neil Horman <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Fixes 49000102901 ("virtio-net: enable multiqueue by default")

Applied, thanks Jason.