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 > >