Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: antonio@mandelbit.com
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
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	[thread overview]
Message-ID: <179591262508.3135.17271462745595226858@kernel.org> (raw)
In-Reply-To: <20261124235723.1135808-3-antonio@mandelbit.com>

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

  parent reply	other threads:[~2026-11-29  0:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 23:57 [PATCH net v5 0/6] igb: fix runtime PM resume issues Antonio Quartulli
2026-11-24 23:57 ` [PATCH net v5 1/6] igb: don't touch rings that don't exist when disabling an XSK pool Antonio Quartulli
2026-11-28 13:36   ` Janis Edvarts Lacis
2026-11-29  0:37   ` netdev-bot+sashiko
2026-11-24 23:57 ` [PATCH net v5 2/6] igb: fix RTNL assertion when resuming from runtime suspend Antonio Quartulli
2026-11-28 13:37   ` Janis Edvarts Lacis
2026-11-29  0:37   ` netdev-bot+sashiko [this message]
2026-11-24 23:57 ` [PATCH net v5 3/6] igb: keep the stack's Rx queues that still have an XSK pool Antonio Quartulli
2026-11-28 13:37   ` Janis Edvarts Lacis
2026-11-29  0:37   ` netdev-bot+sashiko
2026-11-24 23:57 ` [PATCH net v5 4/6] igb: link queues to NAPIs under RTNL after runtime resume Antonio Quartulli
2026-11-28 13:38   ` Janis Edvarts Lacis
2026-11-24 23:57 ` [PATCH net v5 5/6] igb: resume the device before changing XDP or XSK settings Antonio Quartulli
2026-11-28 13:38   ` Janis Edvarts Lacis
2026-11-29  0:37   ` netdev-bot+sashiko
2026-11-24 23:57 ` [PATCH net v5 6/6] igb: only allow runtime PM if the device can wake up Antonio Quartulli
2026-11-28 13:40   ` Janis Edvarts Lacis
2026-11-28 13:32 ` [PATCH net v5 0/6] igb: fix runtime PM resume issues Janis Edvarts Lacis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179591262508.3135.17271462745595226858@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=antonio@mandelbit.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=janislacis06@gmail.com \
    --cc=joe@dama.to \
    --cc=kuba@kernel.org \
    --cc=kurt@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox