Article View: linux.kernel.netdev
Article #21286Re: [PATCH net v4 1/4] igb: don't touch rings that don't exist when disabling an XSK pool
From: Antonio Quartulli
Date: Mon, 23 Nov 2026 20:28
Date: Mon, 23 Nov 2026 20:28
59 lines
12201 bytes
12201 bytes
On 21/11/2026 00:17, Janis Edvarts Lacis wrote:
> On 20 Nov 22:01, Antonio Quartulli wrote:
>> xsk_get_pool_from_qid() checks the queue id against the stack's real
>> queue counts, which can be higher than the number of rings the device
>> has: on 82576, enabling VFs leaves a single Tx queue while keeping two
>> Rx queues, and igb can fall back from MSI-X to MSI with a single queue
>> on resume. Disabling the pool of such a queue, e.g. one bound to queue 1
>> before enabling VFs, then passes a NULL Tx ring to
>> igb_txrx_ring_disable().
>>
>> Only disable and re-enable the rings the device has: skip the queue if
>> it has no Rx ring, and only the Tx part if it has no Tx ring, so that
>> an Rx ring using the pool still stops using it.
>>
>
> What happens if a pool is bound to, say, queue 1 and the socket stays
> open across a runtime resume that falls back from MSI-X to MSI (queue 1
> becomes invalid)?
>
> If the socket is closed after igb_rtnl_resume_task() has reduced both
> real queue counts to one, xsk_get_pool_from_qid() will return NULL for
> queue 1. As I read it, igb_xsk_pool_disable() then returns -EINVAL
> before doing the cleanup and resources get leaked.
>
> I may be mistaken here, if so, please let me know :)
Hi Janis,
actually you're not mistaken, thanks for spotting it.
Once the real Rx queue count is lowered below a queue with a bound XSK
pool, xsk_get_pool_from_qid() no longer finds the pool, the disable
fails ("Failed to disable zero-copy!") and the pool's DMA mappings are
never unmapped.
igb already does this today (it lowers the counts on runtime resume,
just without RTNL), and so does any shrink done by the driver itself
(e.g. SR-IOV reinit), so it's worth fixing here.
In v5 igb I will follow what ethtool does for channel changes: when the
driver lowers its queue counts, it keeps the real Rx count up to the
highest queue that still has an XSK pool, so the pool can still be
disabled and unmapped (the rings are skipped as they don't exist). The
Tx count follows the device, and the Rx count is lowered at the next
open.
This said, I will first wait for Sashiko to report any other potential
issue and then I'll work on v5.
Best regards,
--
Antonio Quartulli
CEO and Co-Founder
Mandelbit Srl
https://www.mandelbit.com
Technical Details
Message-ID:
<5b8c4005-ed10-4be5-b79b-8f59089d6fbf@mandelbit.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder2.feed.ams11.usenet.farm!feeder4.usenet.farm!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer04.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369744-linux-kernel-netdev=dewy.ruReferences:
<20261120210134.133238-1-antonio@mandelbit.com> <20261120210134.133238-2-antonio@mandelbit.com> <xupy6jbpnziq2qji54zjbvm7neggrwkxg3sfrhlolmrd6ysifl@zptk6ynkbu5f>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder2.feed.ams11.usenet.farm!feeder4.usenet.farm!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer04.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369744-linux-kernel-netdev=dewy.ru From: antonio@mandelbit.com (Antonio Quartulli) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v4 1/4] igb: don't touch rings that don't exist when disabling an XSK pool Date: Mon, 23 Nov 2026 21:28:47 +0100 Organization: Usenet Network Message-ID: <5b8c4005-ed10-4be5-b79b-8f59089d6fbf@mandelbit.com> References: <20261120210134.133238-1-antonio@mandelbit.com> <20261120210134.133238-2-antonio@mandelbit.com> <xupy6jbpnziq2qji54zjbvm7neggrwkxg3sfrhlolmrd6ysifl@zptk6ynkbu5f> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="3977009"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:fAt/r7Ig4VIEXkRwfZ7TF6N3+J0= sha256:WQzd8nZB/APUU1XV4vqqlHum0Ht01MukOGuj+CJXlxQ= sha1:D/00U6Eq1hZ6faBsCphm/zBljHs= sha256:kAXvIJaD9uqXkhl0uuyOfCqb6pbHBVSAUDHoB+9SmDU= Content-Language: en-US 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 54038125DC5; Mon, 23 Nov 2026 23:29:24 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.05 X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=mandelbit.com 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 WQP9W0CH5EZa; Mon, 23 Nov 2026 23:29:20 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-369744-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mandelbit.com X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 98819125DB9; Mon, 23 Nov 2026 23:29:11 +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 2B27D2D606; Mon, 23 Nov 2026 20:29:09 +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=1795465748; b=N2jIvG21nGU5prey5jwpZiS1oImFxBEXgj9DVZ8zToiaWLtD/FhAo8JF4b2Ee5kc9zL5 VkS4dd6+0aBBB7DpJh2eYQZvSjjXEyqpQMO+D0zfGVRsU3wi0wwZE4nAOqnCwYYvQgkbR Lffc/2UvGEeSszBDy9lXwCpWi+zthIOfXgB0SYnHTJxnCV48kc1wkH7rXofzUo+dLfM7e nUR8usZLb8Dl2PAJEiU/G7zKmnX167rm08afBypSzOrYGqP5PR/r0BsvhmRviibZEwkDk PFjwPbnm+QYibM4UshATNaQnRQ3CVMMCkfRnxRxuwXxcqzy/sHUruymOEQxjGoXn+BA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795465748; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature: Message-ID:Date:X-Mailing-List:List-Id:List-Post:List-Help: List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version: User-Agent:Subject:To:Cc:References:Content-Language:From: Organization:In-Reply-To:Content-Type:Content-Transfer-Encoding: X-Rspamd-Queue-Id; bh=XE7qcYgylreJp0JifMPhFDkqe26p/1tmu93DZNaIw5M=; b=Pqc4Za63L7URVgPDBaoQXSMxBju7ZvjX9xlxi0h6Gjz3YZsxvqRps5EXCMxON0liXypA iEUGZ7ymIxKG8PnM5cN3D/R8T8oGtL6qRrOl8QRc7TZSw0dVjgKrPMttEQ03y0nObu4Pc cKhXciFgHF88yowr+As4H4GFMFry1JDufhdGVVt3rUuefynazgsuVkhSgJ3rlVszgpr8x x371JSOzngx7suMgJeHMDDSMUUjSpB1GpWk30irPqpHZHd56eogvGEfAJNa+xEZH78Ssx Dnu9IHSyhesrFhi+OTFsF+A7l2ERKpJCinFxXgNtsreoZTOY//LNrmXoBpgoSA17cLg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=FKA0CLkf; dmarc=none header.from=mandelbit.com; spf=pass smtp.mailfrom=mandelbit.com; 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 A50CB606A331; Mon, 23 Nov 2026 20:29:08 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=FKA0CLkf X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.42 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795465742; b=IZynVSDfhFt0F8OrG0Y73q9O4/Q2P6knw91LlHqZJiGi7dKr5PK6OwSkUr7zgC3ydeeb s0FKm5Gk6JE7++0UgaTuASIFI3p98a9ZRo8M5w73uelVv9cWSlEqHdQx1XF0LltTdGIdB SHGiCQKkFqL+F2m3ZSqRtv6TuFVD1nYx9pywkXlV8iM7aPxDVHfadYqBhfXCL6rcnhLfb VnYOxO6P8EEJLRFK593oSUdncHRE++rOxXrtCVIVmCcsUnJZeOS+ijaWd+U02nJfnX1sT 6kHwh6Ty9mw4lCFjBNda5GUaowP9hubNyVSy20lX2XSG4vmCMKCfpFAtUFLrfY/fGrg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795465742; h=DMARC-Filter:Received:DKIM-Signature:Message-ID:Date:MIME-Version: User-Agent:Subject:To:Cc:References:Content-Language:From: Organization:In-Reply-To:Content-Type:Content-Transfer-Encoding: X-Rspamd-Queue-Id; bh=XE7qcYgylreJp0JifMPhFDkqe26p/1tmu93DZNaIw5M=; b=j7WoDSquhfgNbqNh4p2DbaawmQGMNMzruk8H45sCEUCYkivc/YWgRkXstF/qVTO2G4KC 8kqkSkLLteIKHu/s9tLqUQMlnhpewGvXh7MYHBSJFRqwK4v1n+wzEZrUddkkEC+4bECc4 KC5lTjyq8WV/HaE+AjrQ2Ay7DyyflxrBIDiV3Kgcn5uR9H/pySKIKPIYQN0KU+gSXr4dG /wsz+EvWhxbSPVEMRr5iIC2s+1OfbqaFfB/g9Z6Nz2j6Ld3BrBp2nGlRDxNykZ9yl4iG4 Ujlsnbd0MpS9bZWtKT8HTrkfKc8iTo7irIv9W9w8fLnyO6MYQ1cnLpE8SGPFLFiUUeg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=mandelbit.com; spf=pass smtp.mailfrom=mandelbit.com; dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=FKA0CLkf; arc=none smtp.remote-ip=195.10.208.42 X-Received: from mout-b-112.mailbox.org (mout-b-112.mailbox.org [195.10.208.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39540606A31E; Mon, 23 Nov 2026 20:29:00 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 39540606A31E X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mandelbit.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mandelbit.com X-Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-b-112.mailbox.org (Postfix) with ESMTPS id 4jYHb705X0z5vQ7; Mon, 23 Nov 2026 21:28:51 +0100 (CET) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1795465731; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XE7qcYgylreJp0JifMPhFDkqe26p/1tmu93DZNaIw5M=; b=FKA0CLkfyWAcxUq1oWz9e0gq1cOVbJ9lfQ/Gioeu6GSlMfc1GEm+LmsBniqVZaIzwp/sCl 1SipGsLM4pPbvE2iJxAWrCVc5kiEafYwA0LxsJZa/KkAUMNf6svm5E7qmecY5I1IhmgTn6 zthoe8ZvvqICZi9+l9yGb5Ls6Tux5Sahr7NCAzkc8PmNgDiP03onhJsImaxDBEd98Zfk9G dWASAhlejk/mpxZzCi17ObjmqylKZM9HXFAFqvfxHiDxho44PyUB8n2FnQc2USOLo3QAS8 l4Wm+iOolVvpdsaY1bl63sPHW9zNGnGLkDWT8IPZdTNe+zgNjNflp6sYPFOuXg== X-Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of antonio@mandelbit.com designates 2001:67c:2050:b231:465::1 as permitted sender) smtp.mailfrom=antonio@mandelbit.com 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 X-User-Agent: Mozilla Thunderbird X-Cc: intel-wired-lan@lists.osuosl.org, Tony Nguyen <anthony.l.nguyen@intel.com>, Przemek Kitszel <przemyslaw.kitszel@intel.com>, Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Jesper Dangaard Brouer <hawk@kernel.org>, John Fastabend <john.fastabend@gmail.com>, Stanislav Fomichev <sdf@fomichev.me>, Sriram Yagnaraman <sriram.yagnaraman@ericsson.com>, Kurt Kanzenbach <kurt@linutronix.de>, Maciej Fijalkowski <maciej.fijalkowski@intel.com>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, stable@vger.kernel.org X-Organization: Mandelbit SRL X-In-Reply-To: <xupy6jbpnziq2qji54zjbvm7neggrwkxg3sfrhlolmrd6ysifl@zptk6ynkbu5f> X-Rspamd-Queue-Id: 4jYHb705X0z5vQ7 X-Received-Bytes: 11891