public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: David Wei <[email protected]>, Jens Axboe <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] io_uring: add support for multishot timeouts
Date: Mon, 27 Mar 2023 13:09:03 +0100	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On 3/23/23 23:10, David Wei wrote:
> A multishot timeout submission will repeatedly generate completions with
> the IORING_CQE_F_MORE cflag set. Depending on the value of the `off' field
> in the submission, these timeouts can either repeat indefinitely until
> cancelled (`off' = 0) or for a fixed number of times (`off' > 0).
> 
> Only noseq timeouts (i.e. not dependent on the number of I/O
> completions) are supported.

It's ok, I'm not sure there is anyone using sequences

> For the second case, the `target_seq' field in `struct io_timeout' is
> re-purposed to track the remaining number of timeouts.

We have space in struct io_timeout, let's just add another
field there.

[...]
>   static bool io_kill_timeout(struct io_kiocb *req, int status)
>   	__must_hold(&req->ctx->timeout_lock)
>   {
> @@ -202,6 +215,13 @@ static enum hrtimer_restart io_timeout_fn(struct hrtimer *timer)
>   	struct io_ring_ctx *ctx = req->ctx;
>   	unsigned long flags;
>   
> +	if (!io_timeout_finish(timeout, data)) {
> +		io_aux_cqe(req->ctx, false, req->cqe.user_data, -ETIME,
> +			   IORING_CQE_F_MORE, true);

We can't post a cqe from here, it should be a task context,
e.g. using tw

> +		hrtimer_forward_now(&data->timer, timespec64_to_ktime(data->ts));
> +		return HRTIMER_RESTART;
> +	}
> +
[...]

-- 
Pavel Begunkov

      reply	other threads:[~2023-03-27 12:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23 23:10 [PATCH] io_uring: add support for multishot timeouts David Wei
2023-03-27 12:09 ` Pavel Begunkov [this message]

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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