From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 086CDC6FA8E for ; Sun, 26 Feb 2023 15:42:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229600AbjBZPmS (ORCPT ); Sun, 26 Feb 2023 10:42:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbjBZPmR (ORCPT ); Sun, 26 Feb 2023 10:42:17 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7D2B19B0; Sun, 26 Feb 2023 07:42:15 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CFEBB60C39; Sun, 26 Feb 2023 14:45:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C6C8C433A4; Sun, 26 Feb 2023 14:45:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1677422752; bh=JTXUgg/LGG3Bv9DFiFh/kQ/gaYrlc14G0hjTcoCjYFk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MpZSRnYVCaXeKfgPrXu5pkv+onO5dM+NsXCnLbeEAexqRSpAwMqRRAjf7EiFw06Bu 38hMzXXN8NjpDZN/EPiJZPFPpOsozVwZcYI4Wp4g6ZwazjfO0yH2uQm5cCyH9WNQx9 Oqzu+Vr3hnZ/t4NLqVVzFvwYHNRkLQyVUEkgRwc13uPunwoEDhDjDA0eWP3fgEuchr nEjDHf0Wa6g3Ek6Kys5f8ZyeQxMxVh3V6P4RrBn50dJU0vLkWY35KAmFA2L6t5+sl0 bdGk3+wAtLjn9//cArMuBGrdXdAko+WRFHLnQrtfg3DMtGNE1PACMbtcbYcrwS4SHi +3yuG4BtxVZ4Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Breno Leitao , Michael van der Westhuizen , Jakub Kicinski , Sasha Levin , davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, wsa+renesas@sang-engineering.com, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 6.2 26/53] netpoll: Remove 4s sleep during carrier detection Date: Sun, 26 Feb 2023 09:44:18 -0500 Message-Id: <20230226144446.824580-26-sashal@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230226144446.824580-1-sashal@kernel.org> References: <20230226144446.824580-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Breno Leitao [ Upstream commit d8afe2f8a92d2aac3df645772f6ee61b0b2fc147 ] This patch removes the msleep(4s) during netpoll_setup() if the carrier appears instantly. Here are some scenarios where this workaround is counter-productive in modern ages: 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. The link is fibre, SERDES getting sync could happen within 0.1Hz, and the carrier also appears instantly. Other than that, if a driver is reporting instant carrier and then losing it, this is probably a driver bug. Reported-by: Michael van der Westhuizen Signed-off-by: Breno Leitao Link: https://lore.kernel.org/r/20230125185230.3574681-1-leitao@debian.org Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/core/netpoll.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 9be762e1d0428..a089b704b986d 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(); } -- 2.39.0