lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e23dd6a3-fe1f-48e0-8d05-2b5c1e87f3a3@gmail.com>
Date: Tue, 13 Aug 2024 14:19:22 +0100
From: Pavel Begunkov <asml.silence@...il.com>
To: Ruyi Zhang <ruyi.zhang@...sung.com>, axboe@...nel.dk
Cc: io-uring@...r.kernel.org, linux-kernel@...r.kernel.org,
 peiwei.li@...sung.com
Subject: Re: [PATCH] io_uring/fdinfo: add timeout_list to fdinfo

On 8/12/24 03:00, Ruyi Zhang wrote:
> io_uring fdinfo contains most of the runtime information,
> which is helpful for debugging io_uring applications;
> However, there is currently a lack of timeout-related
> information, and this patch adds timeout_list information.
> 
> Signed-off-by: Ruyi Zhang <ruyi.zhang@...sung.com>
> ---
>   io_uring/fdinfo.c  | 16 ++++++++++++++--
>   io_uring/timeout.c | 12 ------------
>   io_uring/timeout.h | 12 ++++++++++++
>   3 files changed, 26 insertions(+), 14 deletions(-)
> 
> diff --git a/io_uring/fdinfo.c b/io_uring/fdinfo.c
> index b1e0e0d85349..33c3efd79f98 100644
> --- a/io_uring/fdinfo.c
> +++ b/io_uring/fdinfo.c
> @@ -14,6 +14,7 @@
>   #include "fdinfo.h"
>   #include "cancel.h"
>   #include "rsrc.h"
> +#include "timeout.h"
>   
>   #ifdef CONFIG_PROC_FS
>   static __cold int io_uring_show_cred(struct seq_file *m, unsigned int id,
> @@ -54,6 +55,7 @@ __cold void io_uring_show_fdinfo(struct seq_file *m, struct file *file)
>   {
>   	struct io_ring_ctx *ctx = file->private_data;
>   	struct io_overflow_cqe *ocqe;
> +	struct io_timeout *timeout;
>   	struct io_rings *r = ctx->rings;
>   	struct rusage sq_usage;
>   	unsigned int sq_mask = ctx->sq_entries - 1, cq_mask = ctx->cq_entries - 1;
> @@ -219,9 +221,19 @@ __cold void io_uring_show_fdinfo(struct seq_file *m, struct file *file)
>   
>   		seq_printf(m, "  user_data=%llu, res=%d, flags=%x\n",
>   			   cqe->user_data, cqe->res, cqe->flags);
> -
>   	}
> -
>   	spin_unlock(&ctx->completion_lock);
> +
> +	seq_puts(m, "TimeoutList:\n");
> +	spin_lock(&ctx->timeout_lock);

_irq

> +	list_for_each_entry(timeout, &ctx->timeout_list, list) {
> +		struct io_kiocb *req = cmd_to_io_kiocb(timeout);
> +		struct io_timeout_data *data = req->async_data;
> +

I'd argue we don't want it, there should be better way for
reflection.

And we also don't want to walk a potentially very long list
under spinlock without IRQs, especially from procfs path,
and even more so with seq_printf in there doing a lot of
work. Yes, we already walk the list like that for cancellation,
but it's lighter than seq_printf, and we should be moving in
the direction of improving it, not aggravating the situation.


> +		seq_printf(m, "  off=%d, target_seq=%d, repeats=%x,  ts.tv_sec=%lld, ts.tv_nsec=%ld\n",
> +			   timeout->off, timeout->target_seq, timeout->repeats,
> +			   data->ts.tv_sec, data->ts.tv_nsec);

We should be deprecating sequences, i.e. target_seq, not exposing
it further to the user.

> +	}
> +	spin_unlock(&ctx->timeout_lock);
>   }
>   #endif

-- 
Pavel Begunkov

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ