* [PATCH v2 RESEND] io_uring/fdinfo: add timeout_list to fdinfo
[not found] <CGME20240925085815epcas5p16fa977581284a81dae7b67da8bc96a85@epcas5p1.samsung.com>
@ 2024-09-25 8:58 ` Ruyi Zhang
2024-09-25 11:58 ` Pavel Begunkov
0 siblings, 1 reply; 2+ messages in thread
From: Ruyi Zhang @ 2024-09-25 8:58 UTC (permalink / raw)
To: axboe, asml.silence; +Cc: io-uring, linux-kernel, peiwei.li, Ruyi Zhang
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.
--
changes since v1:
- use _irq version spin_lock.
- Fixed formatting issues and delete redundant code.
- v1 :https://lore.kernel.org/io-uring/[email protected]/
--
Signed-off-by: Ruyi Zhang <[email protected]>
---
io_uring/fdinfo.c | 14 ++++++++++++++
io_uring/timeout.c | 12 ------------
io_uring/timeout.h | 12 ++++++++++++
3 files changed, 26 insertions(+), 12 deletions(-)
diff --git a/io_uring/fdinfo.c b/io_uring/fdinfo.c
index d43e1b5fcb36..f524c3cd6f57 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,
@@ -55,6 +56,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_rings *r = ctx->rings;
+ struct io_timeout *timeout;
struct rusage sq_usage;
unsigned int sq_mask = ctx->sq_entries - 1, cq_mask = ctx->cq_entries - 1;
unsigned int sq_head = READ_ONCE(r->sq.head);
@@ -235,5 +237,17 @@ __cold void io_uring_show_fdinfo(struct seq_file *m, struct file *file)
seq_puts(m, "NAPI:\tdisabled\n");
}
#endif
+
+ seq_puts(m, "TimeoutList:\n");
+ spin_lock_irq(&ctx->timeout_lock);
+ list_for_each_entry(timeout, &ctx->timeout_list, list) {
+ struct io_timeout_data *data;
+
+ data = cmd_to_io_kiocb(timeout)->async_data;
+ seq_printf(m, " off=%u, repeats=%u, sec=%lld, nsec=%ld\n",
+ timeout->off, timeout->repeats, data->ts.tv_sec,
+ data->ts.tv_nsec);
+ }
+ spin_unlock_irq(&ctx->timeout_lock);
}
#endif
diff --git a/io_uring/timeout.c b/io_uring/timeout.c
index 9973876d91b0..4449e139e371 100644
--- a/io_uring/timeout.c
+++ b/io_uring/timeout.c
@@ -13,18 +13,6 @@
#include "cancel.h"
#include "timeout.h"
-struct io_timeout {
- struct file *file;
- u32 off;
- u32 target_seq;
- u32 repeats;
- struct list_head list;
- /* head of the link, used by linked timeouts only */
- struct io_kiocb *head;
- /* for linked completions */
- struct io_kiocb *prev;
-};
-
struct io_timeout_rem {
struct file *file;
u64 addr;
diff --git a/io_uring/timeout.h b/io_uring/timeout.h
index a6939f18313e..befd489a6286 100644
--- a/io_uring/timeout.h
+++ b/io_uring/timeout.h
@@ -1,5 +1,17 @@
// SPDX-License-Identifier: GPL-2.0
+struct io_timeout {
+ struct file *file;
+ u32 off;
+ u32 target_seq;
+ u32 repeats;
+ struct list_head list;
+ /* head of the link, used by linked timeouts only */
+ struct io_kiocb *head;
+ /* for linked completions */
+ struct io_kiocb *prev;
+};
+
struct io_timeout_data {
struct io_kiocb *req;
struct hrtimer timer;
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2 RESEND] io_uring/fdinfo: add timeout_list to fdinfo
2024-09-25 8:58 ` [PATCH v2 RESEND] io_uring/fdinfo: add timeout_list to fdinfo Ruyi Zhang
@ 2024-09-25 11:58 ` Pavel Begunkov
0 siblings, 0 replies; 2+ messages in thread
From: Pavel Begunkov @ 2024-09-25 11:58 UTC (permalink / raw)
To: Ruyi Zhang, axboe; +Cc: io-uring, linux-kernel, peiwei.li
On 9/25/24 09:58, 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.
Please refer to unaddressed comments from v1. We can't have irqs
disabled for that long. And it's too verbose (i.e. depends on
the number of timeouts).
> --
> changes since v1:
> - use _irq version spin_lock.
> - Fixed formatting issues and delete redundant code.
> - v1 :https://lore.kernel.org/io-uring/[email protected]/
> --
>
> Signed-off-by: Ruyi Zhang <[email protected]>
--
Pavel Begunkov
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-09-25 11:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20240925085815epcas5p16fa977581284a81dae7b67da8bc96a85@epcas5p1.samsung.com>
2024-09-25 8:58 ` [PATCH v2 RESEND] io_uring/fdinfo: add timeout_list to fdinfo Ruyi Zhang
2024-09-25 11:58 ` Pavel Begunkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox