πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24026

Re: [PATCH net v5 2/6] igb: fix RTNL assertion when resuming from runtime suspend

#24026
From: netdev-bot+sashiko
Date: Sun, 29 Nov 2026 00:37
198 lines
14844 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] On runtime resume, __igb_resume() calls __igb_open(netdev, true,
  false).

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but the patch's
  runtime-resume design depends on it and it stays reachable at the end…

--

igb: fix RTNL assertion when resuming from runtime suspend

On runtime resume, __igb_open() no longer sets the real queue counts.
They are now set from a new work item, igb_rtnl_resume_task(), which takes
RTNL. Until that work runs, igb_xmit_frame() drops packets for stack
queues the device doesn't have.

Closes: https://bugzilla.ipfire.org/show_bug.cgi?id=13562

> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index 131df3e09ba14..6b299a1429a8e 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c

[ ... ]

> @@ -4122,10 +4125,31 @@ static int igb_sw_init(struct igb_adapter *adapter)
>  	return 0;
>  }
>  
> +/* Some settings need RTNL, which isn't held when resuming from runtime
> + * suspend: apply them from here instead, if the device is still up.
> + */
> +static void igb_rtnl_resume_task(struct work_struct *work)
> +{
> +	struct igb_adapter *adapter = container_of(work, struct igb_adapter,
> +						   rtnl_resume_task);
> +
> +	rtnl_lock();
> +	if (!test_bit(__IGB_DOWN, &adapter->state) &&
> +	    netif_running(adapter->netdev)) {
> +		if (netif_set_real_num_queues(adapter->netdev,
> +					      adapter->num_tx_queues,
> +					      adapter->num_rx_queues))
> +			netdev_err(adapter->netdev,
> +				   "error setting real queue count\n");

[Severity: Low]
If netif_set_real_num_queues() fails here, does the stack stay out of step
with the hardware until the next ifdown/ifup or system resume?

On runtime resume, __igb_resume() calls __igb_open(netdev, true, false).
That skips the queue count update, but it still enables every ring,
programs RSS across adapter->num_rx_queues through
igb_configure()->igb_setup_mrqc(), and starts all stack TX queues.

Here is one way to reach it. An earlier runtime resume falls back from
MSI-X to MSI, so this work lowers real_num_{tx,rx}_queues to 1. A later
runtime resume gets MSI-X with N queues again, so the counts have to go
up. Raising them can fail with -ENOMEM while allocating the sysfs queue
kobjects or XPS maps.

When that happens, the NIC has N rings armed and RSS spreads RX over N
queues, but the stack only sees one TX queue and one RX queue. TX uses
only ring 0, RX skbs carry queue indices >= real_num_rx_queues, and
per-queue reporting is wrong.

Before this patch, a failure in __igb_open() unwound through
err_set_queues, so the stack and the hardware stayed consistent.

The same mismatch also exists, without any failure, between the resume
and the moment this work runs. The commit message only covers the
opposite direction, where the device has fewer queues than the stack. At
the end of the series this failure is still only logged.

Should this retry, or bring the hardware configuration back in line with
the stack?

> +	}
> +	rtnl_unlock();
> +}
> +

[ ... ]

> @@ -4178,16 +4203,15 @@ static int __igb_open(struct net_device *netdev, bool resuming)
>  	if (err)
>  		goto err_req_irq;
>  
> -	/* Notify the stack of the actual queue counts. */
> -	err = netif_set_real_num_tx_queues(adapter->netdev,
> -					   adapter->num_tx_queues);
> -	if (err)
> -		goto err_set_queues;
> -
> -	err = netif_set_real_num_rx_queues(adapter->netdev,
> -					   adapter->num_rx_queues);
> -	if (err)
> -		goto err_set_queues;
> +	/* Notify the stack of the actual queue counts. This needs RTNL: on
> +	 * runtime resume igb_rtnl_resume_task() does it.
> +	 */
> +	if (rtnl_held) {
> +		err = netif_set_real_num_queues(netdev, adapter->num_tx_queues,
> +						adapter->num_rx_queues);
> +		if (err)
> +			goto err_set_queues;
> +	}

[ ... ]

> @@ -9638,8 +9668,11 @@ static int __igb_resume(struct device *dev, bool rpm)
>  
>  	if (!rpm)
>  		rtnl_lock();
> -	if (!err && netif_running(netdev))
> -		err = __igb_open(netdev, true);
> +	if (!err && netif_running(netdev)) {
> +		err = __igb_open(netdev, true, !rpm);
> +		if (!err && rpm)
> +			schedule_work(&adapter->rtnl_resume_task);
> +	}

[Severity: High]
This is a pre-existing issue and was not introduced by this patch.
However, the runtime resume design here relies on it, and it can still
be reached at the end of the series. Can the runtime suspend path
deadlock against RTNL holders?

igb_runtime_suspend()->__igb_shutdown(pdev, NULL, 1) always takes RTNL:

drivers/net/ethernet/intel/igb/igb_main.c:__igb_shutdown() {
    ...
	rtnl_lock();
	netif_device_detach(netdev);
    ...
}

rpm_suspend() sets runtime_status to RPM_SUSPENDING before it calls the
callback. While the callback is blocked in rtnl_lock(), any RTNL holder
that does a synchronous runtime resume of the same PCI device waits in
rpm_resume() with no timeout:

drivers/base/power/runtime.c:rpm_resume() {
    ...
		for (;;) {
			prepare_to_wait(&dev->power.wait_queue, &wait,
					TASK_UNINTERRUPTIBLE);
			if (dev->power.runtime_status != RPM_RESUMING &&
			    dev->power.runtime_status != RPM_SUSPENDING)
				break;
    ...
}

Several RTNL holders do this. One is ethnl_ops_begin():

net/ethtool/netlink.c:ethnl_ops_begin() {
    ...
	if (dev->dev.parent)
		pm_runtime_get_sync(dev->dev.parent);

	netdev_assert_locked_ops_compat(dev);
    ...
}

Others are the ethtool ioctl path and
dev_close()->igb_close()->__igb_close(netdev, false), which calls
pm_runtime_get_sync(). igb_xdp() joins them once the later commit "igb:
resume the device before changing XDP or XSK settings" is applied.

The suspend waits for RTNL, and the RTNL holder waits for the suspend to
finish. Every other rtnl_lock() caller then hangs.

Ethtool netlink GET requests don't need CAP_NET_ADMIN. Once runtime PM is
enabled (power/control=auto) and the link is down, an unprivileged user
could hit this race.

This is the suspend-side counterpart of the resume deadlock fixed by
ac8c58f5b535. The commit message of "igb: resume the device before
changing XDP or XSK settings" says this deadlock remains, and no patch in
the series fixes it.

At the end of the series, __igb_shutdown() also calls
cancel_work_sync(&adapter->rtnl_resume_task) before rtnl_lock(). That
work takes RTNL, so does it become part of the same dependency cycle?

>  
>  	if (!err)
>  		netif_device_attach(netdev);

-- 
Sashiko AI review Β· https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124235723.1135808-1-antonio%40mandelbit.com
Technical Details
Message-ID: <179591262508.3135.17271462745595226858@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373321-linux-kernel-netdev=dewy.ru
References: <20261124235723.1135808-3-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!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373321-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v5 2/6] igb: fix RTNL assertion when resuming from
 runtime suspend
Date: Sun, 29 Nov 2026 00:37:05 +0000
Organization: Usenet Network
Message-ID: <179591262508.3135.17271462745595226858@kernel.org>
References: <20261124235723.1135808-3-antonio@mandelbit.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1069314"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:UuX9vT7/Dqa+kq6uAryXwyXjeAM= sha256:v5NDB+g8TFNLa4rs+2Afa1eCzdoZfLxdJPZTtLAFYa4=
	sha1:SUH5nxZlsu72FLsuP3ss8buq+tY= sha256:BxWcQxohPkAGCdtiNqB+tHvpUeH65phLfNi1CaXGqM8=
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 A0B0C125F90; Sun, 29 Nov 2026 03:37:31 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	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=kernel.org
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 5Mcf9QtceVg9;
	Sun, 29 Nov 2026 03:37:27 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-373321-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 98199125F8E; Sun, 29 Nov 2026 03:37:18 +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 02E04271D4; Sun, 29 Nov 2026 00:37:14 +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=1795912632;
	b=WW5rHRvrK7/eYbE6fNKy1mxeRUNdSqbK4FMhy3Z3yCipUGl+iiTe2ldX01BtAPG1XtTQ
	 lijK74bqBa//vDxcfjZbSo3o3oGvThVrTabyJl9CrYa+a7ReW17cBEYF9nuxszz8v0F24
	 edbDJ4CeZ0fYziYqMrDFuwtU6u9gk1zg/VHztDSs7MMbHxb+judCvHmQJTtDz6N0F9sCQ
	 /UiPzHyV9n140iDFwHRO+tnyJIrWIkoDdiUpLoX45XrZU46Yb1ubHV8fzjdjDGyJUZoah
	 YxflFbmi5RT1ya2Q6ipn1GWR567/nSZIAfWS9inFTfmX1x89JCAwoY29Mg79sPDrKYA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795912632;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=x35pdvpIA9xPL/BrGpyru+zb5ug0v6qGOudCOa6vB6Y=;
	b=jb3bodP7oG+iJZC4PF3DsB8Wvu6fWKZiyjF4PipexaQHGLyMHMnwXlSl9lbdEhHGNuMJ
	 wSvEn1E8iqXMkUzXVT/cW8FT/SpwaUuLZ9ZMhIv7ct8BLyJzMeIUHsgGfAG/KdXsOc0IA
	 ht15iT5Nm/SKMXa+rh0OCiQPJnKIpp4DX0i8xMdO1Iz4fxWfOirL9AuxLD2Ua3M2EpGRf
	 WvhibYxuXw3R7Xj8G4CdBerVRu8KP7wj2BxOgLP3TsDe/nNNxwN/xPJk9VHjtO9Hji+Cs
	 PW8hmu7YIR/Enq+/wIFG/QhFsSmCKiv3ML/jSeM6Fo4Tx8sjsECr0BMy0QSFaMZq7VQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ouKJZqkG;
	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 89B95606A68F;
	Sun, 29 Nov 2026 00:37:12 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ouKJZqkG
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795912626;
	b=GaT0RNTt4XXig6/nmb3n2/C9nodEmeymvbx7kaO7mpjvQYMNDZs155XG5mW5WweAMoV4
	 5qFkIuAXsaQyP2Tq/WCW3Y1N5Hi7/Lg9QBHJ58VLXl9JqvPdzvIXJCzBH7Yr6TghYnGmO
	 Vx0fZs89b0Qrr7Dl42S17/JeHxd5U/5lFCzHtHe0Pmbfazmpj7jYqdHmfDnod2P5qX4oi
	 L/RRjYcI5NZypOAuvep+ucL8HfZwnCug6T3ts+CwED6lrJUeQUmr6eF7k83eA/Yj+oSoD
	 nJYMh6NDTKtFrW6aZn342VNwMrD8KuZAidG8hoV442kb+dofbkJlMkY845vKC2+op9A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795912626;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=x35pdvpIA9xPL/BrGpyru+zb5ug0v6qGOudCOa6vB6Y=;
	b=yhalWIsvEQZtAvpjBG3D/Xc4Ji3wWclOEbPu5F1PuTB8CnSRB+hD1Rm9dC1pn6n6U0i0
	 PYvjRsXSJ7dWSIeMgLD7u6polYZfp01i3GzXy9FapGd1p+z0cF/aR7ArKbshVoypybd2a
	 N/h8Q4s+tLz8dRTOqcDBeDwpIul7K75mEnle4LlB50CSTBM8hOZ3HIVepJ8oND+AFGgtl
	 /V0eCptbl+UXNVgVj+BWGIY8aTnr9cph3OMmrEGv+cMdeQMl3VZ+H8KwuKxOyJgFmhJwF
	 RVXlWiy15imgazN6wKdMd6WnCucEcFnRvL5Bw7ZaF6hoPGlduboZfywvhS7PfZdZOXw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ouKJZqkG;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA5B4606A339;
	Sun, 29 Nov 2026 00:37:06 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 829141F00898;
	Sun, 29 Nov 2026 00:37:05 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795912626;
	bh=x35pdvpIA9xPL/BrGpyru+zb5ug0v6qGOudCOa6vB6Y=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=ouKJZqkGOuPUIqYJem5BZ8wgwZfSvPcvZAplmaJ8E1ZRKZj+FS4G4pPtUnoi/H3G2
	 l9n+Sl7y8i5+Fju7a8qi7e21diJOc4r7FTHIxwdySLRsgG1qGQGSa2qaIX/P46jhCX
	 e4x4tPsell5jc5a2u1/Q1b59o0AY4e4yYV561FKVN7ZE9FPq0ATMBGx6bgbp3H/SaH
	 IUSU9sNKu8Wdd56sfWuvApKyhs/TzJJ5gt4NaXptTWxBy1nMYu9GQ83iYjaEhpkGBv
	 +4IA7UuXeSzoydkwAYGxZyTeRfS3v2nMRbzdCAJtOGeQ9yQ9YOm6dENsNscJPiTbdN
	 WxjKXGJ3IIHLg==
X-Cc: intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com,
 przemyslaw.kitszel@intel.com, andrew+netdev@lunn.ch, davem@davemloft.net,
 edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 janislacis06@gmail.com, kurt@linutronix.de, joe@dama.to,
 netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org
X-In-Reply-To: <20261124235723.1135808-3-antonio@mandelbit.com>
X-sashiko-severity: Low
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