Message ID | 20211011204806.1504406-1-jacob.e.keller@intel.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 4d4a223a86afe658cd878800f09458e8bb54415d |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net] ice: fix locking for Tx timestamp tracking flush | expand |
Hello: This patch was applied to netdev/net.git (master) by David S. Miller <davem@davemloft.net>: On Mon, 11 Oct 2021 13:48:06 -0700 you wrote: > Commit 4dd0d5c33c3e ("ice: add lock around Tx timestamp tracker flush") > added a lock around the Tx timestamp tracker flow which is used to > cleanup any left over SKBs and prepare for device removal. > > This lock is problematic because it is being held around a call to > ice_clear_phy_tstamp. The clear function takes a mutex to send a PHY > write command to firmware. This could lead to a deadlock if the mutex > actually sleeps, and causes the following warning on a kernel with > preemption debugging enabled: > > [...] Here is the summary with links: - [net] ice: fix locking for Tx timestamp tracking flush https://git.kernel.org/netdev/net/c/4d4a223a86af You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c index 05cc5870e4ef..80380aed8882 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c @@ -1313,22 +1313,21 @@ ice_ptp_flush_tx_tracker(struct ice_pf *pf, struct ice_ptp_tx *tx) { u8 idx; - spin_lock(&tx->lock); - for (idx = 0; idx < tx->len; idx++) { u8 phy_idx = idx + tx->quad_offset; - /* Clear any potential residual timestamp in the PHY block */ - if (!pf->hw.reset_ongoing) - ice_clear_phy_tstamp(&pf->hw, tx->quad, phy_idx); - + spin_lock(&tx->lock); if (tx->tstamps[idx].skb) { dev_kfree_skb_any(tx->tstamps[idx].skb); tx->tstamps[idx].skb = NULL; } - } + clear_bit(idx, tx->in_use); + spin_unlock(&tx->lock); - spin_unlock(&tx->lock); + /* Clear any potential residual timestamp in the PHY block */ + if (!pf->hw.reset_ongoing) + ice_clear_phy_tstamp(&pf->hw, tx->quad, phy_idx); + } } /**