Skip to contentSkip to conversation

Confusion regarding the use of OP_TIMEOUT

DISCUSSION Alex O'Brien 1 participant 1 message May 20, 2021 1 message not in the archive io_uring

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 17 lines · Drew DeVault
Quoted 16 lines · Alex O'Brien
Quoted 15 lines · Drew DeVault

Hi folks! I'm trying to use IO_TIMEOUT to insert a pause in the middle of my SQ. I set the off (desired number of events to wait for) to zero, which according to the docs just makes it behave like a timer.

Essentially, I want the following:

[operations...]
OP_TIMEOUT
[operations...]

To be well-ordered, so that the second batch executes after the first. To accomplish this, I've tried to submit the first operation of the second batch with IO_DRAIN, which causes the CQE to be delayed, but ultimately it fails with EINTR instead of just waiting to execute.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

I understand that the primary motivator for OP_TIMEOUT is to provide a timeout functionality for other CQEs. Is my use-case not accomodated by io_uring?

Have you tried setting IO_DRAIN on the timeout operation itself?

Tried it just now. Does not appear to change the results.

Hm. Sorry, that was my one concrete idea. (I do think that's more what you want, since it should guarantee that the timeout only starts after the first batch completes). Maybe there's some weirdness due to the fact that OP_TIMEOUT actually returns -ETIME on expiration, rather than "succeeding", though I don't actually know how IO_DRAIN behaves in the presence of preceding failures.

Signature · 2 lines
- Alex O'Brien
<[email protected]>