🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24799

[PATCH net v6 5/7] igb: link queues to NAPIs under RTNL after runtime resume

#24799
From: Antonio Quartulli
Date: Mon, 30 Nov 2026 21:37
80 lines
13020 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.
The work item resumes the device and checks __IGB_DOWN under RTNL
first, so the q_vectors exist when it links them.

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>
---
v6: don't cancel the work item in __igb_shutdown() anymore: it resumes
the device first (patch 3), and a runtime suspend no longer waits for
RTNL (patch 1), so cancelling it there could deadlock (Sashiko); dropped
Janis's Reviewed-by
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 | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 8b8e8c3..55352df 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -4152,9 +4152,18 @@ 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.
- * Resuming the device first waits for a resume or suspend in progress.
+ * Resuming the device first waits for a resume or suspend in progress, so
+ * that the q_vectors aren't being freed or allocated meanwhile.
  */
 static void igb_rtnl_resume_task(struct work_struct *work)
 {
@@ -4168,6 +4177,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);
 	}
 	pm_runtime_put(&adapter->pdev->dev);
 	rtnl_unlock();
@@ -4246,7 +4256,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: <20261130213740.3323814-6-antonio@mandelbit.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374475-linux-kernel-netdev=dewy.ru
References: <20261130213740.3323814-1-antonio@mandelbit.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374475-linux-kernel-netdev=dewy.ru
From: antonio@mandelbit.com (Antonio Quartulli)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v6 5/7] igb: link queues to NAPIs under RTNL after runtime resume
Date: Mon, 30 Nov 2026 22:37:35 +0100
Organization: Usenet Network
Message-ID: <20261130213740.3323814-6-antonio@mandelbit.com>
References: <20261130213740.3323814-1-antonio@mandelbit.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1544687"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:gym4QklIY2iZnJXuK5SkzRcx5m4= sha256:OxjM25/j+tbmHQf2apQ817gwsMGX5K8y4AAH2oT4fQM=
	sha1:DcsqY5uYNRFVXgL8BB69wCLhuqk= sha256:b+vGtiboTCPbO7rUpHEaopMm1NBvoVhdivONcYJSvxA=
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 184DA12600E; Tue,  1 Dec 2026 00:39:35 +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 WeUk1D9PUc4m;
	Tue,  1 Dec 2026 00:39:31 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374475-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 862FE12600B; Tue,  1 Dec 2026 00:39:23 +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 93327331E0; Mon, 30 Nov 2026 21:38:32 +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=1796074698;
	b=d1cVomj4W6JqaxqCyhtI1zEy/Lr/w6TdpIIQgaSr/bf/svZMumGwCYd1AWaO1/WPu4Yt
	 qf7reRnXUotplAiVk9NWI6AXn0dbaHsi/vAT06ML838pR937r/defbjR48SxcvKwWESxT
	 Eg7bttH4jxGbGaQusyi3xtarWJNeyIFTULChH3dpcSGFL5HTO1XKSzr2hTlN/pZy2hjKP
	 2kVEAJ4ypjqIhjd9x+BazsJFqCVp7E+5edK7Xf03YWd8AwUHI/HgRYO/4gdU/ANxLBYhq
	 oCzCa9BkkIE+J9gFRPDmw4tq+6aQxm68LD5urvCVuYeWfGwhwZB3nY+6rELnO1CV+Kw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796074698;
	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=gBXyZuhUUEh27uMgE1yVOfS2WVz9LEGN9AcnMwp+R+c=;
	b=0qBjk6w6u2+seo45tAtToL7JrHcgf4P/COmnuqAM/+8DNY98+Wp0t3wcaucmXiA1QmQm
	 WKM2lWX0Ht+W/edZBT2sPMo/X2qIMn7m4GfYbTPPWUGyyKA5NY9ruBiR5HnBTDrw4lieY
	 KkPHH/dB2Ee95yM6G3wHY4+W3Zm3M7Pd1uoOJLWSNpqh/QCGSli9ogG6crLv1HOG+XOO0
	 xIfspD8SCuK/j22zV40RqwmZPobgwkvvhK4ECPVAFo88qRXfNJPQP3u3cMbV7yA2nxAcv
	 wiyJXZR0xbAAZTXVK57ad7A2exx2nWpkC5HsJY89aY8jHuYq4/Drbx6IEv75D09VsGQ==
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=DphwwjVq;
	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 0A951606A32D;
	Mon, 30 Nov 2026 21:38:18 +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=DphwwjVq
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=1796074687;
	b=OBmGEfR+TQMPaBfSY73JnMwGvV3S1gzElyjV9es4w9WbompLVEe6f5qh9ycMFBzV3XwC
	 SINtRiqfWvEPUe+jbJHo5dhNU1kmYoXqK2mtOPE8yNw9AA+9lqfbxomcsWlGno69Shr7G
	 Lkg5bu5iQR8q8LCSrXIUpgCeDo8oTmvjwG+p7d1mD4VwJPJgB3pNW9RuziuY/YXrVheJ7
	 bCj7VOnOBrQgp2C7OewzIC6+PNAfWeoXMTUrX7NNcvXg07CD+tYDGpitxHQ0XdEPUz5iU
	 ZpXQRSkMIS8cEBs4VR0AHjc9AUX3VYQNAWJVw5W6qzZWS2Z88U8D21HZUSg0hdIBTIg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796074687;
	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=gBXyZuhUUEh27uMgE1yVOfS2WVz9LEGN9AcnMwp+R+c=;
	b=g09BbbGiXePgge1FANN+5yszEgSTJYRBlqAzXMAhW1Iv9qCHU/oJugPx/VSyVQc81+yg
	 pnqFcyT8W3728kMqhwdsOyRQXUxD+2QaDM5iVuooCcnQ/0/b98EkNzZ1oqnKJcp8RvadI
	 36uEbEo8j9RQcX3SAH0DMjPjz6DznhgijvLcLDqkKfO1Bkh1bpA7wcfBIZPGjsRab0yC0
	 TEqMFBxFRpYPe8COgctLKICYZ7zVSBS9upJT9YkQSQJ9yykTb1VULeECjJ5+E++Goq1Id
	 fQn5paxTYpHoz1HyQgJ0wNajW47BzoRLqvj0d9wzSdwlFPlh7xtnzCcQ3jC0l8cxWxg==
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=DphwwjVq;
	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 A54BA606A68E;
	Mon, 30 Nov 2026 21:38:06 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A54BA606A68E
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 smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202])
	(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 4jdcnc3Y74zLm37;
	Mon, 30 Nov 2026 22:37:56 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com;
	s=MBO0001; t=1796074676;
	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=gBXyZuhUUEh27uMgE1yVOfS2WVz9LEGN9AcnMwp+R+c=;
	b=DphwwjVqu6LNAEm3sA8DD2Ho96BS5MNVqmJNwjwV3n791bZXWqms+pGt/HKA1xmA8X/5QE
	d/mcn5zSzRrZk2lI9fGHJqZHmvbk8XEBcCclQmG1FCEedfHrF0SRabGEy+6gAFjkw0xTK1
	iWps1TSOo/FDd7tQOHGPxJj64jbj2ZUnCifp9xi2WeY+tDP7UGKNIHalWvOUNAXPeZDift
	EXQmI/+wihH8lbNy8Fz+rhTNRVTe/H8xpbkC+BlfUVq/5qxigHaBcJMAV7g8WGIhWqIHig
	O0sHJy2cG1oOuqTTI/2lhdOXTK6qaoTVTWd9xSKOjlpzr5e+Yqsv/3vfOBgX3A==
X-Authentication-Results: outgoing_mbo_mout;
	dkim=none;
	spf=pass (outgoing_mbo_mout: domain of antonio@mandelbit.com designates 2001:67c:2050:b231:465::202 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>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	Stanislav Fomichev <sdf@fomichev.me>,
	Sriram Yagnaraman <sriram.yagnaraman@ericsson.com>,
	Kurt Kanzenbach <kurt@linutronix.de>,
	Maciej Fijalkowski <maciej.fijalkowski@intel.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Joe Damato <joe@dama.to>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Sven Auhagen <sven.auhagen@voleatech.de>,
	netdev@vger.kernel.org,
	linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	bpf@vger.kernel.org,
	stable@vger.kernel.org
X-Mailer: git-send-email 2.56.1
X-In-Reply-To: <20261130213740.3323814-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: 4jdcnc3Y74zLm37