From: Gabriel Krisman Bertazi <[email protected]>
To: Jens Axboe <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: [PATCH 5/6] io_uring: add support for futex wake and wait
Date: Mon, 12 Jun 2023 12:06:39 -0400 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]> (Jens Axboe's message of "Fri, 9 Jun 2023 12:31:24 -0600")
Jens Axboe <[email protected]> writes:
> Add support for FUTEX_WAKE/WAIT primitives.
This is great. I was so sure io_uring had this support already for some
reason. I might have dreamed it.
The semantics are tricky, though. You might want to CC peterZ and tglx
directly.
> IORING_OP_FUTEX_WAKE is mix of FUTEX_WAKE and FUTEX_WAKE_BITSET, as
> it does support passing in a bitset.
As far as I know, the _BITSET variant are not commonly used in the
current interface. I haven't seen any code that really benefits from
it.
> Similary, IORING_OP_FUTEX_WAIT is a mix of FUTEX_WAIT and
> FUTEX_WAIT_BITSET.
But it is definitely safe to have a single one, basically with the
_BITSET semantics.
> FUTEX_WAKE is straight forward, as we can always just do those inline.
> FUTEX_WAIT will queue the futex with an appropriate callback, and
> that callback will in turn post a CQE when it has triggered.
Even with an asynchronous model, it might make sense to halt execution
of further queued operations until futex completes. I think
IOSQE_IO_DRAIN is a barrier only against the submission part, so it
wouldn't hep. Is there a way to ensure this ordering?
I know, it goes against the asynchronous nature of io_uring, but I think
it might be a valid use case. Say we extend FUTEX_WAIT with a way to
acquire the futex in kernel space. Then, when the CQE returns, we know
the lock is acquired. if we can queue dependencies on that (stronger
than the link semantics), we could queue operations to be executed once
the lock is taken. Makes sense?
> Cancelations are supported, both from the application point-of-view,
> but also to be able to cancel pending waits if the ring exits before
> all events have occurred.
>
> This is just the barebones wait/wake support. Features to be added
> later:
One item high on my wishlist would be the futexv semantics (wait on any
of a set of futexes). It cannot be implemented by issuing several
FUTEX_WAIT.
--
Gabriel Krisman Bertazi
next prev parent reply other threads:[~2023-06-12 16:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-09 18:31 [PATCHSET RFC 0/6] Add io_uring support for futex wait/wake Jens Axboe
2023-06-09 18:31 ` [PATCH 1/6] futex: abstract out futex_op_to_flags() helper Jens Axboe
2023-06-09 18:31 ` [PATCH 2/6] futex: factor out the futex wake handling Jens Axboe
2023-06-09 18:31 ` [PATCH 3/6] futex: assign default futex_q->wait_data at insertion time Jens Axboe
2023-06-09 18:31 ` [PATCH 4/6] futex: add futex wait variant that takes a futex_q directly Jens Axboe
2023-06-09 18:31 ` [PATCH 5/6] io_uring: add support for futex wake and wait Jens Axboe
2023-06-12 16:06 ` Gabriel Krisman Bertazi [this message]
2023-06-12 20:37 ` Jens Axboe
2023-06-12 23:00 ` Gabriel Krisman Bertazi
2023-06-13 1:09 ` Jens Axboe
2023-06-13 2:55 ` io_uring link semantics (was [PATCH 5/6] io_uring: add support for futex wake and wait) Gabriel Krisman Bertazi
2023-06-23 19:04 ` [PATCH 5/6] io_uring: add support for futex wake and wait Andres Freund
2023-06-23 19:07 ` Jens Axboe
2023-06-23 19:34 ` Andres Freund
2023-06-23 19:46 ` Jens Axboe
2023-06-09 18:31 ` [PATCH 6/6] io_uring/futex: enable use of the allocation caches for futex_q 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 \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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