From patchwork Fri Dec 8 09:52:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 13485124 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="V67GxKH4" Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:242:246e::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 952F9172B for ; Fri, 8 Dec 2023 01:52:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-To:Resent-Cc: Resent-Message-ID:In-Reply-To:References; bh=ZfVcCRN7TGJNPU/oKOExKs0+eTvohw5Fj4WDNPwYC6I=; t=1702029141; x=1703238741; b=V67GxKH4/BY8573xEGJXro4y7tSatk6ZVHS/ifjXHphQpFforoaX5XuB8CB/vJkRnCNBz3pzlQn J1cIkBdbYscYA94x6Xsd+7udTU7zwThS2t4ZZFSH7lwD176/o4kQc7IxBAsvN8AUyhz/3xSQa65rG Yzn7i3wQ3v/wOlGEXYbImmohCQ5EFdvwisj8363A5iZ87lz0d7OmOSurBqvibyd2l6crISScFTw65 RrxfM5IXO30/9t54xJOobvkwkA3abj0AuYn7yzz0E8+roaSxAXDRy8JTnmiuL/CsPtddMOpe9BU8I 8iwjD4ZEIRaEE73R2ttV9ND9yC4YjAEctG/Q==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rBXWs-00000002g6Q-02dc; Fri, 08 Dec 2023 10:52:18 +0100 From: Johannes Berg To: netdev@vger.kernel.org Cc: Marek Szyprowski , Johannes Berg Subject: [PATCH net-next] Revert "net: rtnetlink: remove local list in __linkwatch_run_queue()" Date: Fri, 8 Dec 2023 10:52:15 +0100 Message-ID: <20231208105214.42304677dc64.I9be9486d2fa97a396d0c73e455d5cab5f376b837@changeid> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Johannes Berg This reverts commit b8dbbbc535a9 ("net: rtnetlink: remove local list in __linkwatch_run_queue()"). It's evidently broken when there's a non-urgent work that gets added back, and then the loop can never finish. While reverting, add a note about that. Reported-by: Marek Szyprowski Fixes: b8dbbbc535a9 ("net: rtnetlink: remove local list in __linkwatch_run_queue()") Signed-off-by: Johannes Berg --- Clear case of me being asleep at the wheel ... sorry about that! --- net/core/link_watch.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/net/core/link_watch.c b/net/core/link_watch.c index 7be5b3ab32bd..429571c258da 100644 --- a/net/core/link_watch.c +++ b/net/core/link_watch.c @@ -192,6 +192,11 @@ static void __linkwatch_run_queue(int urgent_only) #define MAX_DO_DEV_PER_LOOP 100 int do_dev = MAX_DO_DEV_PER_LOOP; + /* Use a local list here since we add non-urgent + * events back to the global one when called with + * urgent_only=1. + */ + LIST_HEAD(wrk); /* Give urgent case more budget */ if (urgent_only) @@ -213,11 +218,12 @@ static void __linkwatch_run_queue(int urgent_only) clear_bit(LW_URGENT, &linkwatch_flags); spin_lock_irq(&lweventlist_lock); - while (!list_empty(&lweventlist) && do_dev > 0) { + list_splice_init(&lweventlist, &wrk); + + while (!list_empty(&wrk) && do_dev > 0) { struct net_device *dev; - dev = list_first_entry(&lweventlist, struct net_device, - link_watch_list); + dev = list_first_entry(&wrk, struct net_device, link_watch_list); list_del_init(&dev->link_watch_list); if (!netif_device_present(dev) || @@ -235,6 +241,9 @@ static void __linkwatch_run_queue(int urgent_only) spin_lock_irq(&lweventlist_lock); } + /* Add the remaining work back to lweventlist */ + list_splice_init(&wrk, &lweventlist); + if (!list_empty(&lweventlist)) linkwatch_schedule_work(0); spin_unlock_irq(&lweventlist_lock);