Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp885901pxb; Wed, 27 Oct 2021 14:28:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAN/i5f/9hRhFlQSxWztf2ovBSyEz46udLwq2l7fyWD6flc8z78O8yicrjTcVuZgeMivVQ X-Received: by 2002:a17:906:5343:: with SMTP id j3mr86611ejo.538.1635370103446; Wed, 27 Oct 2021 14:28:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635370103; cv=none; d=google.com; s=arc-20160816; b=oRYuMSig/M1FBkdkLLTGx7GTVheIyg3yeESaj73OJCGZK2ODfigX/vKmnXAs6iMame q+6PteKlzhaBRIYCxzEqcSSUOJqbgks658e5kttRYiGoOmdXnGB7imCY+oc0p3i7nJQB uZYo7yG8LdMZhYv/IDxUMfVl+9ruSzCG292CWn1wHlux8ei9UNNSudg1KoAzY75ulqfc 6qZJO0DApmbyI0Y6q8LLWDNMyqN9VKFOLcvuNMUNMhQm6v2VMscBrgCDo0lXHeW1YlUf 7kDKftvsquUQPCcrVG0UPHDkzTGUfsPWvtsQ/rzNxKTVI7DC8POERF3Syb4aHDlG5X1L 8AkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=XbL/u9uarj0SQzZ81kezUz5FVdDeuompdHZk63aZDjA=; b=TishNg39BNly8pYbaAH6BGyPOcUlaWvUJw6cmLclOxTxNjZdq394hLSVYfiqmNDaQF 2/3A3POeUpwe/X51h2dMJDz3QCmQqdllO51C/4d8+RsaeK2c+cID4RV9KkMqsnBvLhNM l5IEXiQbL8/HudPPmyGluSb29R/RbttnYVi19op1cATY48l+R1KVDYt6l66MI5LPVJ2t mdokbL+Ilw9pZG1LYTk0GRKPV+S2rpWg3nNzdqUHRLxMpA7fanBT31JkBUxDCpTPqAW4 R0Fm1Mw2zpCyb10MAFtIsjiGz2GC9BtMKMiE8+g2N1r2UVd7ahDRpxPyAS9cfeI7gsCv tMCA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i11si1580055edb.538.2021.10.27.14.27.59; Wed, 27 Oct 2021 14:28:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242118AbhJ0N1s (ORCPT + 97 others); Wed, 27 Oct 2021 09:27:48 -0400 Received: from mslow1.mail.gandi.net ([217.70.178.240]:47215 "EHLO mslow1.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229585AbhJ0N1r (ORCPT ); Wed, 27 Oct 2021 09:27:47 -0400 Received: from relay6-d.mail.gandi.net (unknown [217.70.183.198]) by mslow1.mail.gandi.net (Postfix) with ESMTP id C7827CAF2C; Wed, 27 Oct 2021 13:20:19 +0000 (UTC) Received: (Authenticated sender: maxime.chevallier@bootlin.com) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 7D694C000D; Wed, 27 Oct 2021 13:19:56 +0000 (UTC) From: Maxime Chevallier To: davem@davemloft.net, Russell King , Hideaki YOSHIFUJI , David Ahern , Jakub Kicinski Cc: Maxime Chevallier , 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 Message-Id: <20211027131953.9270-1-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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