From: Niklas Cassel <cassel@kernel.org>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Francesco Valla <francesco@valla.it>,
"Russell King (Oracle)" <linux@armlinux.org.uk>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
netdev@vger.kernel.org, Anand Moon <linux.amoon@gmail.com>
Subject: Re: [PATCH] net: phy: don't issue a module request if a driver is available
Date: Fri, 3 Jan 2025 12:25:52 +0100 [thread overview]
Message-ID: <Z3fJQEVV4ACpvP3L@ryzen> (raw)
In-Reply-To: <d5bbf98e-7dff-436e-9759-0d809072202f@lunn.ch>
On Thu, Jan 02, 2025 at 02:52:18PM +0100, Andrew Lunn wrote:
> On Thu, Jan 02, 2025 at 02:26:58PM +0100, Francesco Valla wrote:
> > On Thursday, 2 January 2025 at 12:06:15 Russell King (Oracle) <linux@armlinux.org.uk> wrote:
> > > On Thu, Jan 02, 2025 at 12:51:22AM +0100, Francesco Valla wrote:
> > > > Whenever a new PHY device is created, request_module() is called
> > > > unconditionally, without checking if a driver for the new PHY is already
> > > > available (either built-in or from a previous probe). This conflicts
> > > > with async probing of the underlying MDIO bus and always throws a
> > > > warning (because if a driver is loaded it _might_ cause a deadlock, if
> > > > in turn it calls async_synchronize_full()).
> > >
> > > Why aren't any of the phylib maintainers seeing this warning? Where does
> > > the warning come from?
> > >
> >
> > I'm not sure. For me, it was pretty easy to trigger.
>
> Please include the information how you triggered it into the commit
> message.
>
> > This is expected, as request_module() is not meant to be called from an async
> > context:
> >
> > https://lore.kernel.org/lkml/20130118221227.GG24579@htj.dyndns.org/
> >
> > It should be noted that:
> > - the davincio_mdio device is a child of the am65-cpsw-nuss device
> > - the am65-cpsw-nuss driver is NOT marked with neither PROBE_PREFER_ASYNCHRONOUS
> > nor PROBE_FORCE_SYNCHRONOUS and the behavior is being triggered specifying
> > driver_async_probe=am65-cpsw-nuss on the command line.
>
> So the phylib core is currently async probe incompatible. The whole
> module loading story is a bit shaky in phylib, so we need to be very
> careful with any changes, or you are going to break stuff, in
> interesting ways, with it first appearing to work, because the
> fallback genphy is used rather than the specific PHY driver, but then
> breaking when genphy is not sufficient.
>
> Please think about this as a generic problem with async probe. Is this
> really specific to phylib? Should some or all of the solution to the
> problem be moved into the driver core? Could we maybe first try an
> async probe using the existing drivers, and then fall back to a sync
> probe which can load additional drivers?
>
> One other question, how much speadup do you get with async probe of
> PHYs? Is it really worth the effort?
>
I'm trying to enable async probe for my PCIe controller (pcie-dw-rockchip),
which on the radxa rock5b has a RTL8125 NIC connected to it.
By enabling async probe for the PCIe driver I get the same splat as Francesco.
Looking at the prints, it is trying to load a module for PHY ID: 0x1cc840
This PHY ID is defined in: drivers/net/phy/realtek.c.
Looking at my .config I have:
CONFIG_REALTEK_PHY=y
So this is not built as a module, so I am a bit surprised to see this
splat (since the driver is built as built-in).
I think it would be nice if the phylib core could be fixed so that
it does not try to load modules for drivers which are built as built-in.
Also see this old thread that tries to enable async probe by default on
DT systems:
https://lore.kernel.org/linux-kernel//d5796286-ec24-511a-5910-5673f8ea8b10@samsung.com/T/#u
AFAICT, it seems that the phylib core is one of the biggest blockers from
being able to enable async probe by default on DT systems.
Kind regards,
Niklas
next prev parent reply other threads:[~2025-01-03 11:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-01 23:51 [PATCH] net: phy: don't issue a module request if a driver is available Francesco Valla
2025-01-02 9:35 ` [EXTERNAL] " Suman Ghosh
2025-01-02 10:21 ` Francesco Valla
2025-01-03 7:47 ` Suman Ghosh
2025-01-02 11:06 ` Russell King (Oracle)
2025-01-02 13:26 ` Francesco Valla
2025-01-02 13:52 ` Andrew Lunn
2025-01-02 14:01 ` Francesco Valla
2025-01-02 14:21 ` Andrew Lunn
2025-01-03 18:00 ` Francesco Valla
2025-01-03 11:25 ` Niklas Cassel [this message]
2025-01-03 12:08 ` Russell King (Oracle)
2025-01-03 12:49 ` Niklas Cassel
2025-01-03 14:03 ` Russell King (Oracle)
2025-01-03 14:12 ` Andrew Lunn
2025-01-03 14:34 ` Niklas Cassel
2025-01-03 15:37 ` Andrew Lunn
2025-01-03 17:57 ` Francesco Valla
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=Z3fJQEVV4ACpvP3L@ryzen \
--to=cassel@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=francesco@valla.it \
--cc=hkallweit1@gmail.com \
--cc=linux.amoon@gmail.com \
--cc=linux@armlinux.org.uk \
--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).