From: Jens Axboe <axboe@kernel.dk>
To: stable@vger.kernel.org
Cc: io-uring@vger.kernel.org, gregkh@linuxfoundation.org
Subject: [PATCH 6.18.y 13/14] io_uring/zcrx: cache fallback availability in zcrx ctx
Date: Sat, 5 Dec 2026 23:11:46 +0000 [thread overview]
Message-ID: <20261205231147.4095031-14-axboe@kernel.dk> (raw)
In-Reply-To: <20261205231147.4095031-1-axboe@kernel.dk>
From: Pavel Begunkov <asml.silence@gmail.com>
Commit 5c727ce042988df45232cfdb6599bb46116fd69c upstream.
Store a flag in struct io_zcrx_ifq telling if the backing memory is
normal page or dmabuf based. It was looking it up from the area, however
it logically allocates from the zcrx ctx and not a particular area, and
once we add more than one area it'll become a mess.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://patch.msgid.link/65e75408a7758fe7e60fae89b7a8d5ae4857f515.1774261953.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[axboe: 6.18 has no ZCRX_REG_NODEV or zcrx_register_netdev(), set
kern_readable before the netdev lookup in io_register_zcrx_ifq(), and
its io_zcrx_append_area() has no WARN_ON_ONCE() on ifq->area]
---
io_uring/zcrx.c | 9 ++++++++-
io_uring/zcrx.h | 1 +
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
index b725dab91732..385e6d793d17 100644
--- a/io_uring/zcrx.c
+++ b/io_uring/zcrx.c
@@ -409,8 +409,13 @@ static void io_zcrx_free_area(struct io_zcrx_area *area)
static int io_zcrx_append_area(struct io_zcrx_ifq *ifq,
struct io_zcrx_area *area)
{
+ bool kern_readable = !area->mem.is_dmabuf;
+
if (ifq->area)
return -EINVAL;
+ if (WARN_ON_ONCE(ifq->kern_readable != kern_readable))
+ return -EINVAL;
+
ifq->area = area;
return 0;
}
@@ -608,6 +613,8 @@ int io_register_zcrx_ifq(struct io_ring_ctx *ctx,
if (ret)
goto err;
+ ifq->kern_readable = !(area.flags & IORING_ZCRX_AREA_DMABUF);
+
ifq->netdev = netdev_get_by_index_lock(current->nsproxy->net_ns, reg.if_idx);
if (!ifq->netdev) {
ret = -ENODEV;
@@ -974,7 +981,7 @@ static struct net_iov *io_alloc_fallback_niov(struct io_zcrx_ifq *ifq)
struct io_zcrx_area *area = ifq->area;
struct net_iov *niov = NULL;
- if (area->mem.is_dmabuf)
+ if (!ifq->kern_readable)
return NULL;
scoped_guard(spinlock_bh, &area->freelist_lock) {
diff --git a/io_uring/zcrx.h b/io_uring/zcrx.h
index a48871b5adad..e1174fa957a2 100644
--- a/io_uring/zcrx.h
+++ b/io_uring/zcrx.h
@@ -42,6 +42,7 @@ struct io_zcrx_ifq {
struct io_ring_ctx *ctx;
struct io_zcrx_area *area;
unsigned niov_shift;
+ bool kern_readable;
spinlock_t rq_lock ____cacheline_aligned_in_smp;
struct io_uring *rq_ring;
--
2.55.0
next prev parent reply other threads:[~2026-12-05 23:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-05 23:11 [PATCH 6.18.y 00/14] io_uring fixes for 6.18-stable Jens Axboe
2026-12-05 23:11 ` [PATCH 6.18.y 01/14] io_uring/net: don't charge the folio offset to truesize for managed frags Jens Axboe
2026-12-05 23:11 ` [PATCH 6.18.y 02/14] io_uring/net: don't copy msg_name on a recvmsg retry Jens Axboe
2026-12-05 23:11 ` [PATCH 6.18.y 03/14] io_uring/kbuf: clear REQ_F_BL_NO_RECYCLE on buffer put Jens Axboe
2026-12-05 23:11 ` [PATCH 6.18.y 04/14] io_uring/tctx: add separate lock for list of tctx's in ctx Jens Axboe
2026-12-05 23:11 ` [PATCH 6.18.y 05/14] io_uring: free the task context after a grace period Jens Axboe
2026-12-05 23:11 ` [PATCH 6.18.y 06/14] io_uring: free the ring " Jens Axboe
2026-12-05 23:11 ` [PATCH 6.18.y 07/14] io_uring/filetable: don't install O_PATH files Jens Axboe
2026-12-05 23:11 ` [PATCH 6.18.y 08/14] io_uring/cancel: always walk links under timeout_lock Jens Axboe
2026-12-05 23:11 ` [PATCH 6.18.y 09/14] io_uring/net: don't count the buffers of a send bundle Jens Axboe
2026-12-05 23:11 ` [PATCH 6.18.y 10/14] io_uring/net: restore the cmsg buffer on recvmsg retry Jens Axboe
2026-12-05 23:11 ` [PATCH 6.18.y 11/14] io_uring: close poll activation race when enabling rings Jens Axboe
2026-12-05 23:11 ` [PATCH 6.18.y 12/14] io_uring/cancel: arm local work wakeups only for submitter Jens Axboe
2026-12-05 23:11 ` Jens Axboe [this message]
2026-12-05 23:11 ` [PATCH 6.18.y 14/14] io_uring/zcrx: don't sync dma-bufs Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261205231147.4095031-14-axboe@kernel.dk \
--to=axboe@kernel.dk \
--cc=gregkh@linuxfoundation.org \
--cc=io-uring@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox