All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Eric Dumazet" <edumazet@google.com>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Vivien Didelot" <vivien.didelot@gmail.com>,
	"Vladimir Oltean" <olteanv@gmail.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Saravana Kannan" <saravanak@google.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Robin Murphy" <robin.murphy@arm.com>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Frank Rowand" <frowand.list@gmail.com>,
	"John Stultz" <jstultz@google.com>,
	"Alvin Šipraga" <alsi@bang-olufsen.dk>,
	"Russell King" <rmk+kernel@armlinux.org.uk>,
	"Heiner Kallweit" <hkallweit1@gmail.com>
Subject: Re: [RFC PATCH net 0/2] Make phylink and DSA wait for PHY driver that defers probe
Date: Thu, 19 May 2022 14:59:36 +0000	[thread overview]
Message-ID: <20220519145936.3ofmmnrehydba7t6@skbuf> (raw)
In-Reply-To: <Yn72l3O6yI7YstMf@lunn.ch>

Hi Andrew,

On Sat, May 14, 2022 at 02:23:51AM +0200, Andrew Lunn wrote:
> On Sat, May 14, 2022 at 02:36:38AM +0300, Vladimir Oltean wrote:
> > This patch set completes the picture described by
> > '[RFC,devicetree] of: property: mark "interrupts" as optional for fw_devlink'
> > https://patchwork.kernel.org/project/netdevbpf/patch/20220513201243.2381133-1-vladimir.oltean@nxp.com/
> > 
> > I've CCed non-networking maintainers just in case they want to gain a
> > better understanding. If not, apologies and please ignore the rest.
> > 
> > My use case is to migrate a PHY driver from poll mode to interrupt mode
> > without breaking compatibility between new device trees and old kernels
> > which did not have a driver for that IRQ parent, and therefore (for
> > things to work) did not even have that interrupt listed in the "vintage
> > correct" DT blobs. Note that current kernels as of today are also
> > "old kernels" in this description.
> > 
> > Creating some degree of compatibility has multiple components.
> > 
> > 1. A PHY driver must eventually give up waiting for an IRQ provider,
> >    since the dependency is optional and it can fall back to poll mode.
> >    This is currently supported thanks to commit 74befa447e68 ("net:
> >    mdio: don't defer probe forever if PHY IRQ provider is missing").
> > 
> > 2. Before it finally gives up, the PHY driver has a transient phase of
> >    returning -EPROBE_DEFER. That transient phase causes some breakage
> >    which is handled by this patch set, details below.
> > 
> > 3. PHY device probing and Ethernet controller finding it and connecting
> >    to it are async events. When both happen during probing, the problem
> >    is that finding the PHY fails if the PHY defers probe, which results
> >    in a missing PHY rather than waiting for it. Unfortunately there is
> >    no universal way to address this problem, because the majority of
> >    Ethernet drivers do not connect to the PHY during probe. So the
> >    problem is fixed only for the driver that is of interest to me in
> >    this context, DSA, and with special API exported by phylink
> >    specifically for this purpose, to limit the impact on other drivers.
> 
> There is a very different approach, which might be simpler.
> 
> We know polling will always work. And it should be possible to
> transition between polling and interrupt at any point, so long as the
> phylock is held. So if you get -EPROBE_DEFFER during probe, mark some
> state in phydev that there should be an irq, but it is not around yet.
> When the phy is started, and phylib starts polling, look for the state
> and try getting the IRQ again. If successful, swap to interrupts, if
> not, keep polling. Maybe after 60 seconds of polling and trying, give
> up trying to find the irq and stick with polling.

That doesn't sound like something that I'd backport to stable kernels.
Letting the PHY driver dynamically switch from poll to IRQ mode risks
racing with phylink's workqueue, and generally speaking, phylink doesn't
seem to be built around the idea that "bool poll" can change after
phylink_start().

What motivates me to make these changes in the first place is the idea
that current kernels should work with updated device trees. If I won't
be able to achieve that, I see no point in adding logic to transition
from poll to IRQ mode even in net-next, since I'd have to update the
kernel when I update the DT, and by then, I'd have a proper driver for
the IRQ parent anyway. Sorry.

  reply	other threads:[~2022-05-19 15:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-13 23:36 [RFC PATCH net 0/2] Make phylink and DSA wait for PHY driver that defers probe Vladimir Oltean
2022-05-13 23:36 ` [RFC PATCH net 1/2] net: phylink: allow PHY driver to defer probe when connecting via OF node Vladimir Oltean
2022-05-13 23:36 ` [RFC PATCH net 2/2] net: dsa: wait for PHY to defer probe Vladimir Oltean
2022-05-14  0:23 ` [RFC PATCH net 0/2] Make phylink and DSA wait for PHY driver that defers probe Andrew Lunn
2022-05-19 14:59   ` Vladimir Oltean [this message]
2022-05-19 15:15     ` Russell King (Oracle)
2022-05-19 15:25       ` Vladimir Oltean
2022-05-19 15:32     ` Andrew Lunn
2022-05-19 15:38       ` Vladimir Oltean
2022-05-14  0:39 ` Saravana Kannan

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=20220519145936.3ofmmnrehydba7t6@skbuf \
    --to=vladimir.oltean@nxp.com \
    --cc=alsi@bang-olufsen.dk \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=frowand.list@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=hkallweit1@gmail.com \
    --cc=jstultz@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=rafael@kernel.org \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=robh+dt@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=saravanak@google.com \
    --cc=vivien.didelot@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.