From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Jijie Shao <shaojijie@huawei.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
chenhao418@huawei.com, "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
lanhao@huawei.com, liuyonglong@huawei.com,
netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>,
shenjian15@huawei.com, wangjie125@huawei.com,
wangpeiyang1@huawei.com
Subject: Re: [PATCH RFC net-next 0/7] net: phy: avoid race when erroring stopping PHY
Date: Mon, 11 Sep 2023 09:54:54 +0100 [thread overview]
Message-ID: <ZP7V3jHYgyvnTeuf@shell.armlinux.org.uk> (raw)
In-Reply-To: <ZPsDdqt1RrXB+aTO@shell.armlinux.org.uk>
Hi,
It would be good if Jijie Shao could test these patches and provide a
tested-by as appropriate.
Thanks.
On Fri, Sep 08, 2023 at 12:20:22PM +0100, Russell King (Oracle) wrote:
> This series addresses a problem reported by Jijie Shao where the PHY
> state machine can race with phy_stop() leading to an incorrect state.
>
> The issue centres around phy_state_machine() dropping the phydev->lock
> mutex briefly, which allows phy_stop() to get in half-way through the
> state machine, and when the state machine resumes, it overwrites
> phydev->state with a value incompatible with a stopped PHY. This causes
> a subsequent phy_start() to issue a warning.
>
> We address this firstly by using versions of functions that do not take
> tne lock, moving them into the locked region. The only function that
> this can't be done with is phy_suspend() which needs to call into the
> driver without taking the lock.
>
> For phy_suspend(), we split the state machine into two parts - the
> initial part which runs under the phydev->lock, and the second part
> which runs without the lock.
>
> We finish off by using the split state machine in phy_stop() which
> removes another unnecessary unlock-lock sequence from phylib.
>
> drivers/net/phy/phy.c | 204 +++++++++++++++++++++++++++-----------------------
> 1 file changed, 110 insertions(+), 94 deletions(-)
>
> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
>
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2023-09-11 8:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-08 11:20 [PATCH RFC net-next 0/7] net: phy: avoid race when erroring stopping PHY Russell King (Oracle)
2023-09-08 11:20 ` [PATCH RFC net-next 1/7] net: phy: always call phy_process_state_change() under lock Russell King (Oracle)
2023-09-08 11:20 ` [PATCH RFC net-next 2/7] net: phy: call phy_error_precise() while holding the lock Russell King (Oracle)
2023-09-08 11:20 ` [PATCH RFC net-next 3/7] net: phy: move call to start aneg Russell King (Oracle)
2023-09-08 11:21 ` [PATCH RFC net-next 4/7] net: phy: move phy_suspend() to end of phy_state_machine() Russell King (Oracle)
2023-09-08 11:21 ` [PATCH RFC net-next 5/7] net: phy: move phy_state_machine() Russell King (Oracle)
2023-09-08 11:21 ` [PATCH RFC net-next 6/7] net: phy: split locked and unlocked section of phy_state_machine() Russell King (Oracle)
2023-09-08 11:21 ` [PATCH RFC net-next 7/7] net: phy: convert phy_stop() to use split state machine Russell King (Oracle)
2023-09-11 8:54 ` Russell King (Oracle) [this message]
2023-09-12 6:35 ` [PATCH RFC net-next 0/7] net: phy: avoid race when erroring stopping PHY Jijie Shao
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=ZP7V3jHYgyvnTeuf@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=andrew@lunn.ch \
--cc=chenhao418@huawei.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=lanhao@huawei.com \
--cc=liuyonglong@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shaojijie@huawei.com \
--cc=shenjian15@huawei.com \
--cc=wangjie125@huawei.com \
--cc=wangpeiyang1@huawei.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).