Re: [PATCH] io_uring: add support for multishot timeouts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux