liburing icon indicating copy to clipboard operation
liburing copied to clipboard

Question regarding behavior of IORING_POLL_ADD_MULTI

Open man9ourah opened this issue 2 years ago • 2 comments

Hello,

my kernel version: 6.2.0-32-generic

is IORING_POLL_ADD_MULTI supposed to be edge-triggered or level-triggered? Right now I am using it and assuming that it is the former and expecting a cqe for when an event is set and then when it is cleared. For example, if I got a poll cqe with POLLIN event and handled it fully with read, will I get another poll cqe stating the new status of the event?

Just to share what I really want: I want my application to be up-to-date with the status of the event on a fd. Whenever it changes to either state, I want to receive a cqe with the new state. Is that possible?

Just adding references here to why I thought it is edge-triggered:

From: https://www.spinics.net/lists/io-uring/msg10211.html

IORING_POLL_ADD_MULTI is similar to epoll's edge-triggered mode,

Also the new (maybe still not yet active) IORING_POLL_ADD_LEVEL flag means currently it is edge?

Could you please help me understand? I think maybe I have things backward?

Thanks! Mansour.

man9ourah avatar Dec 13 '23 22:12 man9ourah

I tested it, and the effects are the same. io_uring_prep_poll_add == io_uring_prep_poll_multishot == epoll Level Triggered;

sxstd001 avatar Dec 14 '23 09:12 sxstd001

In short, they're rather level-triggered.

io_uring_prep_poll_add is purely level-triggered. Similarly, when you just queued a io_uring_prep_poll_multishot it's also level-triggered, i.e. if there's data/event/etc. at the time you submit the request it'll post a completion. However, for all subsequent completions of a multishot poll it kind of resembles the edge mode because it'll be posting completions only in reaction to new events/data arriving.

isilence avatar Jan 11 '24 13:01 isilence