From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: davem@davemloft.net, Russell King <linux@armlinux.org.uk>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
David Ahern <dsahern@kernel.org>,
Jakub Kicinski <kuba@kernel.org>
Cc: Maxime Chevallier <maxime.chevallier@bootlin.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
thomas.petazzoni@bootlin.com
Subject: [RFC PATCH net] net: ipconfig: Release the rtnl_lock while waiting for carrier
Date: Wed, 27 Oct 2021 15:19:53 +0200 [thread overview]
Message-ID: <20211027131953.9270-1-maxime.chevallier@bootlin.com> (raw)
While waiting for a carrier to come on one of the netdevices, some
devices will require to take the rtnl lock at some point to fully
initialize all parts of the link.
That's the case for SFP, where the rtnl is taken when a module gets
detected. This prevents mounting an NFS rootfs over an SFP link.
This means that while ipconfig waits for carriers to be detected, no SFP
modules can be detected in the meantime, it's only detected after
ipconfig times out.
This commit releases the rtnl_lock while waiting for the carrier to come
up, and re-takes it to check the for the init device and carrier status.
At that point, the rtnl_lock seems to be only protecting
ic_is_init_dev().
Fixes: 73970055450e ("sfp: add SFP module support")
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
I've sent this patch as an RFC (it doesn't look very clean indeed), since I'm
not fully familiar with the implications of modifying the locking scheme at
that point in the boot process. Please feel free to comment or suggest other
approaches.
net/ipv4/ipconfig.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 816d8aad5a68..069ae05bd0a5 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -278,7 +278,12 @@ static int __init ic_open_devs(void)
if (ic_is_init_dev(dev) && netif_carrier_ok(dev))
goto have_carrier;
+ /* Give a chance to do complex initialization that
+ * would require to take the rtnl lock.
+ */
+ rtnl_unlock();
msleep(1);
+ rtnl_lock();
if (time_before(jiffies, next_msg))
continue;
--
2.25.4
next reply other threads:[~2021-10-27 13:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-27 13:19 Maxime Chevallier [this message]
2021-10-27 16:05 ` Antoine Tenart
2021-10-28 6:45 ` Maxime Chevallier
2021-10-28 8:41 ` Antoine Tenart
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=20211027131953.9270-1-maxime.chevallier@bootlin.com \
--to=maxime.chevallier@bootlin.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=yoshfuji@linux-ipv6.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
all inboxes | Powered by JetHome®