Message ID | 20240212105010.2258421-1-john.ernberg@actia.se |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-61378-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp2352344dyd; Mon, 12 Feb 2024 02:54:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWYjCodhQvJ8rz4T7a+HKlRR2mQ8LdG00KGIk/TATEYPtgzZGtcKSq4u567/F4L0+0NVG16VGdFIdPS2ZGAfShKPuBNNA== X-Google-Smtp-Source: AGHT+IH3BrwWB5Kik6gEuY4NypLvYX4TY4MO1aKu3BSo1hm9o6rlapbZXEFmKpzeOE2RDQqsoYCp X-Received: by 2002:a05:620a:22b3:b0:785:a232:6fee with SMTP id p19-20020a05620a22b300b00785a2326feemr6407353qkh.5.1707735287549; Mon, 12 Feb 2024 02:54:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707735287; cv=pass; d=google.com; s=arc-20160816; b=sNB9VKZTKTNBWk+AfYVHsMOCOpi5iMU6AKxhWybTB1JxEhy/KzRtyRL96Qh+N0ls4M HAbsGIAGlkbnauEv0k1EcnMdBMaMolIF/ADAlYYo8+I8yMRAKoIAWvkOgBTjhFXD50q+ BYMWnlzrGwh6K8JsyVFbbHgN/HEODbKEfZhvKFLQbsf+lUcBW0q1zLgRxE4+OCVkYeeE fdvCGjX2bI2f63HWBo6Sk6RYArH9AFkk5m0IqNJpQeZN+7ouW4yeSGYXc/YslgL0szXL H8A9bB+6WNas16DsRZVw5s6oZdUyaCKCAi5LgQnfOB7Qds+B/iLGE3KZKR+Az0aYcfF+ SocA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:content-language:accept-language :message-id:date:thread-index:thread-topic:subject:cc:to:from; bh=ue40+uXcK96E+BN9uq7MxDzd4qLrWwlnPR9KwRIvg9k=; fh=vF2//gAxCmksV+J80LiE5zxrPdkrXKmv/M5QooEXewM=; b=et1YU220dl6ZeuF1WgMpcYciwBF15CrHNoUx0DOIHiCb0zbUVDT23orxvrVt+sCQwk 661cMq19JZAsBgqETN1kyaISZFxv9HhhQxm50CgeIIHX+Dq3FPsam9rdjHbS5ytNsjFh MHf5r5px+KxjfyWG2wwTXc9MkdX29H6DC6nuURX1hrl2NlhrGrRxZEas7Dckyt9M0Rpg 2zKwCIM70GZCK2NmWny4Uwua/UIRlFMH0SzCFILcdhUx4bnSsnCiWrc7fi7hoIR6K58T hREJ2L9cMtCWXJ4wH8NnpsmES2FTgf03DqQu3u/n8zArdWeiZjJFp3FpWBAByubaMoxm mM3w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=actia.se); spf=pass (google.com: domain of linux-kernel+bounces-61378-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61378-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCUq6br9lqUJcCoNYZ5DrP3c9Pq4G7cXbolu1oaLE4pggzlP9tco8r6kJtsgJlweyEgr+IH0PWBS9EfK4I7MzotaQWqdvA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f14-20020a05620a20ce00b00785ca459548si4381612qka.113.2024.02.12.02.54.47 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 02:54:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61378-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=actia.se); spf=pass (google.com: domain of linux-kernel+bounces-61378-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61378-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 53E621C2354C for <ouuuleilei@gmail.com>; Mon, 12 Feb 2024 10:54:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E53063BB36; Mon, 12 Feb 2024 10:50:45 +0000 (UTC) Received: from mail.actia.se (mail.actia.se [212.181.117.226]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D2B03B1AC; Mon, 12 Feb 2024 10:50:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.181.117.226 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707735044; cv=none; b=PfqNI8iAE+GK9Ag84U0TkYcC+ha4E6ib+631URnszKkwtQuohVxNaLBd4N5r2GO80nTVnbjJer9qdProfkS8n6sBYPNusZm4Jdqcco4Nwj5uDs4videK/Kb1iknD33zxQtFaP641VKagHswAoJJPpguC0ehIocH7Dz1vnLRi7Vc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707735044; c=relaxed/simple; bh=DslaFWZZuV/SwGQuQpMrEYo+M/OcOIqoqJTfsY93H9U=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=ORr5cz/Zey7vRqygcj/cbdB4SKMdcKMSZKn5xALxGbomL+oI5YLKtf+VokOxmTdFkxIfdo0PzSNL/WrmEvQG8pm4aIiGZVYSAQ5P/Lw7bb7LAhOTbNWyNbw34x+JI4p9wpnGx9kOBK9+AqkTHB7OKnm11ZYJa/dr7RY3YWs7B0M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=actia.se; spf=pass smtp.mailfrom=actia.se; arc=none smtp.client-ip=212.181.117.226 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=actia.se Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=actia.se Received: from S036ANL.actianordic.se (10.12.31.117) by S036ANL.actianordic.se (10.12.31.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 12 Feb 2024 11:50:30 +0100 Received: from S036ANL.actianordic.se ([fe80::e13e:1feb:4ea6:ec69]) by S036ANL.actianordic.se ([fe80::e13e:1feb:4ea6:ec69%4]) with mapi id 15.01.2507.035; Mon, 12 Feb 2024 11:50:30 +0100 From: John Ernberg <john.ernberg@actia.se> To: Wei Fang <wei.fang@nxp.com> CC: Shenwei Wang <shenwei.wang@nxp.com>, Clark Wang <xiaoning.wang@nxp.com>, NXP Linux Team <linux-imx@nxp.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, "Paolo Abeni" <pabeni@redhat.com>, "netdev@vger.kernel.org" <netdev@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, John Ernberg <john.ernberg@actia.se> Subject: [PATCH net-next] net: fec: Always call fec_restart() in resume path Thread-Topic: [PATCH net-next] net: fec: Always call fec_restart() in resume path Thread-Index: AQHaXaFLRIYd45z3UU+7Sl3MRdVj/Q== Date: Mon, 12 Feb 2024 10:50:30 +0000 Message-ID: <20240212105010.2258421-1-john.ernberg@actia.se> Accept-Language: en-US, sv-SE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.43.0 x-esetresult: clean, is OK x-esetid: 37303A2958D72955617D6A Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790690236883214671 X-GMAIL-MSGID: 1790690236883214671 |
Series |
[net-next] net: fec: Always call fec_restart() in resume path
|
|
Commit Message
John Ernberg
Feb. 12, 2024, 10:50 a.m. UTC
When trying to resume from suspend the following can be observed:
fec 5b040000.ethernet eth0: MDIO read timeout
Microchip LAN87xx T1 5b040000.ethernet-1:04: PM: dpm_run_callback(): mdio_bus_phy_resume+0x0/0xc8 returns -110
Microchip LAN87xx T1 5b040000.ethernet-1:04: PM: failed to resume: error -110
This is because the MAC is left powered down after resuming from suspend.
The MAC is brought up in both probe and open, so leaving it off in resume
from suspend is an imbalance.
This imbalance combined with a LAN8700R that is permanently powered
results in unusuable networking if the board would happen to suspend before
the link is brought up, and the only way to get out of it would be a full
power cycle.
NOTE: With this change the PHY ends up taking different resume paths when
the link has never been up compared to once the link has been up. Currently
the resume process is identical and just happens at different times, so
this *should* not have any unforseen consequences.
Signed-off-by: John Ernberg <john.ernberg@actia.se>
---
Tested on 6.1 kernel and forward ported. I discovered this when we
upgraded from 5.10 to 6.1, but the resume path in the FEC driver has had
this imbalance since at least 2009.
This is also why I target the -next tree, I can't identify a proper commit
to blame with a Fixes. Let me know if this should be the net tree anyway.
drivers/net/ethernet/freescale/fec_main.c | 2 ++
1 file changed, 2 insertions(+)
Comments
On Mon, 12 Feb 2024 10:50:30 +0000 John Ernberg wrote: > Tested on 6.1 kernel and forward ported. I discovered this when we > upgraded from 5.10 to 6.1, but the resume path in the FEC driver has had > this imbalance since at least 2009. > > This is also why I target the -next tree, I can't identify a proper commit > to blame with a Fixes. Let me know if this should be the net tree anyway. I thought you bisected it to one or two specific changes? I'd put those down as Fixes tags and target net.
On 2/14/24 03:44, Jakub Kicinski wrote: > On Mon, 12 Feb 2024 10:50:30 +0000 John Ernberg wrote: >> Tested on 6.1 kernel and forward ported. I discovered this when we >> upgraded from 5.10 to 6.1, but the resume path in the FEC driver has had >> this imbalance since at least 2009. >> >> This is also why I target the -next tree, I can't identify a proper commit >> to blame with a Fixes. Let me know if this should be the net tree anyway. > > I thought you bisected it to one or two specific changes? > I'd put those down as Fixes tags and target net. Hi Jakub, You are correct, we thought so too at [1], but bisection is really hard because we need a whole bunch of patches on top to even boot the system (imx8qxp specific stuff in the NXP vendor tree that's difficult to rebase), we left it a bit open ended. Over the course of the weekend I lost all confidence in my bisection after being confident for 4-5 days, because the more I thought about it the less it made sense for that commit to be the culprit. I should probably have both followed up on that mail with that, and been clearer here. I apologize for failing that. Best regards // John Ernberg [1]: https://lore.kernel.org/netdev/1f45bdbe-eab1-4e59-8f24-add177590d27@actia.se/
On Wed, 14 Feb 2024 08:27:02 +0000 John Ernberg wrote: > You are correct, we thought so too at [1], but bisection is really hard > because we need a whole bunch of patches on top to even boot the system > (imx8qxp specific stuff in the NXP vendor tree that's difficult to > rebase), we left it a bit open ended. > > Over the course of the weekend I lost all confidence in my bisection > after being confident for 4-5 days, because the more I thought about it > the less it made sense for that commit to be the culprit. > > I should probably have both followed up on that mail with that, and been > clearer here. I apologize for failing that. Is it perhaps possible that upstream 5.10 also didn't work? I'm not saying the change itself is incorrect, indeed there is fec_restart() on probe and open paths, as you say. Did you try reverting as many of the changes that happened in the meantime as possible (instead of bisection)? The other question is whether we need to enable any of the clocks or runtime resume before calling fec_restart()?
On 2/14/24 15:52, Jakub Kicinski wrote: > On Wed, 14 Feb 2024 08:27:02 +0000 John Ernberg wrote: >> You are correct, we thought so too at [1], but bisection is really hard >> because we need a whole bunch of patches on top to even boot the system >> (imx8qxp specific stuff in the NXP vendor tree that's difficult to >> rebase), we left it a bit open ended. >> >> Over the course of the weekend I lost all confidence in my bisection >> after being confident for 4-5 days, because the more I thought about it >> the less it made sense for that commit to be the culprit. >> >> I should probably have both followed up on that mail with that, and been >> clearer here. I apologize for failing that. > > Is it perhaps possible that upstream 5.10 also didn't work? > I'm not saying the change itself is incorrect, indeed there > is fec_restart() on probe and open paths, as you say. > Did you try reverting as many of the changes that happened > in the meantime as possible (instead of bisection)? > That's a really good point. I'll make some time for this in the next weeks. Please mark it with changes requested in the meantime, as I expect to make changes to the patch when I have a result. > The other question is whether we need to enable any of the > clocks or runtime resume before calling fec_restart()? On our board it works fine without it, I don't know enough about this SoC or other NXP SoCs to know if it's necessary in other situations. The clocks are re-enabled in the open call which appears to be enough to get traffic going again when the link is brought up. Perhaps NXP can fill us in? Thanks! // John Ernberg
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 42bdc01a304e..e6804c068d6b 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -4706,6 +4706,8 @@ static int __maybe_unused fec_resume(struct device *dev) napi_enable(&fep->napi); phy_init_hw(ndev->phydev); phy_start(ndev->phydev); + } else { + fec_restart(ndev); } rtnl_unlock();