🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #22193

[PATCH net v5 4/6] igb: link queues to NAPIs under RTNL after runtime resume

#22193
From: Antonio Quartulli
Date: Tue, 24 Nov 2026 23:57
90 lines
12695 bytes
__igb_open() links queues to NAPIs with netif_queue_set_napi(), which
requires RTNL, but RTNL isn't held when resuming from runtime suspend:
this triggers "RTNL: assertion failed".

Link them in __igb_open() only when RTNL is held, and from the work
item that sets the real queue counts on runtime resume. The links can't
be kept across a suspend, because __igb_shutdown() frees the q_vectors.
A suspend now cancels the work item before freeing them, so it only runs
after the resume that scheduled it allocated them, and it checks
__IGB_DOWN under RTNL for a close in the meantime.

Tested with the 82576 emulated by QEMU.

Fixes: b75a1dea500f ("igb: Link queues to NAPI instances")
Cc: stable@vger.kernel.org # 6.16+
Closes: https://bugzilla.ipfire.org/show_bug.cgi?id=13562
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
---
v5: cancel the work item before a suspend (Sashiko)
v4: no changes
v3: link the NAPIs from the work item added by the previous patch, and
in __igb_open() whenever RTNL is held (also on system sleep resume);
dropped Joe's Reviewed-by, as the patch changed
v2: no code changes; mention the tested hardware

Note: igc has the same issue: __igc_open() also links queues to NAPIs
(igc_set_queue_napi()) on the RTNL-less runtime resume path. A fix will
follow separately once it has been tested on igc hardware.

 drivers/net/ethernet/intel/igb/igb_main.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 6961646..acd9a33 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -4146,8 +4146,19 @@ static int igb_set_real_num_queues(struct igb_adapter *adapter)
 	return netif_set_real_num_queues(netdev, adapter->num_tx_queues, rxq);
 }
 
+static void igb_link_queue_napis(struct igb_adapter *adapter)
+{
+	int i;
+
+	for (i = 0; i < adapter->num_q_vectors; i++)
+		igb_set_queue_napi(adapter, i, &adapter->q_vector[i]->napi);
+}
+
 /* Some settings need RTNL, which isn't held when resuming from runtime
- * suspend: apply them from here instead, if the device is still up.
+ * suspend: apply them from here instead, if the device is still up. A
+ * suspend cancels this work before freeing the q_vectors, so it only runs
+ * after the resume that scheduled it allocated them; checking __IGB_DOWN
+ * under RTNL covers a close in the meantime.
  */
 static void igb_rtnl_resume_task(struct work_struct *work)
 {
@@ -4160,6 +4171,7 @@ static void igb_rtnl_resume_task(struct work_struct *work)
 		if (igb_set_real_num_queues(adapter))
 			netdev_err(adapter->netdev,
 				   "error setting real queue count\n");
+		igb_link_queue_napis(adapter);
 	}
 	rtnl_unlock();
 }
@@ -4237,7 +4249,8 @@ static int __igb_open(struct net_device *netdev, bool resuming,
 	for (i = 0; i < adapter->num_q_vectors; i++) {
 		napi = &adapter->q_vector[i]->napi;
 		napi_enable(napi);
-		igb_set_queue_napi(adapter, i, napi);
+		if (rtnl_held)
+			igb_set_queue_napi(adapter, i, napi);
 	}
 
 	/* Clear any pending interrupts. */
@@ -9548,6 +9561,11 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake,
 	u32 wufc = runtime ? E1000_WUFC_LNKC : adapter->wol;
 	bool wake;
 
+	/* Don't let a work item queued by an earlier resume run once the
+	 * q_vectors are freed or reallocated
+	 */
+	cancel_work_sync(&adapter->rtnl_resume_task);
+
 	rtnl_lock();
 	netif_device_detach(netdev);
 
-- 
2.56.1
Technical Details
Message-ID: <20261124235723.1135808-5-antonio@mandelbit.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370887-linux-kernel-netdev=dewy.ru
References: <20261124235723.1135808-1-antonio@mandelbit.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370887-linux-kernel-netdev=dewy.ru
From: antonio@mandelbit.com (Antonio Quartulli)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v5 4/6] igb: link queues to NAPIs under RTNL after runtime resume
Date: Wed, 25 Nov 2026 00:57:19 +0100
Organization: Usenet Network
Message-ID: <20261124235723.1135808-5-antonio@mandelbit.com>
References: <20261124235723.1135808-1-antonio@mandelbit.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network; logging-data="67893"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:xv6YvrTCwkzWaPJNiuTElBTsvmE= sha256:RkTK9DfMlKROp6hqB0pv3uMn/macC2UD41gnuLQobsc= sha1:w+HHtNOl8qnOu0cdKc8e2tpwhrY= sha256:KkjFQNH6nsS6+64IUJEJhzkYdiXBoNKKvD7rRMUtI4A=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 31812125E2F; Wed, 25 Nov 2026 02:58:44 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=mandelbit.com
X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2-j5BalACvOS; Wed, 25 Nov 2026 02:58:40 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-370887-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mandelbit.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 4D0DC125E33; Wed, 25 Nov 2026 02:58:32 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 4455C3DAF9; Tue, 24 Nov 2026 23:58:00 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795564676; b=b96wyo1k/9dtcUS0Hlx4OyUOfcpZJI66FBVbT0q0DaaFxZ/13IFz2tXc6VwoQgh0sxkL miypqHHNuSnKcCLPhOEC7hKz3P9Zz5Vm2kekvUFuPvYdcOmnmA12SHh1zvB0yh43U3ONR 4OHxDeKL7lMtZ4yjB43H08PYEYswEU5mKo6HRK1amVdf4HAJghZ0oAFcBqmQD3ThTeqRC 710alr9i1RAAhG4pHPeAyEHLTp0JRZ1/LLdn86JipMht78tC+S1lHvFTw8dOb4TXEckxP HgS8+wFiX2TetuSK4GGusS7Hu/bUf0R/roZAg0Xe2HLZpeiUwZ+kQuO7+Lw5cvnTaGw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795564676; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:From:To: Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding:X-Rspamd-Queue-Id; bh=NeH4msFzp7KNZlqjZxxwoBpRbytEX5mDF3Plc/IaGJs=; b=M3Tdi00J2yFkk0r/LDe60ZNgbRQjA4+iWIt6nOFfCHZk2HMIUMqzU56PrCLT/WQiyZpL ZIZwipTtiaUu4hHV6FL2kD3yx4LfgXeW7X0AQMTs9fBgHlmeRLTctnuC6ZuRSbfvoCJhF fDfNq9CS867VQepOmLYlVCmhZyJpSZzV3ekJcuoy3Y0m2n0T+HEIUeX1QrDrQje/nQn0Y jBBPpLj4QCgyIxRWyWSC4kMrqAKbyUX3uI2muKWFoPIWk/wDmaxcsV2Vbcl4uNUP70Lja qxipiUziA2Hurou9KWP+1yFXqm8tDSAKxwwC+QGb3ATkeW0mo3oo4NgLE/eEt9n+Tcg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=o8lsIACM; dmarc=none header.from=mandelbit.com; spf=pass smtp.mailfrom=mandelbit.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B7FC6606A33A; Tue, 24 Nov 2026 23:57:56 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=o8lsIACM
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.61
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795564665; b=tzU/E5UCjIDk41oWkWaVOfZaMeGsxE/2Ya4jMB+GCnxs5T6k1NCTGxNp3xckQBs1NDey ymTl5eWmclTOiL01nX6/JBljx8M+QlJsZulXM2/ak0ro1FdSPAuBjONb0nnyNS+oUQn76 SPhXmN+ckxifGTA/GeT/W17PmBKewrMyVEyZJjppa7OVLaAIopsTYSirYZdWdi5GORcn5 /8wE6C4jcmY2aNxRRUpDa59Qxpvw3O7cDGUTce0nx4FxzXHDBsPLggNZGi9ZckNAoVmuC fxKxycW39JDEpVaogfAaNk/PQ/mo6jp0x/V/I5ioDR9infOk2MPMEL6QL/AMmGSo6Pg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795564665; h=DMARC-Filter:Received:DKIM-Signature:From:To:Cc:Subject:Date: Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Rspamd-Queue-Id; bh=NeH4msFzp7KNZlqjZxxwoBpRbytEX5mDF3Plc/IaGJs=; b=DBQd/NxDiclNShXHDM/ZSE/RB0WEgHFTmHwBuYqVBASfzrVbJVurWQMax/+i1lTgROXT p0IhNUmrk6sfbVnQOCQKmTJjRZbIDM9j30R0HlzSdhXwFClwCHIBri6f0jcA2ki0TgbRE ht2RvL6pF0tpaJdA3IJp30ukKiG0t4t3biPv21BIQARJPKkLp+1Z+pbQmNTD/IWbQ1udr oQYuMFkSPWk/WNPFoD8yJ4I5maK9AzfGOVZZ9qgGR7XX3QIv+8n/mmePKPJbJQerUqqCZ EgdXZytRyT6AV0yX5got5YJXzmREAMqIDVc51v+jYzedRDBx172AULD1yr+U+o+6x4g==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=mandelbit.com; spf=pass smtp.mailfrom=mandelbit.com; dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=o8lsIACM; arc=none smtp.remote-ip=195.10.208.61
X-Received: from mout-b-201.mailbox.org (mout-b-201.mailbox.org [195.10.208.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 56339606A696; Tue, 24 Nov 2026 23:57:45 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 56339606A696
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mandelbit.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mandelbit.com
X-Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-b-201.mailbox.org (Postfix) with ESMTPS id 4jZ09W6npszLmZY; Wed, 25 Nov 2026 00:57:35 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1795564656; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NeH4msFzp7KNZlqjZxxwoBpRbytEX5mDF3Plc/IaGJs=; b=o8lsIACMTombAUPxA3EYNk+avIvK70iDEo9juR+U8nGUVhzzcRSoBFnvLL4EQWlmDgsaKU j0SyREf8W6EucBR98SuYpU/Lee0dq9Mo1Zp9EznP/6SJB6jHu8GPVldUlA0AC3XwRaD9D3 y3hQ5ATjpSheYV4B6/3aedBwvrKFu+gkpKPVwRCYfC2r8WaQt4O/x+zRPuEHnLPXEjUf9z 5zM5SpmFjSTT4IY3rE9JC3tqdtMp9OHdjDdF6Y9jWvBgsuHLM6X//GglDxtw2nY4n3kzhT 66SmZqGxujzckuT8zJS3eOzutMjSpIMtfs/5lioUNxeZ+ms9B8UmyepdXxAMIw==
X-Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of antonio@mandelbit.com designates 2001:67c:2050:b231:465::102 as permitted sender) smtp.mailfrom=antonio@mandelbit.com
X-Cc: Antonio Quartulli <antonio@mandelbit.com>, Tony Nguyen <anthony.l.nguyen@intel.com>, Przemek Kitszel <przemyslaw.kitszel@intel.com>, Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Janis Edvarts Lacis <janislacis06@gmail.com>, Kurt Kanzenbach <kurt@linutronix.de>, Joe Damato <joe@dama.to>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org
X-Mailer: git-send-email 2.56.1
X-In-Reply-To: <20261124235723.1135808-1-antonio@mandelbit.com>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-Rspamd-Queue-Id: 4jZ09W6npszLmZY