From: Heiner Kallweit <hkallweit1@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
David Miller <davem@davemloft.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next v2 0/2] net: phy: improve PHY suspend/resume
Date: Wed, 30 May 2018 22:22:51 +0200 [thread overview]
Message-ID: <5b9eceab-35b4-922c-7410-d8968d8364c7@gmail.com> (raw)
In-Reply-To: <20180523220418.GB5128@lunn.ch>
Am 24.05.2018 um 00:04 schrieb Andrew Lunn:
> On Wed, May 23, 2018 at 10:15:29PM +0200, Heiner Kallweit wrote:
>> I have the issue that suspending the MAC-integrated PHY gives an
>> error during system suspend. The sequence is:
>>
>> 1. unconnected PHY/MAC are runtime-suspended already
>> 2. system suspend commences
>> 3. mdio_bus_phy_suspend is called
>> 4. suspend callback of the network driver is called (implicitly
>> MAC/PHY are runtime-resumed before)
>> 5. suspend callback suspends MAC/PHY
>>
>> The problem occurs in step 3. phy_suspend() fails because the MDIO
>> bus isn't accessible due to the chip being runtime-suspended.
>
> I think you are fixing the wrong problem. I've had the same with the
> FEC driver. I fixed it by making the MDIO operations runtime-suspend
> aware:
>
I checked the fec driver and there it's reletively easy because
runtime suspend/resume is just about disabling/enabling one clock.
In case of r8169 runtime suspend/resume do much more and there would
be quite some potential deadlock issues to take care of.
To provide one example:
pm_runtime_get_sync() would be called with the mdio bus lock being
held (from mdio write op), runtime-resuming however includes PHY
writes what would result in a deadlock.
I think we need a better solution than spending the effort needed
to make the MDIO ops runtime-pm-aware. In general there seems to be
just one network driver using both phylib and runtime pm, so most
drivers aren't affected (yet).
I will spend few more thoughts on a solution ..
Regards, Heiner
> commit 8fff755e9f8d0f70a595e79f248695ce6aef5cc3
> Author: Andrew Lunn <andrew@lunn.ch>
> Date: Sat Jul 25 22:38:02 2015 +0200
>
> net: fec: Ensure clocks are enabled while using mdio bus
>
> When a switch is attached to the mdio bus, the mdio bus can be used
> while the interface is not open. If the IPG clock is not enabled, MDIO
> reads/writes will simply time out.
>
> Add support for runtime PM to control this clock. Enable/disable this
> clock using runtime PM, with open()/close() and mdio read()/write()
> function triggering runtime PM operations. Since PM is optional, the
> IPG clock is enabled at probe and is no longer modified by
> fec_enet_clk_enable(), thus if PM is not enabled in the kernel, it is
> guaranteed the clock is running when MDIO operations are performed.
>
> Don't copy this patch 1:1. I introduced a few bugs which took a while
> to be shaken out :-(
>
> Andrew
>
next prev parent reply other threads:[~2018-05-30 20:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-23 20:15 [PATCH net-next v2 0/2] net: phy: improve PHY suspend/resume Heiner Kallweit
2018-05-23 20:16 ` [PATCH net-next v2 1/2] net: phy: improve check for when to call phy_resume in mdio_bus_phy_resume Heiner Kallweit
2018-05-23 20:17 ` [PATCH net-next v2 2/2] net: phy: improve checks when to suspend the PHY Heiner Kallweit
2018-05-23 22:04 ` [PATCH net-next v2 0/2] net: phy: improve PHY suspend/resume Andrew Lunn
2018-05-24 5:52 ` Heiner Kallweit
2018-05-30 20:22 ` Heiner Kallweit [this message]
2018-05-30 20:35 ` Andrew Lunn
2018-05-31 15:58 ` Heiner Kallweit
2018-05-31 18:30 ` Andrew Lunn
2018-05-31 20:28 ` Heiner Kallweit
2018-06-01 0:10 ` Andrew Lunn
2018-06-02 20:27 ` Heiner Kallweit
2018-06-05 19:39 ` Heiner Kallweit
2018-06-08 6:09 ` Heiner Kallweit
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=5b9eceab-35b4-922c-7410-d8968d8364c7@gmail.com \
--to=hkallweit1@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=netdev@vger.kernel.org \
/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).