🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19956

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

#19956
From: Antonio Quartulli
Date: Fri, 20 Nov 2026 21:01
75 lines
12140 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.
These are only freed while __IGB_DOWN is set, which is cleared once
they are allocated again, so the work item checks __IGB_DOWN under RTNL.

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>
---
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 | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 2f51edc..6196d7a 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -4126,8 +4126,18 @@ static int igb_sw_init(struct igb_adapter *adapter)
 	return 0;
 }
 
+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. The
+ * q_vectors are only freed while __IGB_DOWN is set, which is cleared once
+ * they are allocated again, so checking it under RTNL is safe.
  */
 static void igb_rtnl_resume_task(struct work_struct *work)
 {
@@ -4142,6 +4152,7 @@ static void igb_rtnl_resume_task(struct work_struct *work)
 					      adapter->num_rx_queues))
 			netdev_err(adapter->netdev,
 				   "error setting real queue count\n");
+		igb_link_queue_napis(adapter);
 	}
 	rtnl_unlock();
 }
@@ -4220,7 +4231,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. */
-- 
2.56.1
Technical Details
Message-ID: <20261120210134.133238-4-antonio@mandelbit.com>
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368140-linux-kernel-netdev=dewy.ru
References: <20261120210134.133238-1-antonio@mandelbit.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368140-linux-kernel-netdev=dewy.ru
From: antonio@mandelbit.com (Antonio Quartulli)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v4 3/4] igb: link queues to NAPIs under RTNL after runtime resume
Date: Fri, 20 Nov 2026 22:01:31 +0100
Organization: Usenet Network
Message-ID: <20261120210134.133238-4-antonio@mandelbit.com>
References: <20261120210134.133238-1-antonio@mandelbit.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3261363"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:nhQRpMasb4pNTQ+D7ofLbIc2KCI= sha256:NMlbAVHvJ7UY7Vu7vyyTlSB/rOAVbTmePvscPeQjz2g=
	sha1:Lbl1hXLfMxf2tts6GEAnW1y9/OQ= sha256:yUK6J8S4xyCbe+9nitFEWH/AwW+VOaIFfjrcgeHXZ2U=
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 964D6115A7A; Sat, 21 Nov 2026 00:02:08 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 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] 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 0qEFgoH6MeKW;
	Sat, 21 Nov 2026 00:02:04 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-368140-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 49140115A77; Sat, 21 Nov 2026 00:01:55 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id C120733F9B; Fri, 20 Nov 2026 21:01:53 +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=1795208512;
	b=KxYivsnPBFokzEhSEOkqUKxCh2EpqABKc6FpzGngCqeqeavk7qauqqcY/tMDPlYjH/2Z
	 GFXF5GkRxnITXB568l9KIbRDu0nfRgkN8qzYvpTbYixoKvm5Hg/AkyUWJ0PxSs7y6ySgi
	 d9Rj3XO1Mzl/+ASNJ4jB6z1cF6wK+YWAdEemdsLC7NjCfbMUAtxB2ZuhH5HNNnd+DeucX
	 rFwENJi2jnvDoVL/IsyxJltFAh8TLriWp19qZhgbeAtKDQgDcFh1L1V33pUJGQD2Q2MqB
	 sVCm3y2QFUP8kflHTfYy1Czfl0z/Rcfmfoqw0btuSprIkwmYnrr1aUPIsXsF3/Vj+yA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795208512;
	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=3blRyucdn1/HRvUCne6T2JCoz9R9O6w1N7Z8V5yWf70=;
	b=Y3iDhLkHeXOW4y6m5DD9dXnVBIKy6LsJmG7blrGKpu5uz9LS8ozdj7xKPxyskrdNRYev
	 aa/mkipLxroZ/aa91T3r3ZlzvF+SsTD7lgHfa9N0L+QRUEgtMbi0ADs1t+gDQDzpI0nQE
	 nt2tsu/CjFK7qGEaWoTSKScxLL+I7IM12WJHql0TlJdcon3SlG7ashSsbpdjgMFVCpSq1
	 lAGpw480uZM6yNoQHmivgR4Ps1SbIhJ6V3BkAf6kfvf+r4oy5c0jFu4pNDdwmN3odDMQa
	 Ss4TnvRNPoF+h5mKhYtk4NAVAhEz2XzC9TIrxUXoHqTuN0nv6aQrwt+A6mypzFihi9w==
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=hbyl4NuB;
	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 CD52B606A69F;
	Fri, 20 Nov 2026 21:01:52 +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=hbyl4NuB
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.51
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795208512;
	b=XwmnasiEaDum0A5XVyCGahDtWm2RLgFNzJ07aVX0b38U3jxN26E+PKNhETW9XvQn0pSt
	 wfTOpWrDGbKgJnjt75OiV/E/lHiNK07yXhiAY7P5JVk2RLg6EFgSQFEB/pbf3xhlFON2w
	 1fKkukTGRvW0xIF4pagFZdXORq8pyrVVWWMKmbPgkseObkB3PJAQWj+7F2rLOSO53lc1q
	 IzDLEujja+2wQf2v+PJuYCg8OSGf/iqqHtfwM74Wb7xnXwCjeoGf8EK37lPacLA8o9aA/
	 h5PZJbKoXDRmWLavgVOTBttPAf2AR3RVoFwHF15o7mQd98xXCqY9NDvGUNJZY0/lLTg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795208512;
	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=3blRyucdn1/HRvUCne6T2JCoz9R9O6w1N7Z8V5yWf70=;
	b=0Ah6mGPfF9Deqfpf2/MyNKLjFeE6cUaKNgfpO/MOc8cWyT/8Irv6fnWmSSRIMRkpC/7v
	 JRjoDChUWIE6UwP0fCOT5kBmq2xrbNKCeK/2rS32YThMmOtXp0pT8xPxvaYX6mnWCesSr
	 mvFGG7pqszFnxt+vbU1PQ4Qne6AhP5l9Qm1j76tMweO/J7SRzvEz9mGemu1dI4xp12jUQ
	 cn05P5M/INfaX9wK5a0o9CNYnaozC1EnDLSkqE9j7cBbNYdz9LcXfcgdlI2N/u05EETCa
	 iH0wKTmgtCLEG2ugUAr+UAjB1lQ+2vzK4lUhPn5c5UB3B9mJsAPPXkhqB9gzzymEmfQ==
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=hbyl4NuB;
	arc=none smtp.remote-ip=195.10.208.51
X-Received: from mout-b-206.mailbox.org (mout-b-206.mailbox.org [195.10.208.51])
	(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 723CA606A6AD;
	Fri, 20 Nov 2026 21:01:48 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 723CA606A6AD
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-206.mailbox.org (Postfix) with ESMTPS id 4jWSSS1GrVzXK;
	Fri, 20 Nov 2026 22:01:44 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com;
	s=MBO0001; t=1795208504;
	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=3blRyucdn1/HRvUCne6T2JCoz9R9O6w1N7Z8V5yWf70=;
	b=hbyl4NuBeC/sXNsuHFvwgcsYPghc4rQfFuhyOsHbIE4VRR9+XQODpqa+3BUoa7byatJ6O9
	WOmmXEfD57jm2SNkY0T2XE0tcEdtu9CQn16rSIyyP1/T0SN50dAv5iJrhP0qdgg7c6pYyz
	IUscaQJPYMNohy67p/7B8LOCJhqgUXlkyZSEq3QJxzsz0VSdjgI/rZL0Pa2qOrSV1hCos4
	2L99d//zoFtAaNYad+WsdM4Nqf+L02/LxcndT1kaKrGmgOVRxxn1j2V0woVSHLpJfUoHft
	Wvqs7zU0vRAiU2N+PMN2llAGm92/psoS5rzEyBd/dScwrWm3fS5mudZmtjz49Q==
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: <20261120210134.133238-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: 4jWSSS1GrVzXK