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=1795912631; b=0poATm9/H41LiZ0MYcyvyPa6XBsaWMxHKIy1Mazy0yvIMUfV1JGAVrmcIETs5evkxlDJ xQy1zxXRbXNK3Q26l6He/8IsAo2y6NeSDVEIzabnIgb/l1xj1GaIt89AjDtl2Cb0Igsqu vGuGlZ/3kNypMzeg14SZRHjLkvApH9oyfKG6Vk9uLUu+UA8oAC7qwlasuZ40U5E391fIv sJWbWZypmqsbwSUOFNvE3MUkfH1dc0SpZHawwSjDAa6uxrCoVFEujm+VUSQSVR3g/tAJw YfeSd/h/tfuF9dT1WnjJJky6Fxj9l7Z0b+7foivfRD+BGCs4nierrNHhJoSlKFXHpWA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795912631; 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=qyoooVyAnBdbbdRk5fMNG62R8PvyoGw/4auZjNg0YGw=; b=UMtvVKJsSOI107ActBPlc3/I3uIZ94rltgxmu8w++kynJ+U+EmiogcTenc+seMzrryel sWZjJbiroZCDwokJ3gSZakM8W7zyuiXNNq72WOmCsSHdb6Bl7syDpF2kfX2vlilWNhXlc TfWaMPh1QUq0NZ6gq4P6CIhIVFKXU+/6Y3fwKBQExeDrJeTPJz0AUw485Hx10PDsJ6w7Y kpO2XUPKtdLBDx4qBi8tkLD30kQnFpqtD8BTurqXcqxo959NLI0Z0Tly7TDV01xtxjoUH 1dSQLz4qZc8uALeu8IiMK7QSdizbEl03vwbk+dBtQBdbhqsyFby1WBlGKxFc8CYDBQA== 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=RhA+iUmI; 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 676E6606A326; Sun, 29 Nov 2026 00:37:11 +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=RhA+iUmI Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0139E1F00896; Sun, 29 Nov 2026 00:37:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795912630; bh=qyoooVyAnBdbbdRk5fMNG62R8PvyoGw/4auZjNg0YGw=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=RhA+iUmIul1xFJomtpKy+F6eH5GAAlajgcVQN4bQkmG09XaRObpdf1sNDF66kRuXi 6O2eFZPsS+OYkwehTUZY/Oa6E8X0YI9XGNvVMELdWVzaM3NB3/XA/xWase+0WAKab7 /zPMMxN92zbz18Bc8jbTAkeCVmocvm9UC7AsNqzE93qONbj7M0uBODFo39pryLjuka qrijV/MTQQgA1SnwYKIYC17O29lXSXGxYbNaUsUzSXDHrT7Zs1y4FucYU3Zpt+WOlw lkaEuvpPuIarpm1XBGqvLFwjFXQbpncwvf8lM+3N4IZe8cq/s9h/MHyKBhFB/ZhhJy eltl/R+vNxBLA== Subject: Re: [PATCH net v5 5/6] igb: resume the device before changing XDP or XSK settings 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:09 +0000 Message-ID: <179591262958.3135.1982212772873974426@kernel.org> In-Reply-To: <20261124235723.1135808-6-antonio@mandelbit.com> References: <20261124235723.1135808-6-antonio@mandelbit.com> X-sashiko-severity: High Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@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 2 potential issue(s) to consider. Critical: 0 · High: 1 · Medium: 1 · Low: 0 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [High] In drivers/net/ethernet/intel/igb/igb_main.c, igb_xdp() calls pm_runtime_get_sync() at line 2950 and throws away the return value. - [Medium] igb_xdp() in drivers/net/ethernet/intel/igb/igb_main.c now calls pm_runtime_get_sync() (line 2950) while its callers hold RTNL. -- igb: resume the device before changing XDP or XSK settings This commit wraps igb_xdp() in pm_runtime_get_sync()/pm_runtime_put(), so XDP program and XSK pool changes run against a resumed device. The goal is to stop igb_xdp_setup() and igb_xsk_pool_setup() from seeing rings that don't exist yet, or NAPIs that aren't enabled yet, while __igb_resume() rebuilds them without RTNL. > diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c > index 25941a6e25b9f..83c88169840ab 100644 > --- a/drivers/net/ethernet/intel/igb/igb_main.c > +++ b/drivers/net/ethernet/intel/igb/igb_main.c > @@ -2942,16 +2942,28 @@ static int igb_xdp_setup(struct net_device *dev, struct netdev_bpf *bpf) > static int igb_xdp(struct net_device *dev, struct netdev_bpf *xdp) > { > struct igb_adapter *adapter = netdev_priv(dev); > + int err; > + > + /* The rings only exist while the device is resumed, and resuming > + * rebuilds them without RTNL > + */ > + pm_runtime_get_sync(&adapter->pdev->dev); [Severity: High] What happens here if the runtime resume fails? The return value of pm_runtime_get_sync() is thrown away. Nothing checks netif_device_present() before igb_xdp_setup() or igb_xsk_pool_setup() runs. Say __igb_open() fails during the resume, for example with -ENOMEM from igb_setup_all_rx_resources() or a failure in igb_request_irq(). By then __igb_resume() has already run igb_init_interrupt_scheme(), so the q_vectors exist and num_rx_queues > 0. But every error label in __igb_open() comes before this: drivers/net/ethernet/intel/igb/igb_main.c:__igb_open() { ... clear_bit(__IGB_DOWN, &adapter->state); for (i = 0; i < adapter->num_q_vectors; i++) { napi = &adapter->q_vector[i]->napi; napi_enable(napi); ... } So the NAPIs still have SCHED/NPSVC set from netif_napi_add(), and the descriptor memory has been freed. __igb_resume() also returns without calling netif_device_attach(). Closing a zero-copy AF_XDP socket would then go through: xp_release_deferred() rtnl_lock() xp_clear_dev() igb_xdp() pm_runtime_get_sync() <- resume fails, ignored igb_xsk_pool_setup(pool == NULL) igb_xsk_pool_disable() igb_txrx_ring_disable() napi_disable() The check in igb_xsk_pool_disable() still passes: if_running = netif_running(adapter->netdev) && igb_xdp_is_enabled(adapter) && qid < adapter->num_rx_queues; Wouldn't napi_disable() spin forever with RTNL held, since that NAPI was never enabled? Before that, igb_txrx_ring_disable() writes TXDCTL/RXDCTL on a MAC that was reset and handed back to firmware. If napi_disable() did return, igb_txrx_ring_enable() would refill rings whose descriptor memory was freed. For XDP_SETUP_PROG add/remove with the interface up, igb_close() does nothing on the non-present device. igb_open() then runs a full open on the device that failed to resume. The commit message says the device is resumed "as ethtool does". However, both __dev_ethtool() and ethnl_ops_begin() check the device after resuming: net/ethtool/netlink.c:ethnl_ops_begin() { ... if (dev->dev.parent) pm_runtime_get_sync(dev->dev.parent); if (!netif_device_present(dev) || dev->reg_state >= NETREG_UNREGISTERING) { ret = -ENODEV; ... } Should igb_xdp() check the same way? Returning an error on the pool teardown path may not be enough on its own. xp_disable_drv_zc() WARNs in that case, and the pool's DMA unmap would be skipped. The disable path may still need to do its software cleanup when the hardware isn't resumed. In this tree a failed resume doesn't set power.runtime_error, so each later pm_runtime_get_sync() retries the resume callback. The direct trigger is a failed resume inside igb_xdp()'s own pm_runtime_get_sync(). The last patch in the series ("igb: only allow runtime PM if the device can wake up") doesn't change igb_xdp(). [Severity: Medium] Can this deadlock with a runtime suspend that is already in progress? Every caller that reaches ndo_bpf here holds RTNL: dev_xdp_attach() xsk_bind() -> xp_assign_dev() xp_release_deferred() -> xp_clear_dev() The igb runtime suspend callback takes RTNL after the PM core has set the status to RPM_SUSPENDING: igb_runtime_suspend() __igb_shutdown() cancel_work_sync(&adapter->rtnl_resume_task); rtnl_lock(); While the status is RPM_SUSPENDING, rpm_resume() for a synchronous caller on a non-irq_safe device waits uninterruptibly on power.wait_queue. The pm_wq worker waits for RTNL, and the igb_xdp() caller holds RTNL while it waits for the suspend to finish. Lockdep won't report this. The commit message mentions this ("closing an AF_XDP socket or changing the XDP program is now one of them"). The same cycle already exists for ethtool ops and for igb_open()/igb_close(). Before this patch, igb made no runtime PM calls on two paths: AF_XDP zero-copy bind and teardown, and XDP program changes when the interface is down or the program is only swapped. Both paths can now reach this hang. The last patch in the series only limits when a suspend gets scheduled. It doesn't remove the rtnl_lock() from the suspend callback. Is there a way to avoid the synchronous resume under RTNL on these paths? > > switch (xdp->command) { > case XDP_SETUP_PROG: [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124235723.1135808-1-antonio%40mandelbit.com