Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2879331pxu; Sat, 19 Dec 2020 05:08:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJx6++y6O5oSroXheRSySZllJICJW2OxhPAl/83Ohq2zfqOKsXeHuNOYJRyD4WduuEzDxsfL X-Received: by 2002:a05:6402:379:: with SMTP id s25mr8949789edw.367.1608383280760; Sat, 19 Dec 2020 05:08:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608383280; cv=none; d=google.com; s=arc-20160816; b=FTB5LpIT4eivq3CDVwBracuTgBuc6w+6RBGY1z0NrO59a1GBpJYk8Dj2y0liluuRgn 83oJf0Qtq1qdyPz89y2BtldAddV/c47fSyFBDRD0YyGIHtsORg80sZFGJCXCKLodiDMg f/cyOFv10uH+QkTcCzeg3zuHBaISReBnLp52huw7z0gLbjBdTgIC5kFlN5+YKxtGL9dW ZGKsuXweQ5lnhwi+jbhgvZbr+YkKEy4sFbcW5bVTilVkg6ZPJ/S/58cisodNNP0C1x5d Rznf2vRzjLIyKHA5FTicFmUz15D9vA2tJPXozEl01VPXcaT10czHri27N7B0qWniGUF1 dPyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=MascK5eMoDY7aDBmFC/y0j5BdPya5PtFZE2vRfDRofI=; b=x7dTGRpUKFY5URZD5ZFou78uWebS6BAz/16x586VWgBjjjApBO7R3KBNfQ4mv8KK0F /ePTIgN3JDoaKz/IPsXo6TNg7daxLwAWmejp0jKG2JNMEzzIa0bGrbI5oDRS6Zvb8Xo4 wX30+5hKsYtM7beNmPxZmuNA7eKR0ETRK4wRjxtotvleuzZfqlQ4tukGMR+mSUmo1bVf rDj2nKkS+sdPpNcvBiwZmcDwXmEL9iLb2EMAyVsI1s4QEd1jQHN/v3w+jaXOUnEuqsfo C66LvOkLXmCTZ645BUQ4qM3s+fmGLzthvPEDKkhyeGup9OMszAm6yidWEZxrRVBvugB5 EVTQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z23si6158642ejn.209.2020.12.19.05.07.37; Sat, 19 Dec 2020 05:08:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726853AbgLSNDv (ORCPT + 99 others); Sat, 19 Dec 2020 08:03:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:51324 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728338AbgLSNDn (ORCPT ); Sat, 19 Dec 2020 08:03:43 -0500 From: Greg Kroah-Hartman Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fugang Duan , Joakim Zhang , "David S. Miller" Subject: [PATCH 5.4 18/34] net: stmmac: delete the eee_ctrl_timer after napi disabled Date: Sat, 19 Dec 2020 14:03:15 +0100 Message-Id: <20201219125342.282529755@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201219125341.384025953@linuxfoundation.org> References: <20201219125341.384025953@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fugang Duan [ Upstream commit 5f58591323bf3f342920179f24515935c4b5fd60 ] 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. Fixes: d765955d2ae0b ("stmmac: add the Energy Efficient Ethernet support") Signed-off-by: Fugang Duan Signed-off-by: Joakim Zhang Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2758,9 +2758,6 @@ static int stmmac_release(struct net_dev struct stmmac_priv *priv = netdev_priv(dev); u32 chan; - if (priv->eee_enabled) - del_timer_sync(&priv->eee_ctrl_timer); - /* Stop and disconnect the PHY */ phylink_stop(priv->phylink); phylink_disconnect_phy(priv->phylink); @@ -2777,6 +2774,11 @@ static int stmmac_release(struct net_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); @@ -4761,6 +4763,11 @@ int stmmac_suspend(struct device *dev) for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) del_timer_sync(&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);