On 8/28/21 4:22 AM, Jens Axboe wrote: > On 8/26/21 7:40 PM, Victor Stewart wrote: >> On Wed, Aug 25, 2021 at 2:27 AM Victor Stewart <v@nametag.social> wrote: >>> >>> On Tue, Aug 24, 2021 at 11:43 PM Victor Stewart <v@nametag.social> wrote: >>>> >>>> we're able to update timeouts with io_uring_prep_timeout_update >>>> without having to cancel >>>> and resubmit, has it ever been considered adding this ability to >>>> linked timeouts? >>> >>> whoops turns out this does work. just tested it. >> >> doesn't work actually. missed that because of a bit of misdirection. >> returns -ENOENT. >> >> the problem with the current way of cancelling then resubmitting >> a new a timeout linked op (let's use poll here) is you have 3 situations: >> >> 1) the poll triggers and you get some positive value. all good. >> >> 2) the linked timeout triggers and cancels the poll, so the poll >> operation returns -ECANCELED. >> >> 3) you cancel the existing poll op, and submit a new one with >> the updated linked timeout. now the original poll op returns >> -ECANCELED. >> >> so solely from looking at the return value of the poll op in 2) and 3) >> there is no way to disambiguate them. of course the linked timeout >> operation result will allow you to do so, but you'd have to persist state >> across cqe processings. you can also track the cancellations and know >> to skip the explicitly cancelled ops' cqes (which is what i chose). >> >> there's also the problem of efficiency. you can imagine in a QUIC >> server where you're constantly updating that poll timeout in response >> to idle timeout and ACK scheduling, this extra work mounts. >> >> so i think the ability to update linked timeouts via >> io_uring_prep_timeout_update would be fantastic. > > Hmm, I'll need to dig a bit, but whether it's a linked timeout or not > should not matter. It's a timeout, it's queued and updated the same way. > And we even check this in some of the liburing tests. We don't keep linked timeouts in ->timeout_list, so it's not supported and has never been. Should be doable, but we need to be careful synchronising with the link's head. > Do you have a test case that doesn't work for you? Always easier to > reason about a test case. > -- Pavel Begunkov