From: Andrew Lunn <andrew@lunn.ch>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>,
mkl@pengutronix.de, Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
kernel@pengutronix.de, netdev <netdev@vger.kernel.org>,
lkml <linux-kernel@vger.kernel.org>,
david@protonic.nl
Subject: Re: [PATCH v1 1/2] net: dsa: sja1105: print info about probet chip only after every thing was done.
Date: Mon, 25 Nov 2019 16:23:12 +0100 [thread overview]
Message-ID: <20191125152312.GJ6602@lunn.ch> (raw)
In-Reply-To: <CA+h21hrOO6AFhvXQL47LwqCKU9vpRZ47feWB6fkn=WfrdZr6tA@mail.gmail.com>
> If you want to actually fix something, there is also a memory leak
> related to this. It is present in most DSA drivers. When
> dsa_register_switch returns -EPROBE_DEFER, anything allocated with
> devm_kzalloc will be overwritten and the old memory will leak.
There is a rather unfortunate chicken/egg problem here for any switch
using MDIO. At the moment i don't know how to solve it. As a result
the first probe is pretty much guaranteed to return -EPROBE_DEFER. The
problem is that the MAC driver registers its MDIO bus. That causes the
DT to be walked for the bus and the switch probed. The switch probe
registers the switch with the DSA core. It then tries to get a handle
on the master device. But the MAC driver has not called
netdev_register() yet, it is busy registering its MDIO bus. So the
master device is not there, and so we get a -EPROBE_DEFER and the
switch driver needs to unwind.
So for an MDIO switch, i suggest the probe it kept to a minimum, and
all the real work is done in the setup callback. Setup is called when
all resources the DSA core needs are available.
I've got a patch somewhere for mv88e6xxx which does this move, and it
cut boot time by a noticeable amount.
Andrew
next prev parent reply other threads:[~2019-11-25 15:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-25 10:02 [PATCH v1 1/2] net: dsa: sja1105: print info about probet chip only after every thing was done Oleksij Rempel
2019-11-25 10:02 ` [PATCH v1 2/2] net: dsa: sja1105: fix sja1105_parse_rgmii_delays() Oleksij Rempel
2019-11-25 10:10 ` Vladimir Oltean
2019-11-25 10:19 ` [PATCH v1 1/2] net: dsa: sja1105: print info about probet chip only after every thing was done Vladimir Oltean
2019-11-25 15:23 ` Andrew Lunn [this message]
2019-11-25 10:22 ` Vladimir Oltean
2019-11-25 10:31 ` Oleksij Rempel
2019-11-25 10:39 ` Vladimir Oltean
2019-11-25 11:09 ` Oleksij Rempel
2019-11-25 15:05 ` Andrew Lunn
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=20191125152312.GJ6602@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=david@protonic.nl \
--cc=f.fainelli@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=olteanv@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox