Article View: linux.kernel.netdev
Article #24028Re: [PATCH net v5 5/6] igb: resume the device before changing XDP or XSK settings
From: netdev-bot+sashiko
Date: Sun, 29 Nov 2026 00:37
Date: Sun, 29 Nov 2026 00:37
162 lines
14198 bytes
14198 bytes
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
Technical Details
Message-ID:
<179591262958.3135.1982212772873974426@kernel.org>Path:
mbox-mo1.pugleaf.net!news-can.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373323-linux-kernel-netdev=dewy.ruReferences:
<20261124235723.1135808-6-antonio@mandelbit.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373323-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v5 5/6] igb: resume the device before changing XDP or XSK settings Date: Sun, 29 Nov 2026 00:37:09 +0000 Organization: Usenet Network Message-ID: <179591262958.3135.1982212772873974426@kernel.org> References: <20261124235723.1135808-6-antonio@mandelbit.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1069417"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Wo5vZq/Tee17mtcbeu6Ju6ePBSo= sha256:p7yIDtv8anTsyc2OMuv1cb17Eu0RKaiifL7+R9roB/o= sha1:Rm/WSk/ju+EKqNPYWjc+uWbEK7A= sha256:cWkfsmHhHCKH0ek//uvZtfWSZQsoB6+Fm1VYqUKOhb8= 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 1090C125F88; Sun, 29 Nov 2026 03:37:40 +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 RpEhbjpMDcIm; Sun, 29 Nov 2026 03:37:36 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-373323-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 49521125F8A; Sun, 29 Nov 2026 03:37:28 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 64748279A3; Sun, 29 Nov 2026 00:37:13 +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=HymN2EJQjhwxT7E9fPoppInRlv/mAecGBSTRN0InhIIjpr7gUSsbwA+538XKmhjaoVRG p+ytwPBsLeKaIsCdpohA1TNPWIYAtPdS84JjTMjprdp+9PRlS73fAXMLT/xKRCtDmNILf U5zfsuY7IKdS12m9J4guP0v0WV8GUedvWF4db/+ak9jLGUXZvhxHFLTah7kvFDDKWvF8f k7EUDewQ3RnqVzqo61bMvy6Ycx7QumdbOUCYqJP9p5h+C8MsZRaf0IqBE+PTYQTTUQYfa A2W2+mBe88nccgl77H5kjxZzQHBg9KXPJqrljQdTVPnzopdiKVOixFKLuZ5+yXrLgbQ== 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=qyoooVyAnBdbbdRk5fMNG62R8PvyoGw/4auZjNg0YGw=; b=FWqI9626ashHMMi9I+u+UflWaMOHi7BbCGdl4w8hyEZ3ivmlw5Ck+uMJYYeZ0yTtbWv4 KGiOQM7j1B8du2HI9rsVYJkxX7dEzFTEstA0LdguKKIBcGou7tYX/LjZcwFrCQC0mUlL4 BIZUWpbO15xKEmAO8vCOCsXntKcIRgT4Mfjf2Q4HgWslez2QvhKSakLS5UFyCGnGm3aHI dNwIfa1lEXfmvCjFcP+3UNLbjU49mOZ1Gkq2+ptg9qu/7KLApSs14lj+RpYeFdkCRYKq7 p46XlNQ3f8dBJgPNwgKaHS9+OwAnHRhX9cto3+pOqqfx72/Lf2L0tXSjVn7XGt+SHWw== 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=RhA+iUmI; 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 478A7606A6B1; 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=RhA+iUmI 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=1795912631; b=0poATm9/H41LiZ0MYcyvyPa6XBsaWMxHKIy1Mazy0yvIMUfV1JGAVrmcIETs5evkxlDJ xQy1zxXRbXNK3Q26l6He/8IsAo2y6NeSDVEIzabnIgb/l1xj1GaIt89AjDtl2Cb0Igsqu vGuGlZ/3kNypMzeg14SZRHjLkvApH9oyfKG6Vk9uLUu+UA8oAC7qwlasuZ40U5E391fIv sJWbWZypmqsbwSUOFNvE3MUkfH1dc0SpZHawwSjDAa6uxrCoVFEujm+VUSQSVR3g/tAJw YfeSd/h/tfuF9dT1WnjJJky6Fxj9l7Z0b+7foivfRD+BGCs4nierrNHhJoSlKFXHpWA== X-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== 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=RhA+iUmI; 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 676E6606A326; Sun, 29 Nov 2026 00:37:11 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0139E1F00896; Sun, 29 Nov 2026 00:37:09 +0000 (UTC) X-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== 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-6-antonio@mandelbit.com> X-sashiko-severity: High 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