From: Pavel Begunkov <asml.silence@gmail.com>
To: David Wei <dw@davidwei.uk>,
io-uring@vger.kernel.org, netdev@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>
Subject: Re: [PATCH v3 1/3] io_uring/rsrc: rename and export io_lock_two_rings()
Date: Tue, 28 Oct 2025 15:19:39 +0000 [thread overview]
Message-ID: <64101298-06d3-4db6-9156-42343dcbdfff@gmail.com> (raw)
In-Reply-To: <74cac804-27b5-4d25-9055-5e4b85be20d6@davidwei.uk>
On 10/28/25 14:54, David Wei wrote:
> On 2025-10-27 03:04, Pavel Begunkov wrote:
>> On 10/26/25 17:34, David Wei wrote:
>>> Rename lock_two_rings() to io_lock_two_rings() and export. This will be
>>> used when sharing a src ifq owned by one ring with another ring. During
>>> this process both rings need to be locked in a deterministic order,
>>> similar to the current user io_clone_buffers().
>>
>> unlock();
>> double_lock();
>>
>> It's quite a bad pattern just like any temporary unlocks in the
>> registration path, it gives a lot of space for exploitation.
>>
>> Ideally, it'd be
>>
>> lock(ctx1);
>> zcrx = grab_zcrx(ctx1, id); // with some refcounting inside
>> unlock(ctx1);
>>
>> lock(ctx2);
>> install(ctx2, zcrx);
>> unlock(ctx2);
>
> Thanks, I've refactored this to lock rings in sequence instead of both
> rings.
>
>>
>> And as discussed, we need to think about turning it into a temp
>> file, bc of sync, and it's also hard to send an io_uring fd.
>> Though, that'd need moving bits around to avoid refcounting
>> cycles.
>>
>
> My next version of this adds a refcount to ifq and decouple its lifetime
> from ring ctx as a first step. Could we defer turning ifq into a file as
> a follow up?
The mentioned sync problems is about using a ring bound to another
task. Decoupling of the zcrx object from io_uring instance should
do here as well. Please send out the next version since it sounds
you already have it prepared and we'll take it from there.
--
Pavel Begunkov
next prev parent reply other threads:[~2025-10-28 15:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-26 17:34 [PATCH v3 0/3] io_uring zcrx ifq sharing David Wei
2025-10-26 17:34 ` [PATCH v3 1/3] io_uring/rsrc: rename and export io_lock_two_rings() David Wei
2025-10-27 10:04 ` Pavel Begunkov
2025-10-28 14:54 ` David Wei
2025-10-28 15:19 ` Pavel Begunkov [this message]
2025-10-26 17:34 ` [PATCH v3 2/3] io_uring/zcrx: add refcount to struct io_zcrx_ifq David Wei
2025-10-26 17:34 ` [PATCH v3 3/3] io_uring/zcrx: share an ifq between rings David Wei
2025-10-27 10:20 ` Pavel Begunkov
2025-10-27 11:47 ` Pavel Begunkov
2025-10-27 15:10 ` David Wei
2025-10-28 14:55 ` David Wei
2025-10-28 15:22 ` 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=64101298-06d3-4db6-9156-42343dcbdfff@gmail.com \
--to=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=dw@davidwei.uk \
--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