public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Pavel Begunkov <asml.silence@gmail.com>,
	Stefan Metzmacher <metze@samba.org>,
	io-uring@vger.kernel.org
Cc: Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCH v2 2/2] io_uring/timeout: immediate timeout arg
Date: Fri, 27 Feb 2026 12:39:01 -0700	[thread overview]
Message-ID: <1cd9a071-dc93-48d1-81c9-24b65e65e8bf@kernel.dk> (raw)
In-Reply-To: <a6cbceb5-2065-42ff-bcca-bdb1c2443b96@gmail.com>

On 2/27/26 12:08 PM, Pavel Begunkov wrote:
> On 2/27/26 14:08, Stefan Metzmacher wrote:
>> Hi Pavel,
>>
>>>       if (unlikely(req->flags & (REQ_F_FIXED_FILE | REQ_F_BUFFER_SELECT)))
>>>           return -EINVAL;
>>> @@ -460,10 +461,20 @@ int io_timeout_remove_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
>>>               return -EINVAL;
>>>           if (tr->flags & IORING_LINK_TIMEOUT_UPDATE)
>>>               tr->ltimeout = true;
>>> -        if (tr->flags & ~(IORING_TIMEOUT_UPDATE_MASK|IORING_TIMEOUT_ABS))
>>> +        if (tr->flags & ~(IORING_TIMEOUT_UPDATE_MASK |
>>> +                  IORING_TIMEOUT_ABS |
>>> +                  IORING_TIMEOUT_IMMEDIATE_ARG))
>>>               return -EINVAL;
>>> -        if (get_timespec64(&tr->ts, u64_to_user_ptr(READ_ONCE(sqe->addr2))))
>>> +
>>> +        arg = READ_ONCE(sqe->addr2);
>>> +        if (tr->flags & IORING_TIMEOUT_IMMEDIATE_ARG) {
>>> +            if (tr->flags & IORING_TIMEOUT_ABS)
>>> +                return -EINVAL;
>>> +            tr->ts = ns_to_timespec64(arg);
>>
>> I'm wondering if there is enough free space in a small sqe to hold a full timespec?
>> So that there is no restriction for IORING_TIMEOUT_ABS...
> 
> Well, u64 gives ~500 years in ns, it should be fine to just
> allow the abs mode. We just need to make sure to zero check
> the unused fields in case it'd need to be extended.

I don't think it's about length of it - if you can avoid the div by
doing ns_to_timespec64(), that might be very useful? Would make
userspace simpler too potentially, and basically make the immediate mode
_exactly_ the same as the non-immediate mode, it just delivers the
__kernel_timespec in a different way.

-- 
Jens Axboe

  reply	other threads:[~2026-02-27 19:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-25 10:35 [PATCH v2 0/2] timeout immediate arg Pavel Begunkov
2026-02-25 10:35 ` [PATCH v2 1/2] io_uring/timeout: READ_ONCE sqe->addr Pavel Begunkov
2026-02-25 10:35 ` [PATCH v2 2/2] io_uring/timeout: immediate timeout arg Pavel Begunkov
2026-02-27 14:08   ` Stefan Metzmacher
2026-02-27 15:05     ` Jens Axboe
2026-02-27 16:17       ` Stefan Metzmacher
2026-02-27 16:21         ` Jens Axboe
2026-02-27 19:08     ` Pavel Begunkov
2026-02-27 19:39       ` Jens Axboe [this message]
2026-02-27 20:03         ` Pavel Begunkov
2026-02-27 20:19           ` Jens Axboe
2026-02-27 21:09             ` Pavel Begunkov
2026-02-27 21:17               ` Jens Axboe
2026-02-27 22:10                 ` Pavel Begunkov
2026-02-27 22:19                   ` Jens Axboe
2026-02-27 22:47                     ` Pavel Begunkov
2026-02-25 15:36 ` (subset) [PATCH v2 0/2] timeout immediate arg Jens Axboe

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=1cd9a071-dc93-48d1-81c9-24b65e65e8bf@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=asml.silence@gmail.com \
    --cc=io-uring@vger.kernel.org \
    --cc=kbusch@kernel.org \
    --cc=metze@samba.org \
    /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