[ovs-dev,v3,2/3] netdev-dpdk: Avoid reconfiguration on VIRTIO_NET_F_MQ changes.
diff mbox series

Message ID 1556205730-10204-2-git-send-email-david.marchand@redhat.com
State Accepted
Headers show
Series
  • [ovs-dev,v3,1/3] dpif-netdev: Only poll enabled vhost queues.
Related show

Commit Message

David Marchand April 25, 2019, 3:22 p.m. UTC
At the moment, a malicious guest might negotiate VIRTIO_NET_F_MQ and
!VIRTIO_NET_F_MQ in a loop which would be seen as qp_num going from 1 to
n and n to 1 continuously, triggering datapath reconfigurations at each
transition.

Limit this by only reconfiguring on increased qp_num.
The previous patch reduced the observed cost of polling disabled queues,
so the only cost is memory.

Co-authored-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
---
Changes since v2:
- added authorship tags for Ilya

---
 lib/netdev-dpdk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ian Stokes June 26, 2019, 6:46 p.m. UTC | #1
On 4/25/2019 4:22 PM, David Marchand wrote:
> At the moment, a malicious guest might negotiate VIRTIO_NET_F_MQ and
> !VIRTIO_NET_F_MQ in a loop which would be seen as qp_num going from 1 to
> n and n to 1 continuously, triggering datapath reconfigurations at each
> transition.
> 
> Limit this by only reconfiguring on increased qp_num.
> The previous patch reduced the observed cost of polling disabled queues,
> so the only cost is memory.
> 
> Co-authored-by: Ilya Maximets <i.maximets@samsung.com>
> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Kevin Traynor <ktraynor@redhat.com>

Seems fair enough. Pushed to master.

Thanks
Ian

Patch
diff mbox series

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index ec2251e..3372373 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -3510,8 +3510,8 @@  new_device(int vid)
                 newnode = dev->socket_id;
             }
 
-            if (dev->requested_n_txq != qp_num
-                || dev->requested_n_rxq != qp_num
+            if (dev->requested_n_txq < qp_num
+                || dev->requested_n_rxq < qp_num
                 || dev->requested_socket_id != newnode) {
                 dev->requested_socket_id = newnode;
                 dev->requested_n_rxq = qp_num;