🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25042

Re: [PATCH net v9 3/5] net: phy: stop postponing PHY interrupts when phy_suspend() fails

#25042
From: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 07:30
98 lines
11793 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The new failure branch in mdio_bus_phy_suspend()
  (drivers/net/phy/phy_device.c) undoes only the phylib side of the…

--

net: phy: stop postponing PHY interrupts when phy_suspend() fails

When phy_suspend() fails in mdio_bus_phy_suspend(), the patch now undoes
the interrupt postponing and restarts the state machine. It also sets
suspended_by_mdio_bus only once phy_suspend() has succeeded. The error
paths of mdio_bus_phy_resume() are left as they were.

> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index f2e2370b4be7c..2d2058c29f300 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c

[ ... ]

> @@ -385,9 +386,20 @@ static __maybe_unused int mdio_bus_phy_suspend(struct device *dev)
>  	if (!mdio_bus_phy_may_suspend(phydev))
>  		return 0;
>  
> +	ret = phy_suspend(phydev);
> +	if (ret) {
> +		/* The PM core skips the resume callback of a device whose
> +		 * suspend callback failed.
> +		 */
> +		mdio_bus_phy_resume_irq(phydev);
> +		if (phy_uses_state_machine(phydev))
> +			phy_start_machine(phydev);
> +		return ret;
> +	}

[Severity: Medium]
This branch undoes the phylib side of the suspend. Does it also undo what
phydrv->suspend() may have done to the hardware before it failed?
phy_suspend() doesn't roll anything back. On error it only skips setting
phydev->suspended.

Some PHY drivers mask their own interrupt sources first and then do a
power-down MDIO write that can fail. For example:

drivers/net/phy/marvell-88q2xxx.c:mv88q2xxx_suspend() {
	...
	if (phy_interrupt_is_valid(phydev)) {
		phydev->interrupts = PHY_INTERRUPT_DISABLED;
		ret = mv88q2xxx_config_intr(phydev);
		if (ret)
			return ret;
	}

	return phy_set_bits_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_CTRL1,
				MDIO_CTRL1_LPOWER);
}

kszphy_suspend() in micrel.c follows the same pattern through
drv->config_intr() and then kszphy_generic_suspend()->genphy_suspend().
So does dp83867_suspend(), through dp83867_config_intr() and then
genphy_suspend().

Suppose the final power-down write fails, for example with an MDIO timeout
or -EIO. The PHY's interrupt generation is then masked in hardware and
phydev->interrupts is still PHY_INTERRUPT_DISABLED. Only the drivers'
resume callbacks, such as mv88q2xxx_resume() and kszphy_resume(), turn it
back on. This branch calls neither phy_resume() nor phy_init_hw().

phydev->irq is still valid, so phy_polling_mode() returns false. After the
restarted state machine runs once, phylib waits for PHY interrupts the
hardware no longer generates. Would link up/down changes then be lost
until ifdown/ifup or the next successful suspend/resume cycle?

Would calling phy_resume() here help? __phy_resume() calls
phydrv->resume() whether or not phydev->suspended is set. The other option
would be for these drivers' suspend callbacks to undo their interrupt
masking on error.

> +
>  	phydev->suspended_by_mdio_bus = 1;
>  
> -	return phy_suspend(phydev);
> +	return 0;
>  }

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-b4-phylib-mac-pm-irq-v3-v9-0-7b9c3c9ac9f7%40iav.lv
Technical Details
Message-ID: <179611024824.3146.12326645036576718233@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374796-linux-kernel-netdev=dewy.ru
References: <20261130-b4-phylib-mac-pm-irq-v3-v9-3-7b9c3c9ac9f7@iav.lv>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374796-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v9 3/5] net: phy: stop postponing PHY interrupts when
 phy_suspend() fails
Date: Tue, 01 Dec 2026 07:30:48 +0000
Organization: Usenet Network
Message-ID: <179611024824.3146.12326645036576718233@kernel.org>
References: <20261130-b4-phylib-mac-pm-irq-v3-v9-3-7b9c3c9ac9f7@iav.lv>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1648424"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:eS1TuLbNseHnNHrNzQ0bmzyJPEg= sha256:I2ep2hiEek5YAx0HGNUEM61EHJQLP+V65UWsedyW+L0=
	sha1:ouSMSmNAT9Aj8Z0zFTdMRl++ruc= sha256:wx+iCFyiDMWcn2mgyFUYIy9Qer3+dr44vbUsXFxfiMk=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 8DBB511729D; Tue,  1 Dec 2026 10:31:11 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.5
X-Spam-Status: No, score=-3.5 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
	URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id gajaWBzUDbE6;
	Tue,  1 Dec 2026 10:31:08 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-374796-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id E49E1117294; Tue,  1 Dec 2026 10:30:59 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 445A326D63; Tue,  1 Dec 2026 07:30:57 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796110251;
	b=1sBAv7WXm3vUkUISvbjh3Jx7KxK675U9s6+XoIp5PgPXgjYKAnA9n1QqtBaCkcQxEDl7
	 tRVHUqxCnvHfFIlzu30oWEbK+f/VPmYeNTEnrCa4FFQVaI7bEHrbAtp5dBb50LiUvLZBd
	 fOovIhqtiLNk1ml8UqLryL8hlDY7er7W26uhZvJJ0hEt1ea9HLDkJYjCbjUa5nuSWus7D
	 eV3YMdLBL84ubCdIpulTrvlrXXvehIPeSvnIKjeGw39FAsz6LPHvTcNWCDJpmeEVD64g5
	 URbEZWQndZpAsgVpAJEQIzBNGfYFw9bM04UzaNfGb6KFA7DCiWXaQ0t2B0Mmknl13ZQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796110251;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=5XygkUa3/5sMz28ccXD1UVWOtmP5lfoiTDvsYj9xjHE=;
	b=MTuuOS48YrgWRyhA4GnRlhDtF7SoVwMhU8c9gjmqcMFx96ddy4HTPFT7FVWqS2PCy1UQ
	 KWFuCXp4KVmoahuMkP30FPBMSqvePJGv4XuvnTT1f2gqdEgqipnBtRTUj9LRNxCApYyND
	 dwEZSfin1Urc4DipwQXa/0AItNyZGD/mqqhTHtfNuKJJV3d8+2E9yZENFOQwHZBduDV9U
	 aBYkx/wSIyKTTeP8LNv5nB5ZIXMlAa8O5ZfS7Hr8Kja7CGYwLuyrDA/FD9EaLhd9Td0Nw
	 PALY00clJXuyId/ShbmO4dcf6PVzyOCoebmI9Tgc9sdz6SJDTQeyG3gq5YpAQR6QLYA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bvW+FVut;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 61246606A6A5;
	Tue,  1 Dec 2026 07:30:51 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bvW+FVut
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796110250;
	b=SF9NHLyuPsU9L8Bil2SmRLHsERfeYp6nKd+54U7Z3tETylUr+hTCf712s9bRncR4uS9i
	 TGAjSVLYTBeD/5Cei0fgiBK9Se1k78+qX74/+cCqln8JqxrPnAx7j3xzSQBkw+kXkRPmH
	 DaQX32G69S1PIRv+sJ7M4WbSPnSlgtKIX/SYqNZU8zDI+rnFevdqRvn8EU9GnzOid2JkV
	 xtD5YxEYBiD+JxWlP2Hs31d+zMoVlW7JKCHod6y9u5c5JDvdMFDNl5pK4Ny4Z6oiDEUHb
	 5HKn8Ej3gKixpOsNRsG0pPE4xbKmQMBgKakdCSipLxdm81eLGhvSr0oOAAY7UtBCy1A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796110250;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=5XygkUa3/5sMz28ccXD1UVWOtmP5lfoiTDvsYj9xjHE=;
	b=JJIVGqttkf55yOAkAVATcdMq8LIOFSi8rdncRZ/wv/zJbdPL5BH72S82eIsdsWaYWB/C
	 Oy5iRehar1KE9HUd6dxo352Fo0NAHblElWc59oJwIaOIiTAg+5dnkVfqWc8rBjVD090YE
	 TTJZOHRdl8jU375b50k9uWZ8miIPSGUPWjx8/Nb0Q520KkH6pn2s7X30t9Y61j71pUUwm
	 ZjdDFBRx5l84sc8/Dlx9ZLgbk6/A+3K7rSBPCRkDOzHacU1RGdXT1uUP/2rn1ifyIkHWs
	 GenDB3XP928alaVdmTBuDmsZwcJQFXjjwM/Ks9Y7nI1SGmpil8FBIGWKTBMIJERFQCg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bvW+FVut;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 814E8606A695;
	Tue,  1 Dec 2026 07:30:50 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0AEA1F00897;
	Tue,  1 Dec 2026 07:30:48 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796110250;
	bh=5XygkUa3/5sMz28ccXD1UVWOtmP5lfoiTDvsYj9xjHE=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=bvW+FVutZ/gvTqpQ/cCP7+mTUh3SdHwthektC+7BiMKfE9upR28gcvjZZtxYkNieT
	 VIPf6vJRJJXcs6KSTp+QC0oYM0eePur6/YLciWsZ749GKxwDIt69AIhqQc/l9ZWf34
	 wv0lDn1TbuXam5RlvUNPE0bYTwPCs3Xla/CYhendAVvcwXiu0YitEK+2HtrOvkOoSK
	 2NnvPGdjTaVArTHEw6V1FUGLVKi07a1aILJTMo5TVb2ckN3vmvMnvjoWKguijzQP/3
	 laUjB2GjkEePXZoNc8kh9onOmyn2RAYUycnUAWMjaF+DYzPO0g6gg/UTfe8bWdrAWi
	 02r8d0q2ED7Og==
X-Cc: andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk,
 davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 tglx@kernel.org, linux-pm@vger.kernel.org, maxime.chevallier@bootlin.com,
 lukas@wunner.de, rafael.j.wysocki@intel.com, wei.fang@nxp.com,
 niklas.soderlund@ragnatech.se, paul@pbarker.dev,
 florian.fainelli@broadcom.com, opendmb@gmail.com, Thangaraj.S@microchip.com,
 shenwei.wang@nxp.com, Haoning.CHENG@cn.bosch.com, willemb@google.com,
 netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
 linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org
X-In-Reply-To: <20261130-b4-phylib-mac-pm-irq-v3-v9-3-7b9c3c9ac9f7@iav.lv>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list