From: Pavel Begunkov <asml.silence@gmail.com>
To: netdev@vger.kernel.org
Cc: "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Jamal Hadi Salim <jhs@mojatatu.com>,
io-uring@vger.kernel.org, asml.silence@gmail.com
Subject: [RFC 07/10] io_uring/rsrc: add uncloneable regbuf flag
Date: Sat, 11 Jul 2026 11:48:36 +0100 [thread overview]
Message-ID: <23e6c268dd474997765caebf90ec9bb39f481917.1783614400.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1783614400.git.asml.silence@gmail.com>
It's hard to implement cloning if the internal structure needs to be
mutable and/or relies on other ring resources. In preparation to such
buffer types, add a flag indicating that the buffer can't be cloned. It
might be possible to add cloning in the future for them, but that would
likely need reallocating the structure and reacquiring resources in case
by case manner.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
io_uring/rsrc.c | 5 +++++
io_uring/rsrc.h | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c
index 24fc3232a66a..d57e8a0380b5 100644
--- a/io_uring/rsrc.c
+++ b/io_uring/rsrc.c
@@ -1381,6 +1381,11 @@ static int io_clone_buffers(struct io_ring_ctx *ctx, struct io_ring_ctx *src_ctx
if (!src_node) {
dst_node = NULL;
} else {
+ if (src_node->buf->flags & IO_REGBUF_F_UNCLONEABLE) {
+ io_rsrc_data_free(ctx, &data);
+ return -ENOMEM;
+ }
+
dst_node = io_rsrc_node_alloc(ctx, IORING_RSRC_BUFFER);
if (!dst_node) {
io_rsrc_data_free(ctx, &data);
diff --git a/io_uring/rsrc.h b/io_uring/rsrc.h
index 98ae8ef51009..83aa86e6f320 100644
--- a/io_uring/rsrc.h
+++ b/io_uring/rsrc.h
@@ -29,7 +29,8 @@ enum {
};
enum {
- IO_REGBUF_F_KBUF = 1,
+ IO_REGBUF_F_KBUF = 1 << 0,
+ IO_REGBUF_F_UNCLONEABLE = 1 << 1,
};
struct io_mapped_ubuf {
--
2.54.0
next prev parent reply other threads:[~2026-07-11 10:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-11 10:48 [RFC 00/10] io_uring: prototype for device memory tx Pavel Begunkov
2026-07-11 10:48 ` [RFC 01/10] net: pass ubuf to custom sg_from_iter callbacks Pavel Begunkov
2026-07-11 10:48 ` [RFC 02/10] net: reject zcrx skbs to not registered devices Pavel Begunkov
2026-07-11 10:48 ` [RFC 03/10] io_uring/zcrx: switch to pcpu refcounting Pavel Begunkov
2026-07-11 10:48 ` [RFC 04/10] io_uring/zcrx: prepare areas to be exported for tx Pavel Begunkov
2026-07-11 10:48 ` [RFC 05/10] io_uring/rsrc: introduce buf registration structure Pavel Begunkov
2026-07-11 10:48 ` [RFC 06/10] io_uring/rsrc: extend buffer update Pavel Begunkov
2026-07-11 10:48 ` Pavel Begunkov [this message]
2026-07-11 10:48 ` [RFC 08/10] io_uring/rsrc: add regbuf import flags Pavel Begunkov
2026-07-11 10:48 ` [RFC 09/10] io_uring/rsrc: add zcrx backed registered buffers Pavel Begunkov
2026-07-11 10:48 ` [RFC 10/10] io_uring/net: implement device memory send Pavel Begunkov
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=23e6c268dd474997765caebf90ec9bb39f481917.1783614400.git.asml.silence@gmail.com \
--to=asml.silence@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=io-uring@vger.kernel.org \
--cc=jhs@mojatatu.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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