Article View: linux.kernel.netdev
Article #10396Re: [PATCH net 9/9] idpf: free stashed XSk Rx frame when releasing the queue
From: netdev-bot+sashiko
Date: Tue, 03 Nov 2026 13:32
Date: Tue, 03 Nov 2026 13:32
141 lines
12619 bytes
12619 bytes
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] During a live XSk pool disable (idpf_xsk_pool_setup β
idpf_qp_switch(false) β idpf_qp_disable β idpf_clean_queue_set), theβ¦
Pre-existing issues:
- [High] The patch now returns the stashed partial frame (rxq->xsk) to
the XSk pool on queue release.
--
idpf: free stashed XSk Rx frame when releasing the queue
This commit frees the partial multi-buffer XSk frame stashed in rxq->xsk
and clears the pointer in idpf_xsk_clear_queue(), while the pool is still
attached. This keeps the buffers from being lost on ifdown, and keeps the
page path from reusing a stale xskb after the pool is disabled.
> diff --git a/drivers/net/ethernet/intel/idpf/xsk.c b/drivers/net/ethernet/intel/idpf/xsk.c
> index d95d3efdfd36f..5a0a1d8a7a866 100644
> --- a/drivers/net/ethernet/intel/idpf/xsk.c
> +++ b/drivers/net/ethernet/intel/idpf/xsk.c
> @@ -134,6 +134,11 @@ void idpf_xsk_clear_queue(void *q, enum virtchnl2_queue_type type)
> if (!idpf_queue_has_clear(XSK, rxq))
> return;
>
> + if (rxq->xsk) {
> + libeth_xsk_buff_free_slow(rxq->xsk);
[Severity: Low]
Can this free race with the XSk SQ cleanup timer when the pool is disabled
on a running interface?
On the pool disable path:
idpf_xsk_pool_setup()
idpf_qp_switch(false)
idpf_qp_disable()
idpf_clean_queue_set()
idpf_vector_to_queue_set() places the RX queues before the xsksq TX and
COMPLQ entries. So this code runs before the timer is cancelled. The only
synchronous cancel happens later, in idpf_tx_desc_rel():
if (xdp)
libeth_xdpsq_deinit_timer(txq->timer);
The timer runs as BH work on system_bh_highpri_wq and can return XSk
buffers to the same pool:
idpf_xsk_tx_timer()
libeth_xdpsq_run_timer()
idpf_xsksq_complete()
idpf_xsksq_complete_slow()
libeth_xdp_complete_tx()
libeth_xsk_buff_free_slow()
xp_free()
The timer holds only the xdpsq lock, and the Rx release path here does not
take it. xp_free() updates the pool without any locking:
xskb->pool->free_list_cnt++;
list_add(&xskb->list_node, &xskb->pool->free_list);
Suppose the timer is still inside idpf_xsksq_complete_slow() when
idpf_rx_desc_rel() gets here. Could both contexts then call list_add() on
pool->free_list at the same time?
The window looks narrow, since the SW marker wait drains the completion
queue first. Also, the pool is being destroyed or detached at that point.
Would it avoid this to free the stash after the xsksq timer is cancelled,
or after the Tx queues in the set are cleaned?
> + rxq->xsk = NULL;
> + }
> +
> rxq->pool = NULL;
> break;
> case VIRTCHNL2_QUEUE_TYPE_RX_BUFFER:
[Severity: High]
This isn't a bug introduced by this patch. However, the buffers still
posted on the buffer queue seem to have the same problem as the stash
fixed here. Are the xskbs in bufq->xsk_buf[] between next_to_clean and
next_to_use ever returned to the pool?
The RX_BUFFER case only clears bufq->pool. The XSK branch of
idpf_rx_buf_rel_bufq() returns early:
if (idpf_queue_has(XSK, bufq)) {
idpf_xskfq_rel(bufq);
return;
}
idpf_xskfq_rel() only calls libeth_xskfq_destroy(), which resets some
counters and then does:
kvfree(fq->fqes);
xsk_buff_free() is never called on the buffers that libeth_xskfqe_alloc()
got from xsk_buff_alloc_batch().
For comparison, ice_xsk_clean_rx_ring() frees the stash and also every
posted buffer:
if (rx_ring->xsk) {
xsk_buff_free(&rx_ring->xsk->base);
rx_ring->xsk = NULL;
}
while (ntc != ntu) { ... xsk_buff_free(xdp); ... }
With an AF_XDP zero-copy socket bound, wouldn't every ifdown/ifup or soft
reset (ring resize, MTU change and so on) leak up to desc_count umem frames
per buffer queue through this path?
idpf_vport_stop()
idpf_vport_queues_rel()
idpf_rx_desc_rel_all()
idpf_rx_desc_rel_bufq()
idpf_rx_buf_rel_bufq()
idpf_xskfq_rel()
libeth_xskfq_destroy()
The fill ring consumer has already moved past these frames. So they never
reach the Rx ring or pool->free_list. After a few resets the application
could run out of frames to post, and Rx on that queue would stop. In
unaligned mode the leaked heads also reduce pool->free_heads_cnt.
These are the same buffers "lost to user space" that the commit message
describes. Should they be released along with the stash, as
ice_xsk_clean_rx_ring() does?
--
Sashiko AI review Β· https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261102124950.958345-1-maciej.fijalkowski%40intel.com
Technical Details
Message-ID:
<179371275474.488856.9671318055273428947@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-355646-linux-kernel-netdev=dewy.ruReferences:
<20261102124950.958345-10-maciej.fijalkowski@intel.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-355646-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 9/9] idpf: free stashed XSk Rx frame when releasing the queue Date: Tue, 03 Nov 2026 13:32:34 +0000 Organization: Usenet Network Message-ID: <179371275474.488856.9671318055273428947@kernel.org> References: <20261102124950.958345-10-maciej.fijalkowski@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3179131"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:iffTc4u7vmYajzDtgoSYss8qpMc= sha256:MQ0lgJxy3Zz9ud2xVBln6ewf+40NpLl8UctZQiTUqos= sha1:tbDJ0PzJ7iJXucayxEKQknkjuz8= sha256:hOI+BY98GAQMnQZhNXWT1lXGkbDcsoCXpb/SwOgh33w= 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 721E41128BD; Tue, 3 Nov 2026 16:52:47 +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 h6FTSIzCAlxM; Tue, 3 Nov 2026 16:52:43 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-355646-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id E21D51128B0; Tue, 3 Nov 2026 16:52:34 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 22BFC3EBF3; Tue, 3 Nov 2026 13:32:59 +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=1793712757; b=TPEOOu0BqjUt7B613/ae0TuR32W2RPWrr7ZFHhXC1LKIVeyxe5whL7muIEuTUvXAvs0c vOWgh9TyclvuhO5Roq+0LxdDzLRBuYJmbOS3SoC0JjKkWVz5Ecc0yEx5atvf4juHIvWUm 7lyNWKeTKIWAJXR3Yc7dmP7ZvNgxIkhYOL1PS2y2g+ga2J0RO540IabPkyYdtV/xXekq0 FJC5CzOtjPPVZvzZaPLj6+nelsQv52fUNCfrrFAI4i5i3LQ1fC8XFHjIQ0OPSGO0rwDJ/ 6U6tab0gds4l5VB3ITpiKaDcmi9s1Ez+xmW7eSRT33rz0nqoKL/aXaoew0f88/+MrLQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793712757; 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=s7kzM1NgivgKy75ap7CyzzAw7v9/fdnoZtZt8pUG678=; b=KEDpci5QyLLxFPMiCBwHeZfFi7i/XmPDKIT+jbd8Rxsu21K72RmfwA0tG8Ja/wuDSajt bKk4b7IRtrDWdHBhFqaFzNhP2dbc61DTP6LZrS0x4VzwGkTDxvUX7MVcdT8oJ10ka7och craPYUQLNN86leGLiCp18WJ2r7GnkEk98Q0AOPeyS6IdhtmjbZasuaUQmAkkjaKmtBIkV 37rrQXPCUAl2fQxuqCupZF6QT57V/3VU6fcFGlDPVer/VISXVSpJI+0sWzgvps7v0Mem2 bJEYL5P7+mUESuEGqlr0Bwo9PvOzEp24hwtGidHaY7aw0otYcfYmlnaH1fZPn6G+8+g== 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=igQdz32+; 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 01D07606D82F; Tue, 3 Nov 2026 13:32:37 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=igQdz32+ 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=1793712756; b=Cm6IO4c00qu/cHPs+L9+SFW2JJeGPGu+XrqfqJSy7jFkq49Am1/J1Cq5BWx/igMVdMVZ aUmVeDr5FTcZxUD/SafZ/9wnPLwpCBUZaNk/NR3vVPJf0ihqxstUK7MbfQBvSNDhBl9P7 t5x8a1Z5XNZtji46cm3+YKOkkHXHigQNik4LG4sd9f9tKbN6KOjR36G+f+1aULbzsPZh2 bPgf4Esbr0W7nkE5Bafr1n/luLU33xv9AMnFvEnAfqyV2WvGgtjQmDynEg9KLEiVZgoRd akskg8l4vi3XQOsAMoND8gmwA7pmnTF2kqNOHIchPj/FDWkBsGonPxeyV5UbGDJDv0A== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793712756; 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=s7kzM1NgivgKy75ap7CyzzAw7v9/fdnoZtZt8pUG678=; b=whKT0p71AZq5jNmWY881+oKYuE9X9YXVPA9L25KvNmphp5gpmBfVSCMrvTcm3F8ar2Pu c9IMwCQsecm5Xsp131Dpq066n+2GxKiuCe+dUwle+b6y6vY5RxA0w8/n9gmf5Ozm6exTz CZFgDLn1Km4f/jtYiIF/4NKUuz94fB/M4QWlRq/0IpK1RNkMm+hZsysrceseL/vKiZwCI QRSq9sMHAAdfN3ytRt+AaJ+QJrlI0AxRidKYcpxCLx4TjWlhJ/cPsC/UAAspYLcGqVIfH AwPmEWhfLVMgXq6C6ivFK712fLF5WlgHhZo/NF5Tjc6ussCuAQnB5+n20YQDTj8N83g== 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=igQdz32+; 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 D703C606D816 for <netdev@vger.kernel.org>; Tue, 3 Nov 2026 13:32:35 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F4C51F00A1A; Tue, 3 Nov 2026 13:32:35 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793712755; bh=s7kzM1NgivgKy75ap7CyzzAw7v9/fdnoZtZt8pUG678=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=igQdz32+z5XiC+IDOqy+jfooxGH15ocFVyoFupURCYYQ0AkICj/X+dJsFrldaOs4u HFM5WSR24cMjY1G+gRYWtWYIyT8t7B+jpo56ci7F2bNN1a4gC7cfQ64eXrhscijp4J tRqn/AwUd4FJUfJo/UZbF5ouKoTqQgEt1z03NTunUS3EGEbl45KaEMOOCzbmMHjTgy 4OcX6PN3A09cwgIvZ2oMg0zzCCq6Q5zfQd0qbk/Pf9d+kHjQy3efdBHXfq0wv9rI/G XCA3VceWHSMokufCq18Qpok8b5NkAYyfaXhE0yQKjsZq5rAb0dGRHigE3DTCYaP2tM uVwpvwF1vbDxQ== X-Cc: netdev@vger.kernel.org, magnus.karlsson@intel.com, stfomichev@gmail.com, kuba@kernel.org, pabeni@redhat.com, tushar.vyavahare@intel.com, kerneljasonxing@gmail.com, bjorn@kernel.org, zuomao338@gmail.com X-In-Reply-To: <20261102124950.958345-10-maciej.fijalkowski@intel.com> X-sashiko-severity: Low 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