lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 14 May 2022 02:36:38 +0300
From:   Vladimir Oltean <>
Cc:     Jakub Kicinski <>,
        "David S. Miller" <>,
        Paolo Abeni <>,
        Eric Dumazet <>,
        Florian Fainelli <>,
        Vivien Didelot <>,
        Andrew Lunn <>,
        Vladimir Oltean <>,,,
        Saravana Kannan <>,
        Greg Kroah-Hartman <>,
        "Rafael J. Wysocki" <>,
        Robin Murphy <>,
        Geert Uytterhoeven <>,
        Rob Herring <>,
        Frank Rowand <>,
        John Stultz <>,
        Alvin Šipraga <>,
        Russell King <>,
        Heiner Kallweit <>
Subject: [RFC PATCH net 0/2] Make phylink and DSA wait for PHY driver that defers probe

This patch set completes the picture described by
'[RFC,devicetree] of: property: mark "interrupts" as optional for fw_devlink'

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.

Note that drivers that connect to the PHY at ndo_open are superficially
"fixed" by the patch at step 1 alone, and therefore don't need the
mechanism introduced in phylink here. This is because of the larger span
of time between PHY probe and opening the network interface (typically
initiated by user space). But this is the catch, nfsroot and other
in-kernel networking users can also open the net device, and this will
still expose the EPROBE_DEFER as a hard error for this second kind of
drivers. I don't know how to fix that. From this POV, it's better to do
what DSA does (connect to the PHY on probe).

Vladimir Oltean (2):
  net: phylink: allow PHY driver to defer probe when connecting via OF
  net: dsa: wait for PHY to defer probe

 drivers/net/phy/phylink.c | 73 ++++++++++++++++++++++++++++++---------
 include/linux/phylink.h   |  2 ++
 net/dsa/dsa2.c            |  2 ++
 net/dsa/port.c            |  6 ++--
 net/dsa/slave.c           | 10 +++---
 5 files changed, 70 insertions(+), 23 deletions(-)


Powered by blists - more mailing lists