Skip to content

Commit 28abe57

Browse files
Fred Lotterdavem330
authored andcommitted
nfp: flower: cmsg rtnl locks can timeout reify messages
Flower control message replies are handled in different locations. The truly high priority replies are handled in the BH (tasklet) context, while the remaining replies are handled in a predefined Linux work queue. The work queue handler orders replies into high and low priority groups, and always start servicing the high priority replies within the received batch first. Reply Type: Rtnl Lock: Handler: CMSG_TYPE_PORT_MOD no BH tasklet (mtu) CMSG_TYPE_TUN_NEIGH no BH tasklet CMSG_TYPE_FLOW_STATS no BH tasklet CMSG_TYPE_PORT_REIFY no WQ high CMSG_TYPE_PORT_MOD yes WQ high (link/mtu) CMSG_TYPE_MERGE_HINT yes WQ low CMSG_TYPE_NO_NEIGH no WQ low CMSG_TYPE_ACTIVE_TUNS no WQ low CMSG_TYPE_QOS_STATS no WQ low CMSG_TYPE_LAG_CONFIG no WQ low A subset of control messages can block waiting for an rtnl lock (from both work queue priority groups). The rtnl lock is heavily contended for by external processes such as systemd-udevd, systemd-network and libvirtd, especially during netdev creation, such as when flower VFs and representors are instantiated. Kernel netlink instrumentation shows that external processes (such as systemd-udevd) often use successive rtnl_trylock() sequences, which can result in an rtnl_lock() blocked control message to starve for longer periods of time during rtnl lock contention, i.e. netdev creation. In the current design a single blocked control message will block the entire work queue (both priorities), and introduce a latency which is nondeterministic and dependent on system wide rtnl lock usage. In some extreme cases, one blocked control message at exactly the wrong time, just before the maximum number of VFs are instantiated, can block the work queue for long enough to prevent VF representor REIFY replies from getting handled in time for the 40ms timeout. The firmware will deliver the total maximum number of REIFY message replies in around 300us. Only REIFY and MTU update messages require replies within a timeout period (of 40ms). The MTU-only updates are already done directly in the BH (tasklet) handler. Move the REIFY handler down into the BH (tasklet) in order to resolve timeouts caused by a blocked work queue waiting on rtnl locks. Signed-off-by: Fred Lotter <[email protected]> Signed-off-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3dcbdb1 commit 28abe57

File tree

1 file changed

+5
-5
lines changed
  • drivers/net/ethernet/netronome/nfp/flower

1 file changed

+5
-5
lines changed

drivers/net/ethernet/netronome/nfp/flower/cmsg.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,6 @@ nfp_flower_cmsg_process_one_rx(struct nfp_app *app, struct sk_buff *skb)
260260

261261
type = cmsg_hdr->type;
262262
switch (type) {
263-
case NFP_FLOWER_CMSG_TYPE_PORT_REIFY:
264-
nfp_flower_cmsg_portreify_rx(app, skb);
265-
break;
266263
case NFP_FLOWER_CMSG_TYPE_PORT_MOD:
267264
nfp_flower_cmsg_portmod_rx(app, skb);
268265
break;
@@ -328,8 +325,7 @@ nfp_flower_queue_ctl_msg(struct nfp_app *app, struct sk_buff *skb, int type)
328325
struct nfp_flower_priv *priv = app->priv;
329326
struct sk_buff_head *skb_head;
330327

331-
if (type == NFP_FLOWER_CMSG_TYPE_PORT_REIFY ||
332-
type == NFP_FLOWER_CMSG_TYPE_PORT_MOD)
328+
if (type == NFP_FLOWER_CMSG_TYPE_PORT_MOD)
333329
skb_head = &priv->cmsg_skbs_high;
334330
else
335331
skb_head = &priv->cmsg_skbs_low;
@@ -368,6 +364,10 @@ void nfp_flower_cmsg_rx(struct nfp_app *app, struct sk_buff *skb)
368364
} else if (cmsg_hdr->type == NFP_FLOWER_CMSG_TYPE_TUN_NEIGH) {
369365
/* Acks from the NFP that the route is added - ignore. */
370366
dev_consume_skb_any(skb);
367+
} else if (cmsg_hdr->type == NFP_FLOWER_CMSG_TYPE_PORT_REIFY) {
368+
/* Handle REIFY acks outside wq to prevent RTNL conflict. */
369+
nfp_flower_cmsg_portreify_rx(app, skb);
370+
dev_consume_skb_any(skb);
371371
} else {
372372
nfp_flower_queue_ctl_msg(app, skb, cmsg_hdr->type);
373373
}

0 commit comments

Comments
 (0)