Message ID | 20230119180008.2156048-1-leitao@debian.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp471184wrn; Thu, 19 Jan 2023 10:08:58 -0800 (PST) X-Google-Smtp-Source: AMrXdXv43ovPq5txTazEshEw4wSLzT7NRdNoVrTGq0TfEsOgKfHZMqc6oqX0ROsH462a3h6fjKc8 X-Received: by 2002:a05:6a00:d55:b0:589:69ec:c6bc with SMTP id n21-20020a056a000d5500b0058969ecc6bcmr11128318pfv.21.1674151737914; Thu, 19 Jan 2023 10:08:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674151737; cv=none; d=google.com; s=arc-20160816; b=EECK3/nr2C3eGHGJqh01g7LOGmi7xxK2lGy5Q7aVsH798j14LjQWhCG/xHvb3EioPI AQ4ynt890F60EEjhq5FKMCBlAYFtnagx8at3bgXBOMJ0crFn0L8IZmEHcJxunWdOhBQC pQzo7ziH3S5gEWdJklzPlMMfOCFcjFrIeFzyARckJnDWdDK81IVA1xEY/BujB1osJAxk OajC8ZTQxfiKPlno4zI4Az9lTx3DBdzKohj90IVVcovAgWGMYY6HDVWpsvleQ//bXHVS nlHo2DFEQrYtaDL2IScahR/hy9q4dlY/WoNkWF6yDpu3FCBGNS52zjG5S50G2gTOHZJP wKJw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=uhGSZMqi2aufJJkiKEGoA6YS10J2IXaPL/Dyh2uKG04=; b=Bngj9iLrfD6QSMP2PsUmjavdXID/nQoBCDe7XyNlfk8rt6dRBC7HAI90hXLZLlJBsq 8cJD8+AAoEfWXY0ACvKD6mcminNP1z9Zni8yELmTQj4HAN1qO/6cAYRx6860/JSNRjK9 nwSJuHYN2CVTNNVMhbUgtj2Julyk/JT11hpOcvtgNgpbfIWB7iPc0DNOYo8b/PwRR6OA BwZjE7s/Z0FaTFSrjwhhK33igVm4sjGR6Ich2t1+7X5M/L8yttKqdU9snwo1AssBUUrQ h/BbHBFmIizQM+zka2KrMXmvmYSM021/GAZztuDaVJpfaEdPLMoTZC6McHNSI5ltc5jD ex1A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y200-20020a6264d1000000b0058d3862357bsi15268348pfb.20.2023.01.19.10.08.45; Thu, 19 Jan 2023 10:08:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230002AbjASSAV (ORCPT <rfc822;pfffrao@gmail.com> + 99 others); Thu, 19 Jan 2023 13:00:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229614AbjASSAT (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 19 Jan 2023 13:00:19 -0500 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7FFDBBA2; Thu, 19 Jan 2023 10:00:17 -0800 (PST) Received: by mail-ej1-f41.google.com with SMTP id mg12so7782297ejc.5; Thu, 19 Jan 2023 10:00:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uhGSZMqi2aufJJkiKEGoA6YS10J2IXaPL/Dyh2uKG04=; b=q+FnHNuKsHuTeFvXotGrHGe1TsnllqijPOhv5Q8SO+B/F7zG95G1Epo7BVp4N26tGT tvbcMwQYN1pKy4lAcISF9ykI/uUdPxl1eGa03Vd8EnIGeNNo/FdZCmlRHWrC06Vw/JQJ QznyhgAOIhsBclS4yGQB4vwJYfGLCryKdsDPfLHKHnF49T8l6DHxe2SKQbWtkrlCCfXM lQg7DmrZ4Gs5ljtwM81AbAQ0tSX8pH1Rp7V4mv+zsd94I8nyFKYhYXch7VNYxgr8WxS8 XxaqbxYRkQRndgMndMYy5b5m57r3e7o4yVrLTzlvhGI0YMIEIE1UY2AYeg23DRfEUtkX mfHA== X-Gm-Message-State: AFqh2kqHarTwhDBNX/2Rt4eWyKJ8kjEUARZpcGjSGE1lDu4CfPdPc6iu lsxkbhL1cQW6iLZrFhEOCcQ= X-Received: by 2002:a17:907:d406:b0:846:8c9a:68a0 with SMTP id vi6-20020a170907d40600b008468c9a68a0mr13877829ejc.30.1674151216208; Thu, 19 Jan 2023 10:00:16 -0800 (PST) Received: from localhost (fwdproxy-cln-024.fbsv.net. [2a03:2880:31ff:18::face:b00c]) by smtp.gmail.com with ESMTPSA id vo13-20020a170907a80d00b0086a4bb74cf7sm8959930ejc.212.2023.01.19.10.00.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Jan 2023 10:00:15 -0800 (PST) From: Breno Leitao <leitao@debian.org> To: leitao@debian.org, kuba@kernel.org, netdev@vger.kernel.org Cc: leit@fb.com, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, sa+renesas@sang-engineering.com, linux-kernel@vger.kernel.org, Michael van der Westhuizen <rmikey@meta.com> Subject: [RFC PATCH v2] netpoll: Remove 4s sleep during carrier detection Date: Thu, 19 Jan 2023 10:00:08 -0800 Message-Id: <20230119180008.2156048-1-leitao@debian.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230119164448.1348272-1-leitao@debian.org> References: <20230119164448.1348272-1-leitao@debian.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755470705499731677?= X-GMAIL-MSGID: =?utf-8?q?1755475333091555497?= |
Series |
[RFC,v2] netpoll: Remove 4s sleep during carrier detection
|
|
Commit Message
Breno Leitao
Jan. 19, 2023, 6 p.m. UTC
This patch proposes to remove the msleep(4s) during netpoll_setup() if
the carrier appears instantly.
Modern NICs do not seem to have this bouncing problem anymore, and this
sleep slows down the machine boot unnecessarily
Reported-by: Michael van der Westhuizen <rmikey@meta.com>
Signed-off-by: Breno Leitao <leitao@debian.org>
---
net/core/netpoll.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
Comments
On Thu, 19 Jan 2023 10:00:08 -0800 Breno Leitao wrote: > This patch proposes to remove the msleep(4s) during netpoll_setup() if > the carrier appears instantly. > > Modern NICs do not seem to have this bouncing problem anymore, and this > sleep slows down the machine boot unnecessarily We should mention in the message that the wait is counter-productive on servers which have BMC communicating over NC-SI via the same NIC as gets used for netconsole. BMC will keep the PHY up, hence the carrier appearing instantly. We could add a smaller delay, but really having instant carrier and then loosing it seems like a driver bug, so let's try to rip the band aid off and ask for forgiveness instead. Few extra process rules: - don't repost another version within 24h, - keep a changelog under --- - add tree name to the tag - [PATCH net-next] Also, I'd just go for PATCH, no need to RFC this. If someone wants to object they can object to a PATCH.
On Thu, Jan 19, 2023 at 11:04:21AM -0800, Jakub Kicinski wrote: > On Thu, 19 Jan 2023 10:00:08 -0800 Breno Leitao wrote: > > This patch proposes to remove the msleep(4s) during netpoll_setup() if > > the carrier appears instantly. > > > > Modern NICs do not seem to have this bouncing problem anymore, and this > > sleep slows down the machine boot unnecessarily I'm not sure 'bouncing' is the correct word here. That would imply up, down, up, down and then stable up. What i guess the real issue here was the MAC driver said the link was up while autoneg was still happening, which takes around 1.5 seconds. > We should mention in the message that the wait is counter-productive on > servers which have BMC communicating over NC-SI via the same NIC as gets > used for netconsole. BMC will keep the PHY up, hence the carrier > appearing instantly. > > We could add a smaller delay, but really having instant carrier and > then loosing it seems like a driver bug, so let's try to rip the band > aid off and ask for forgiveness instead. It would be good to put some of this into the commit message. Explain the case you see it go wrong. The other scenarios i can think of are: The bootloader configured the interface up, and used the interface, e.g. to tftp boot. The PHY was left up when transitioning into Linux. Hence there is no need to wait around 1.5 seconds for autoneg to complete. The link is fibre, SERDES getting sync could happen within 0.1Hz, and so it appears to be instantaneously. This work around does seem very old, pre-git times, so i also doubt there are many systems which are truly broken like this. Andrew
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 9be762e1d042..a089b704b986 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -682,7 +682,7 @@ int netpoll_setup(struct netpoll *np) } if (!netif_running(ndev)) { - unsigned long atmost, atleast; + unsigned long atmost; np_info(np, "device %s not up yet, forcing it\n", np->dev_name); @@ -694,7 +694,6 @@ int netpoll_setup(struct netpoll *np) } rtnl_unlock(); - atleast = jiffies + HZ/10; atmost = jiffies + carrier_timeout * HZ; while (!netif_carrier_ok(ndev)) { if (time_after(jiffies, atmost)) { @@ -704,15 +703,6 @@ int netpoll_setup(struct netpoll *np) msleep(1); } - /* If carrier appears to come up instantly, we don't - * trust it and pause so that we don't pump all our - * queued console messages into the bitbucket. - */ - - if (time_before(jiffies, atleast)) { - np_notice(np, "carrier detect appears untrustworthy, waiting 4 seconds\n"); - msleep(4000); - } rtnl_lock(); }