Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.51 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796171012; b=LTbkV86/YI5BAvTvd7/zMh8I0iqvaGZGMjTil9aPo8SsoQLb1BAW2Py99f5gLG05wJ6K gxvekIOw1N/FPysSFH+dSB1bg2+QZnwxk1+JQd4cfWhn1dF3bREQtoqCpmS5Uo7xlLG9o FYzc8LsIT77PgPQ0i8xCuAPBaepB6QrWZ2B7+9clWWG1G1qJDgDbPm+TSjlruoKV610Rr ES61k+tvUWXF5re0yvYS8uWe1KYGnLZrfAb6/qlQPo9OKcL9M30xHaPS2E7dFJeQah/2c eXqU6joNDPy3oBxok+Zm6ghAN/hBLMPpCzVcgynB4kx5UgiPiNGz91ZgipUsafJQ6Iw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796171012; 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=+5vW59LStbygz+hebHWemCzL5VcXHTR3DSIq2C3UVno=; b=LEQ3N7GCAoAldrM31YshpFAuXr/ygYLcFwH5YQK80LfN4JHKjadfs5MLB+Tmm2iIMSzp GFmCeBz1+udnbyiJi5zMmXKKHbyhbW5FTuFjE7cIhtD0W6AHk52EX7/xRhnJCvnqQmMO1 2Un+gPOVvTiUDZOjON/wxsIh39Y5T2OOmUlVgqU7lec7nDNyRtJhLCxF1WA1p7aCFnlAJ 8LeuCoK89pdUS30L7ihnRalAY3A+8q8vvl9LWJk2q/NEQh2HBqLxgPtIu7DenTY17KEPt F1mErvHNpqcI9q3eF/jiZlpJfftLzVdtbbI+2N2tSaaWWNXQATJEFxpMFiPDoq8Ak4Q== 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="Fv/TEhJq"; arc=none smtp.remote-ip=195.10.208.51 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 38989606A335; Wed, 2 Dec 2026 00:23:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 38989606A335 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mandelbit.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mandelbit.com 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=Fv/TEhJq Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (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 4jfJQ70DWwzcQ; Wed, 02 Dec 2026 01:23:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1796171007; 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=+5vW59LStbygz+hebHWemCzL5VcXHTR3DSIq2C3UVno=; b=Fv/TEhJqdxnB+FgZC5OZIoe+xtW+oBmO0NoUMWtJsy1Zp5XxvkTTxGmLUKhzrzllf4P0z6 TyIH/KkHnuyqSNrTtz561MgUAsOi9+jle2pBZPgq/KyVnbJO82jFZLF7brzm3QjWtq2WAX KylwNlIi1SgjDy3m1ZTBNFNCIaG4DNHLx4NuOFaQ3dN1YQzFeLb3mohgU+2eMGhQNCLeR8 +1tq1jkcQ7qPAsMpzyv4XfTz9uMSuwj7xaoYKaax7EepMC8av98XEeEj3PG/A8jU7/1epo cwN/q7A+ZbRBDOHo5ffsHSHsAThrrFANVNIQ6nA1I0oR6R2adgIBFNegak2UIg== Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of antonio@mandelbit.com designates 2001:67c:2050:b231:465::1 as permitted sender) smtp.mailfrom=antonio@mandelbit.com From: Antonio Quartulli To: intel-wired-lan@lists.osuosl.org Cc: Antonio Quartulli , Tony Nguyen , Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Janis Edvarts Lacis , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , Sriram Yagnaraman , Kurt Kanzenbach , Maciej Fijalkowski , Heiner Kallweit , Joe Damato , "Rafael J. Wysocki" , Sven Auhagen , netdev@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH net v7 5/7] igb: link queues to NAPIs under RTNL after runtime resume Date: Wed, 2 Dec 2026 01:23:13 +0100 Message-ID: <20261202002317.3140591-6-antonio@mandelbit.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261202002317.3140591-1-antonio@mandelbit.com> References: <20261202002317.3140591-1-antonio@mandelbit.com> X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4jfJQ70DWwzcQ __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 --- v7: no changes 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