Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9186158pxu; Mon, 28 Dec 2020 08:44:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJxJQuDDD0LJ/dWeZEX6w2/DQDRJPQz7+Q8C/pcVUnwLiRsSXfHNUiOAlZWzlQ1cPvVl4BJj X-Received: by 2002:a17:907:2061:: with SMTP id qp1mr41031440ejb.222.1609173868206; Mon, 28 Dec 2020 08:44:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609173868; cv=none; d=google.com; s=arc-20160816; b=tftZPzk8Z5zBL91rj0ZpYXeqMznctFrLb6NNEhVPEh264x8B0Y6pWLacATlVrGUxEn mUC1hg/q9maSzX4dyo59S8Nf+8T8pcyoFSDYADpv4YNe3YcMN38xUMJev28a92g4KfgT 273azXF4xga0rdxY2thGlvE6J67TTIJucNTHuoBmlziQWyvytr+86Ue6igGIPk3PZpMH EUQg+A6ZeHN/vzNZwfP2JOY/MXDqQPNSjB1Yf9Lzy8glhJYii7WNZDTfYqgpDepk+shi 1N1XI76fj/fqrxg7uI6jV6JyGY1Al0MIL3jgiW909adWXumZqvpJCeqt3OD5BMT5rR90 Fsjw== 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:dkim-signature; bh=FyLYGs4SppVkVZK1kOBFORqjmfPb60p001xmKxwFrx4=; b=cNtgecLWq0klMJnSLrwr7PDaX1QZGg0/BtY8O+rVQEvLCcS7LeTF99nhkoa7xfrxew t05TpkXnM1hhKu9PmaACacAtsaF6MOkCS6frOSMau33/eTeDBiojO6Ct3uBnN3NiP4UV qlYDNgVmEmpZA7Qj5vAydIkdNfJ2BRJqUFcTPJWaMdUpwHuJrgTZV0MtmofXgp+K/JcU VE/mNmfQiTqC7hEKENEwo08+FLNd7ZM4CWMkxFptkJDnx2w32uloMGxTIAtvKwiCxsDH OTzF5+YYD0/592cnmLC4ter5wlsd3LsNtsoWNRdFGqO1WdFDVZOK5W15LjiO7mDbImn2 HBqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YMe9lSv4; 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=pass (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 dn20si21520704ejc.47.2020.12.28.08.44.04; Mon, 28 Dec 2020 08:44:28 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YMe9lSv4; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729038AbgL1M7c (ORCPT + 99 others); Mon, 28 Dec 2020 07:59:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:55680 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728503AbgL1M72 (ORCPT ); Mon, 28 Dec 2020 07:59:28 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E31B021D94; Mon, 28 Dec 2020 12:58:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609160327; bh=beB3KdnS/DaAJM7jm61C0Sa4BbpQZzROQDLJnTqrFsA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YMe9lSv4FGOSIOVFYULeEVhsJdMDB7tKLtD0Tk1SmMzlqS0XdPqZn9x6e4z75I7Nq DuUy+FGEIhj/UpeBxy6hXbarqRs9kuPxyvbKsMqmTMcEaFmwM7FfTumpm/6t0L2Rug 1NAX8oxHMlJvkr/0gYIUgFJAgn8yM7iueqmPHqt0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fugang Duan , Joakim Zhang , "David S. Miller" Subject: [PATCH 4.9 014/175] net: stmmac: delete the eee_ctrl_timer after napi disabled Date: Mon, 28 Dec 2020 13:47:47 +0100 Message-Id: <20201228124853.947920063@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124853.216621466@linuxfoundation.org> References: <20201228124853.216621466@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 @@ -1901,9 +1901,6 @@ static int stmmac_release(struct net_dev { struct stmmac_priv *priv = netdev_priv(dev); - if (priv->eee_enabled) - del_timer_sync(&priv->eee_ctrl_timer); - /* Stop and disconnect the PHY */ if (priv->phydev) { phy_stop(priv->phydev); @@ -1924,6 +1921,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 */ priv->hw->dma->stop_tx(priv->ioaddr); priv->hw->dma->stop_rx(priv->ioaddr); @@ -3503,6 +3505,11 @@ int stmmac_suspend(struct device *dev) napi_disable(&priv->napi); + if (priv->eee_enabled) { + priv->tx_path_in_lpi_mode = false; + del_timer_sync(&priv->eee_ctrl_timer); + } + /* Stop TX/RX DMA */ priv->hw->dma->stop_tx(priv->ioaddr); priv->hw->dma->stop_rx(priv->ioaddr);