From: Pavel Begunkov <asml.silence@gmail.com>
To: io-uring@vger.kernel.org
Cc: asml.silence@gmail.com, axboe@kernel.dk, netdev@vger.kernel.org
Subject: [PATCH io_uring-7.1 14/16] io_uring/zcrx: cache fallback availability in zcrx ctx
Date: Mon, 23 Mar 2026 12:44:03 +0000 [thread overview]
Message-ID: <65e75408a7758fe7e60fae89b7a8d5ae4857f515.1774261953.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1774261953.git.asml.silence@gmail.com>
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>
---
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 265b3a744ac2..d6475f95b815 100644
--- a/io_uring/zcrx.c
+++ b/io_uring/zcrx.c
@@ -423,8 +423,13 @@ static void io_zcrx_free_area(struct io_zcrx_ifq *ifq,
static int io_zcrx_append_area(struct io_zcrx_ifq *ifq,
struct io_zcrx_area *area)
{
+ bool kern_readable = !area->mem.is_dmabuf;
+
if (WARN_ON_ONCE(ifq->area))
return -EINVAL;
+ if (WARN_ON_ONCE(ifq->kern_readable != kern_readable))
+ return -EINVAL;
+
ifq->area = area;
return 0;
}
@@ -882,6 +887,8 @@ int io_register_zcrx_ifq(struct io_ring_ctx *ctx,
if (ret)
goto err;
+ ifq->kern_readable = !(area.flags & IORING_ZCRX_AREA_DMABUF);
+
if (!(reg.flags & ZCRX_REG_NODEV)) {
ret = zcrx_register_netdev(ifq, ®, &area);
if (ret)
@@ -1296,7 +1303,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 893cd3708a06..3e07238a4eb0 100644
--- a/io_uring/zcrx.h
+++ b/io_uring/zcrx.h
@@ -54,6 +54,7 @@ struct io_zcrx_ifq {
unsigned niov_shift;
struct user_struct *user;
struct mm_struct *mm_account;
+ bool kern_readable;
struct zcrx_rq rq ____cacheline_aligned_in_smp;
--
2.53.0
next prev parent reply other threads:[~2026-03-23 12:44 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 12:43 [PATCH io_uring-7.1 00/16] zcrx update for-7.1 Pavel Begunkov
2026-03-23 12:43 ` [PATCH io_uring-7.1 01/16] io_uring/zcrx: return back two step unregistration Pavel Begunkov
2026-03-23 15:01 ` Jens Axboe
2026-03-23 16:14 ` Pavel Begunkov
2026-03-23 16:44 ` Jens Axboe
2026-03-23 12:43 ` [PATCH io_uring-7.1 02/16] io_uring/zcrx: fully clean area on error in io_import_umem() Pavel Begunkov
2026-03-23 12:43 ` [PATCH io_uring-7.1 03/16] io_uring/zcrx: always dma map in advance Pavel Begunkov
2026-03-23 12:43 ` [PATCH io_uring-7.1 04/16] io_uring/zcrx: extract netdev+area init into a helper Pavel Begunkov
2026-03-23 12:43 ` [PATCH io_uring-7.1 05/16] io_uring/zcrx: implement device-less mode for zcrx Pavel Begunkov
2026-03-23 12:43 ` [PATCH io_uring-7.1 06/16] io_uring/zcrx: use better name for RQ region Pavel Begunkov
2026-03-23 12:43 ` [PATCH io_uring-7.1 07/16] io_uring/zcrx: add a struct for refill queue Pavel Begunkov
2026-03-23 12:43 ` [PATCH io_uring-7.1 08/16] io_uring/zcrx: use guards for locking Pavel Begunkov
2026-03-23 12:43 ` [PATCH io_uring-7.1 09/16] io_uring/zcrx: move count check into zcrx_get_free_niov Pavel Begunkov
2026-03-23 12:43 ` [PATCH io_uring-7.1 10/16] io_uring/zcrx: warn on alloc with non-empty pp cache Pavel Begunkov
2026-03-23 12:44 ` [PATCH io_uring-7.1 11/16] io_uring/zcrx: netmem array as refiling format Pavel Begunkov
2026-03-23 12:44 ` [PATCH io_uring-7.1 12/16] io_uring/zcrx: consolidate dma syncing Pavel Begunkov
2026-03-23 12:44 ` [PATCH io_uring-7.1 13/16] io_uring/zcrx: warn on a repeated area append Pavel Begunkov
2026-03-23 12:44 ` Pavel Begunkov [this message]
2026-03-23 12:44 ` [PATCH io_uring-7.1 15/16] io_uring/zcrx: check ctrl op payload struct sizes Pavel Begunkov
2026-03-23 12:44 ` [PATCH io_uring-7.1 16/16] io_uring/zcrx: rename zcrx [un]register functions Pavel Begunkov
2026-03-23 22:32 ` [PATCH io_uring-7.1 00/16] zcrx update for-7.1 Jakub Kicinski
2026-03-23 22:34 ` 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=65e75408a7758fe7e60fae89b7a8d5ae4857f515.1774261953.git.asml.silence@gmail.com \
--to=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
--cc=netdev@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