From: Joakim Zhang <qiangqing.zhang@nxp.com>
To: peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com
Cc: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org,
linux-imx@nxp.com
Subject: [PATCH 4/4] net: ethernet: stmmac: delete the eee_ctrl_timer after napi disabled
Date: Wed, 2 Dec 2020 16:59:49 +0800 [thread overview]
Message-ID: <20201202085949.3279-6-qiangqing.zhang@nxp.com> (raw)
In-Reply-To: <20201202085949.3279-1-qiangqing.zhang@nxp.com>
From: Fugang Duan <fugang.duan@nxp.com>
There have chance to re-enable the eee_ctrl_timer and fire the timer
in napi callback after delete the timer in .stmmac_release(), which
introduces to access eee registers in the timer function after clocks
are disabled then causes system hang. Found this issue when do
suspend/resume and reboot stress test.
It is safe to delete the timer after napi disabled and disable lpi mode.
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 53c5d77eba57..03c6995d276a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2938,9 +2938,6 @@ static int stmmac_release(struct net_device *dev)
struct stmmac_priv *priv = netdev_priv(dev);
u32 chan;
- if (priv->eee_enabled)
- del_timer_sync(&priv->eee_ctrl_timer);
-
if (device_may_wakeup(priv->device))
phylink_speed_down(priv->phylink, false);
/* Stop and disconnect the PHY */
@@ -2959,6 +2956,11 @@ static int stmmac_release(struct net_device *dev)
if (priv->lpi_irq > 0)
free_irq(priv->lpi_irq, dev);
+ if (priv->eee_enabled) {
+ priv->tx_path_in_lpi_mode = false;
+ del_timer_sync(&priv->eee_ctrl_timer);
+ }
+
/* Stop TX/RX DMA and clear the descriptors */
stmmac_stop_all_dma(priv);
@@ -5185,6 +5187,11 @@ int stmmac_suspend(struct device *dev)
for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
hrtimer_cancel(&priv->tx_queue[chan].txtimer);
+ if (priv->eee_enabled) {
+ priv->tx_path_in_lpi_mode = false;
+ del_timer_sync(&priv->eee_ctrl_timer);
+ }
+
/* Stop TX/RX DMA */
stmmac_stop_all_dma(priv);
--
2.17.1
next prev parent reply other threads:[~2020-12-02 9:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-02 8:59 [PATCH 0/4] patch for stmmac Joakim Zhang
2020-12-02 8:59 ` [PATCH] LF-2678 net: ethernet: stmmac: delete the eee_ctrl_timer after napi disabled Joakim Zhang
2020-12-02 9:12 ` Joakim Zhang
2020-12-02 8:59 ` [PATCH 1/4] net: stmmac: dwmac4_lib: increase the timeout for dma reset Joakim Zhang
2020-12-02 8:59 ` [PATCH 2/4] net: stmmac: start phylink instance before stmmac_hw_setup() Joakim Zhang
2020-12-03 18:31 ` Jakub Kicinski
2020-12-02 8:59 ` [PATCH 3/4] net: ethernet: stmmac: free tx skb buffer in stmmac_resume() Joakim Zhang
2020-12-03 18:32 ` Jakub Kicinski
2020-12-02 8:59 ` Joakim Zhang [this message]
2020-12-03 18:33 ` [PATCH 4/4] net: ethernet: stmmac: delete the eee_ctrl_timer after napi disabled Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201202085949.3279-6-qiangqing.zhang@nxp.com \
--to=qiangqing.zhang@nxp.com \
--cc=alexandre.torgue@st.com \
--cc=davem@davemloft.net \
--cc=joabreu@synopsys.com \
--cc=kuba@kernel.org \
--cc=linux-imx@nxp.com \
--cc=netdev@vger.kernel.org \
--cc=peppe.cavallaro@st.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).