]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
nfp: avoid soft lockups under control message storm
authorJakub Kicinski <jakub.kicinski@netronome.com>
Tue, 2 Oct 2018 17:10:14 +0000 (10:10 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 2 Oct 2018 18:47:58 +0000 (11:47 -0700)
When FW floods the driver with control messages try to exit the cmsg
processing loop every now and then to avoid soft lockups.  Cmsg
processing is generally very lightweight so 512 seems like a reasonable
budget, which should not be exceeded under normal conditions.

Fixes: 77ece8d5f196 ("nfp: add control vNIC datapath")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Tested-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/nfp_net_common.c

index 8ed38fd5a8520e0e125d96bc2ee7c53d891a5969..c6d29fdbb880f1964847e674dc512d2f0311f0b7 100644 (file)
@@ -2077,14 +2077,17 @@ nfp_ctrl_rx_one(struct nfp_net *nn, struct nfp_net_dp *dp,
        return true;
 }
 
-static void nfp_ctrl_rx(struct nfp_net_r_vector *r_vec)
+static bool nfp_ctrl_rx(struct nfp_net_r_vector *r_vec)
 {
        struct nfp_net_rx_ring *rx_ring = r_vec->rx_ring;
        struct nfp_net *nn = r_vec->nfp_net;
        struct nfp_net_dp *dp = &nn->dp;
+       unsigned int budget = 512;
 
-       while (nfp_ctrl_rx_one(nn, dp, r_vec, rx_ring))
+       while (nfp_ctrl_rx_one(nn, dp, r_vec, rx_ring) && budget--)
                continue;
+
+       return budget;
 }
 
 static void nfp_ctrl_poll(unsigned long arg)
@@ -2096,9 +2099,13 @@ static void nfp_ctrl_poll(unsigned long arg)
        __nfp_ctrl_tx_queued(r_vec);
        spin_unlock_bh(&r_vec->lock);
 
-       nfp_ctrl_rx(r_vec);
-
-       nfp_net_irq_unmask(r_vec->nfp_net, r_vec->irq_entry);
+       if (nfp_ctrl_rx(r_vec)) {
+               nfp_net_irq_unmask(r_vec->nfp_net, r_vec->irq_entry);
+       } else {
+               tasklet_schedule(&r_vec->tasklet);
+               nn_dp_warn(&r_vec->nfp_net->dp,
+                          "control message budget exceeded!\n");
+       }
 }
 
 /* Setup and Configuration