From: Olivier Langlois <[email protected]>
To: io-uring <[email protected]>
Subject: Re: IORING_OP_POLL_ADD/IORING_OP_POLL_REMOVE questions
Date: Wed, 05 May 2021 13:20:11 -0400 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
On Tue, 2021-05-04 at 14:06 -0400, Olivier Langlois wrote:
>
> 1. 195 is the cqe result for a successful IORING_OP_POLL_ADD
> submission. I only check the POLLIN|POLLOUT bits. What is the meaning
> of the other bits?
I did answer myself for question #1:
fs/io_uring.c:
static void io_poll_complete(struct io_kiocb *req, __poll_t mask, int
error)
{
struct io_ring_ctx *ctx = req->ctx;
io_poll_remove_double(req);
req->poll.done = true;
io_cqring_fill_event(req, error ? error : mangle_poll(mask));
io_commit_cqring(ctx);
}
include/linux/poll.h:
#define __MAP(v, from, to) \
(from < to ? (v & from) * (to/from) : (v & from) / (from/to))
static inline __u16 mangle_poll(__poll_t val)
{
__u16 v = (__force __u16)val;
#define M(X) __MAP(v, (__force __u16)EPOLL##X, POLL##X)
return M(IN) | M(OUT) | M(PRI) | M(ERR) | M(NVAL) |
M(RDNORM) | M(RDBAND) | M(WRNORM) | M(WRBAND) |
M(HUP) | M(RDHUP) | M(MSG);
#undef M
}
=195
=0xC3
=1100 0011
// from bits/poll.h:
=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND
The fd for which I get this result is a TCP socket on which the
WebSocket protocol over SSL is implemented.
Does anyone knows if WebSocket and/or TLS/SSL protocols are using TCP
out-of-band?
AFAIK (but I don't much), they don't...
Or maybe Linux poll implementation simply turns on these bits all the
time...
Bottomline, it is unrelated with io_uring but help for my 2 other
questions is still welcomed.
Greetings,
>
> 2. I don't understand what I am looking at. Why am I receiving a
> completion notification for a POLL request that has just been
> cancelled? What is the logic behind silently discarding a
> IORING_OP_POLL_ADD sqe meant to replace an existing one?
>
> 3. As I am writing this email, I have just noticed that it was possible
> to update an existing POLL entry with IORING_OP_POLL_REMOVE through
> io_uring_prep_poll_update(). Is this what I should do to eliminate my
> problems? What are the possible race conditions scenarios that I should
> be prepared to handle by using io_uring_prep_poll_update() (ie:
> completion of the poll entry to update while my process is inside
> io_uring_enter() to update it...)?
>
> thx a lot for your guidance in my io_uring journey!
> Olivier
>
>
next prev parent reply other threads:[~2021-05-05 17:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-04 18:06 IORING_OP_POLL_ADD/IORING_OP_POLL_REMOVE questions Olivier Langlois
2021-05-05 17:20 ` Olivier Langlois [this message]
2021-05-05 17:56 ` Pavel Begunkov
2021-05-06 3:17 ` Olivier Langlois
2021-05-06 8:42 ` Olivier Langlois
2021-05-06 15:46 ` Olivier Langlois
2021-05-06 16:59 ` Pavel Begunkov
2021-05-06 19:32 ` Olivier Langlois
2021-05-06 17:09 ` 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=be598e94e5acee2fd7d2dfff7fb31302de8c8525.camel@trillion01.com \
[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