From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 829141F00898; Sun, 29 Nov 2026 00:37:05 +0000 (UTC) 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== Subject: Re: [PATCH net v5 2/6] igb: fix RTNL assertion when resuming from runtime suspend 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 Date: Sun, 29 Nov 2026 00:37:05 +0000 Message-ID: <179591262508.3135.17271462745595226858@kernel.org> In-Reply-To: <20261124235723.1135808-3-antonio@mandelbit.com> References: <20261124235723.1135808-3-antonio@mandelbit.com> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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