macvtap/macvlan: use IFF_NO_QUEUE
Subsystems (2)
PATCH 1/1 macvtap/macvlan: use IFF_NO_QUEUE
For macvlan, switch to use IFF_NO_QUEUE instead of tx_queue_len = 0.
For macvtap, after commit 6acf54f1cf0a6747bac9fea26f34cfc5a9029523 ("macvtap: Add support of packet capture on macvtap device."). Multiqueue macvtap suffers from single qdisc lock contention. This is because macvtap claims a non zero tx_queue_len and it reuses this value as it socket receive queue size.Thanks to IFF_NO_QUEUE, we can remove the lock contention without breaking existing socket receive queue length logic.
--- drivers/net/macvlan.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/macvlan.c +1 -2
@@ -1056,7 +1056,7 @@ void macvlan_common_setup(struct net_device *dev) dev->priv_flags &= ~IFF_TX_SKB_SHARING ;netif_keep_dst (dev); - dev->priv_flags |=IFF_UNICAST_FLT ; + dev->priv_flags |=IFF_UNICAST_FLT |IFF_NO_QUEUE ; dev->netdev_ops = &macvlan_netdev_ops; dev->destructor = free_netdev; dev->header_ops = &macvlan_hard_header_ops;
@@ -1067,7 +1067,6 @@ EXPORT_SYMBOL_GPL(macvlan_common_setup);static void macvlan_setup (struct net_device *dev) {macvlan_common_setup (dev); - dev->tx_queue_len =0 ; }static int macvlan_port_create (struct net_device *dev)
Signature · 1 line
2.1.4
Quoted 10 lines · Jason Wang
For macvlan, switch to use
IFF_NO_QUEUEinstead oftx_queue_len= 0.For macvtap, after commit
6acf54f1cf0a6747bac9fea26f34cfc5a9029523("macvtap: Add support of packet capture on macvtap device."). Multiqueue macvtap suffers from single qdisc lock contention. This is because macvtap claims a non zerotx_queue_lenand it reuses this value as it socket receive queue size.Thanks toIFF_NO_QUEUE, we can remove the lock contention without breaking existing socket receive queue length logic.
Quoted 4 lines
Cc Patrick McHardy <[email protected]>Cc Vladislav Yasevich <[email protected]>Cc Michael S. Tsirkin <[email protected]>Signed-off-by Jason Wang <[email protected]>
Seems to make sense. Give me a day or two to get over the jet lag (and get out from under the pile of mail accumulated while I was traveling), I'll review properly and ack.
Quoted 27 lines
--- drivers/net/macvlan.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/net/macvlan.c +1
-2@@ -1056,7 +1056,7 @@ void macvlan_common_setup(struct net_device *dev) dev->priv_flags &= ~IFF_TX_SKB_SHARING ;netif_keep_dst (dev); - dev->priv_flags |=IFF_UNICAST_FLT ; + dev->priv_flags |=IFF_UNICAST_FLT |IFF_NO_QUEUE ; dev->netdev_ops = &macvlan_netdev_ops; dev->destructor = free_netdev; dev->header_ops = &macvlan_hard_header_ops;@@ -1067,7 +1067,6 @@ EXPORT_SYMBOL_GPL(macvlan_common_setup);static void macvlan_setup (struct net_device *dev) {macvlan_common_setup (dev); - dev->tx_queue_len =0 ; }static int macvlan_port_create (struct net_device *dev)Signature · 1 line
2.1.4
Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Jason Wang
Quoted 10 lines
For macvlan, switch to use
IFF_NO_QUEUEinstead oftx_queue_len= 0.For macvtap, after commit
6acf54f1cf0a6747bac9fea26f34cfc5a9029523("macvtap: Add support of packet capture on macvtap device."). Multiqueue macvtap suffers from single qdisc lock contention. This is because macvtap claims a non zerotx_queue_lenand it reuses this value as it socket receive queue size.Thanks toIFF_NO_QUEUE, we can remove the lock contention without breaking existing socket receive queue length logic.
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Cc Patrick McHardy <[email protected]>Cc Vladislav Yasevich <[email protected]>Cc Michael S. Tsirkin <[email protected]>Signed-off-by Jason Wang <[email protected]>Seems to make sense. Give me a day or two to get over the jet lag (and get out from under the pile of mail accumulated while I was traveling), I'll review properly and ack.
A note on this patch: only default qdisc were removed but we don't lose the ability to attach a qdisc to macvtap (though it may cause lock contention on multiqueue case).
Quoted 18 lines · Jason Wang
Quoted 15 lines · Michael S. Tsirkin
Quoted 14 lines · Jason Wang
Quoted 14 lines
For macvlan, switch to use
IFF_NO_QUEUEinstead oftx_queue_len= 0.For macvtap, after commit
6acf54f1cf0a6747bac9fea26f34cfc5a9029523("macvtap: Add support of packet capture on macvtap device."). Multiqueue macvtap suffers from single qdisc lock contention. This is because macvtap claims a non zerotx_queue_lenand it reuses this value as it socket receive queue size.Thanks toIFF_NO_QUEUE, we can remove the lock contention without breaking existing socket receive queue length logic.Cc Patrick McHardy <[email protected]>Cc Vladislav Yasevich <[email protected]>Cc Michael S. Tsirkin <[email protected]>Signed-off-by Jason Wang <[email protected]>
Quoted 9 lines
Quoted 4 lines
Seems to make sense. Give me a day or two to get over the jet lag (and get out from under the pile of mail accumulated while I was traveling), I'll review properly and ack.
A note on this patch: only default qdisc were removed but we don't lose the ability to attach a qdisc to macvtap (though it may cause lock contention on multiqueue case).
Wouldn't that lock contention be solved if we really had multiple queues for multi-queue macvtaps?
-vlad
Quoted 22 lines · Vlad Yasevich
Quoted 21 lines · Jason Wang
Quoted 19 lines · Michael S. Tsirkin
Quoted 10 lines · Jason Wang
Quoted 10 lines
For macvlan, switch to use
IFF_NO_QUEUEinstead oftx_queue_len= 0.For macvtap, after commit
6acf54f1cf0a6747bac9fea26f34cfc5a9029523("macvtap: Add support of packet capture on macvtap device."). Multiqueue macvtap suffers from single qdisc lock contention. This is because macvtap claims a non zerotx_queue_lenand it reuses this value as it socket receive queue size.Thanks toIFF_NO_QUEUE, we can remove the lock contention without breaking existing socket receive queue length logic.Quoted 4 lines
Quoted 4 lines
Cc Patrick McHardy <[email protected]>Cc Vladislav Yasevich <[email protected]>Cc Michael S. Tsirkin <[email protected]>Signed-off-by Jason Wang <[email protected]>Seems to make sense. Give me a day or two to get over the jet lag (and get out from under the pile of mail accumulated while I was traveling), I'll review properly and ack.
Quoted 8 lines
Quoted 4 lines
A note on this patch: only default qdisc were removed but we don't lose the ability to attach a qdisc to macvtap (though it may cause lock contention on multiqueue case).
Wouldn't that lock contention be solved if we really had multiple queues for multi-queue macvtaps?
-vlad
Yes, but this introduce another layer of txq locks contention? And it also needs macvlan multiqueue support. We used to do something like this but switch to NETIF_F_LLTX finally. You may refer:
2c11455321f37da6fe6cc36353149f9ac9183334 macvlan: add multiqueue capability 8ffab51b3dfc54876f145f15b351c41f3f703195 macvlan: lockless tx path
Quoted 29 lines · Jason Wang
Quoted 26 lines · Vlad Yasevich
Quoted 25 lines · Jason Wang
Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Jason Wang
Quoted 10 lines
For macvlan, switch to use
IFF_NO_QUEUEinstead oftx_queue_len= 0.For macvtap, after commit
6acf54f1cf0a6747bac9fea26f34cfc5a9029523("macvtap: Add support of packet capture on macvtap device."). Multiqueue macvtap suffers from single qdisc lock contention. This is because macvtap claims a non zerotx_queue_lenand it reuses this value as it socket receive queue size.Thanks toIFF_NO_QUEUE, we can remove the lock contention without breaking existing socket receive queue length logic.Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Cc Patrick McHardy <[email protected]>Cc Vladislav Yasevich <[email protected]>Cc Michael S. Tsirkin <[email protected]>Signed-off-by Jason Wang <[email protected]>Seems to make sense. Give me a day or two to get over the jet lag (and get out from under the pile of mail accumulated while I was traveling), I'll review properly and ack.
A note on this patch: only default qdisc were removed but we don't lose the ability to attach a qdisc to macvtap (though it may cause lock contention on multiqueue case).
Quoted 6 lines
Quoted 4 lines
Wouldn't that lock contention be solved if we really had multiple queues for multi-queue macvtaps?
-vlad
Yes, but this introduce another layer of txq locks contention?
I don't follow - why does it? Could you clarify please?
Quoted 6 lines
And it
also needs macvlan multiqueue support. We used to do something like this but switch toNETIF_F_LLTXfinally. You may refer:
2c11455321f37da6fe6cc36353149f9ac9183334macvlan: add multiqueue capability8ffab51b3dfc54876f145f15b351c41f3f703195macvlan: lockless tx path
My concern is that the moment someone configures a non-standard qdisc scalability suddenly disappears. That would also be tricky to debug in the field as not a lot of developers use non-standard qdiscs.
What do you think?
Signature · 1 line
MST
Quoted 28 lines · Michael S. Tsirkin
Quoted 27 lines · Jason Wang
Quoted 25 lines · Vlad Yasevich
Quoted 24 lines · Jason Wang
Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Jason Wang
Quoted 10 lines
For macvlan, switch to use
IFF_NO_QUEUEinstead oftx_queue_len= 0.For macvtap, after commit
6acf54f1cf0a6747bac9fea26f34cfc5a9029523("macvtap: Add support of packet capture on macvtap device."). Multiqueue macvtap suffers from single qdisc lock contention. This is because macvtap claims a non zerotx_queue_lenand it reuses this value as it socket receive queue size.Thanks toIFF_NO_QUEUE, we can remove the lock contention without breaking existing socket receive queue length logic.Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Cc Patrick McHardy <[email protected]>Cc Vladislav Yasevich <[email protected]>Cc Michael S. Tsirkin <[email protected]>Signed-off-by Jason Wang <[email protected]>Seems to make sense. Give me a day or two to get over the jet lag (and get out from under the pile of mail accumulated while I was traveling), I'll review properly and ack.
A note on this patch: only default qdisc were removed but we don't lose the ability to attach a qdisc to macvtap (though it may cause lock contention on multiqueue case).
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
Wouldn't that lock contention be solved if we really had multiple queues for multi-queue macvtaps?
-vlad
Yes, but this introduce another layer of txq locks contention?
I don't follow - why does it? Could you clarify please?
I believe Vlad wants to remove NETIF_F_LLTX. If yes, core will do an extra tx lock at macvlan layer.
Quoted 11 lines
Quoted 7 lines
And it
also needs macvlan multiqueue support. We used to do something like this but switch toNETIF_F_LLTXfinally. You may refer:
2c11455321f37da6fe6cc36353149f9ac9183334macvlan: add multiqueue capability8ffab51b3dfc54876f145f15b351c41f3f703195macvlan: lockless tx pathMy concern is that the moment someone configures a non-standard qdisc scalability suddenly disappears. That would also be tricky to debug in the field as not a lot of developers use non-standard qdiscs.
What do you think?
Probably not an issue. Non-standard qdisc may need be attached manually after device creation, and we don't lose this ability with this patch. (Unless somebody changes default_qdisc). Actually, user before 6acf54f1cf0a6747bac9fea26f34cfc5a9029523 does not expect any qdisc work for macvtap like other stacked devices. This patch also restore this.
Quoted 34 lines · Jason Wang
Quoted 31 lines · Michael S. Tsirkin
Quoted 30 lines · Jason Wang
Quoted 28 lines · Vlad Yasevich
Quoted 16 lines · Jason Wang
Quoted 15 lines · Michael S. Tsirkin
Quoted 14 lines · Jason Wang
Quoted 14 lines
For macvlan, switch to use
IFF_NO_QUEUEinstead oftx_queue_len= 0.For macvtap, after commit
6acf54f1cf0a6747bac9fea26f34cfc5a9029523("macvtap: Add support of packet capture on macvtap device."). Multiqueue macvtap suffers from single qdisc lock contention. This is because macvtap claims a non zerotx_queue_lenand it reuses this value as it socket receive queue size.Thanks toIFF_NO_QUEUE, we can remove the lock contention without breaking existing socket receive queue length logic.Cc Patrick McHardy <[email protected]>Cc Vladislav Yasevich <[email protected]>Cc Michael S. Tsirkin <[email protected]>Signed-off-by Jason Wang <[email protected]>Quoted 8 lines
Quoted 4 lines
Seems to make sense. Give me a day or two to get over the jet lag (and get out from under the pile of mail accumulated while I was traveling), I'll review properly and ack.
A note on this patch: only default qdisc were removed but we don't lose the ability to attach a qdisc to macvtap (though it may cause lock contention on multiqueue case).
Wouldn't that lock contention be solved if we really had multiple queues for multi-queue macvtaps?
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
-vlad
Yes, but this introduce another layer of txq locks contention?
I don't follow - why does it? Could you clarify please?
I believe Vlad wants to remove
NETIF_F_LLTX. If yes, core will do an extra tx lock at macvlan layer.
No, I don't want to remove it. In a sense, it would function similar to how it works when fwd_priv is populated. I am still testing the code as it's showing some strange artifacts... could be due to keeping LLTX.
-vlad
Quoted 20 lines
Quoted 6 lines
Quoted 6 lines
And it
also needs macvlan multiqueue support. We used to do something like this but switch toNETIF_F_LLTXfinally. You may refer:Quoted 6 lines
Quoted 2 lines
2c11455321f37da6fe6cc36353149f9ac9183334macvlan: add multiqueue capability8ffab51b3dfc54876f145f15b351c41f3f703195macvlan: lockless tx pathMy concern is that the moment someone configures a non-standard qdisc scalability suddenly disappears. That would also be tricky to debug in the field as not a lot of developers use non-standard qdiscs.
What do you think?Probably not an issue. Non-standard qdisc may need be attached manually after device creation, and we don't lose this ability with this patch. (Unless somebody changes
default_qdisc). Actually, user before6acf54f1cf0a6747bac9fea26f34cfc5a9029523does not expect any qdisc work for macvtap like other stacked devices. This patch also restore this.
Quoted 39 lines · Vlad Yasevich
Quoted 38 lines · Jason Wang
Quoted 38 lines · Michael S. Tsirkin
Quoted 34 lines
Quoted 34 lines · Jason Wang
Quoted 27 lines
Quoted 27 lines · Vlad Yasevich
Quoted 25 lines
Quoted 25 lines · Jason Wang
Quoted 24 lines
Quoted 24 lines · Michael S. Tsirkin
Quoted 11 lines
Quoted 11 lines · Jason Wang
For macvlan, switch to use IFF_NO_QUEUE instead of tx_queue_len = 0.
For macvtap, after commit 6acf54f1cf0a6747bac9fea26f34cfc5a9029523
("macvtap: Add support of packet capture on macvtap
device."). Multiqueue macvtap suffers from single qdisc lock
contention. This is because macvtap claims a non zero tx_queue_len and
it reuses this value as it socket receive queue size.Thanks to
IFF_NO_QUEUE, we can remove the lock contention without breaking
existing socket receive queue length logic.Quoted 8 lines
Quoted 8 lines
Cc: Patrick McHardy <[email protected]>
Cc: Vladislav Yasevich <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Signed-off-by: Jason Wang <[email protected]>
Seems to make sense. Give me a day or two to get over the jet lag
(and get out from under the pile of mail accumulated while I was traveling),
I'll review properly and ack.A note on this patch: only default qdisc were removed but we don't lose the ability to attach a qdisc to macvtap (though it may cause lock contention on multiqueue case).
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Wouldn't that lock contention be solved if we really had multiple queues for multi-queue macvtaps?
-vlad
Yes, but this introduce another layer of txq locks contention?
I don't follow - why does it? Could you clarify please?
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
I believe Vlad wants to remove
NETIF_F_LLTX. If yes, core will do an extra tx lock at macvlan layer.No, I don't want to remove it. In a sense, it would function similar to how it works when
fwd_privis populated. I am still testing the code as it's showing some strange artifacts... could be due to keeping LLTX.-vlad
I see. I'm ok to wait for your code. But if a patch of just two lines works, probably no need to try complex method.
Thanks