Skip to content

Commit

Permalink
nfp: fix potential deadlock when canceling dim work
Browse files Browse the repository at this point in the history
When port is linked down, the process which has acquired rtnl_lock
will wait for the in-progress dim work to finish, and the work also
acquires rtnl_lock, which may cause deadlock.

Currently IRQ_MOD registers can be configured by `ethtool -C` and
dim work, and which will take effect depends on the execution order,
rtnl_lock is useless here, so remove them.

Fixes: 9d32e4e ("nfp: add support for coalesce adaptive feature")
Signed-off-by: Yinjun Zhang <yinjun.zhang@corigine.com>
Signed-off-by: Louis Peens <louis.peens@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Yinjun Zhang authored and David S. Miller committed Oct 29, 2021
1 parent f8d384a commit 17e712c
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions drivers/net/ethernet/netronome/nfp/nfp_net_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -3016,10 +3016,8 @@ static void nfp_net_rx_dim_work(struct work_struct *work)

/* copy RX interrupt coalesce parameters */
value = (moder.pkts << 16) | (factor * moder.usec);
rtnl_lock();
nn_writel(nn, NFP_NET_CFG_RXR_IRQ_MOD(r_vec->rx_ring->idx), value);
(void)nfp_net_reconfig(nn, NFP_NET_CFG_UPDATE_IRQMOD);
rtnl_unlock();

dim->state = DIM_START_MEASURE;
}
Expand Down Expand Up @@ -3047,10 +3045,8 @@ static void nfp_net_tx_dim_work(struct work_struct *work)

/* copy TX interrupt coalesce parameters */
value = (moder.pkts << 16) | (factor * moder.usec);
rtnl_lock();
nn_writel(nn, NFP_NET_CFG_TXR_IRQ_MOD(r_vec->tx_ring->idx), value);
(void)nfp_net_reconfig(nn, NFP_NET_CFG_UPDATE_IRQMOD);
rtnl_unlock();

dim->state = DIM_START_MEASURE;
}
Expand Down

0 comments on commit 17e712c

Please sign in to comment.