From: Ruyi Zhang <[email protected]>
To: [email protected]
Cc: [email protected], [email protected],
[email protected], [email protected],
[email protected]
Subject: [PATCH] io_uring/fdinfo: add timeout_list to fdinfo
Date: Wed, 14 Aug 2024 09:15:49 +0000 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: CGME20240814091610epcas5p36e83248f7f1be4171549abf6a8c037ee@epcas5p3.samsung.com
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 <[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..f3295ec8cb8c 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,18 @@ __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
next parent reply other threads:[~2024-08-14 9:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20240814091610epcas5p36e83248f7f1be4171549abf6a8c037ee@epcas5p3.samsung.com>
2024-08-14 9:15 ` Ruyi Zhang [this message]
[not found] <CGME20240812020140epcas5p3431842ed5508ffb5ae9f1d1812cae4d5@epcas5p3.samsung.com>
2024-08-12 2:00 ` [PATCH] io_uring/fdinfo: add timeout_list to fdinfo Ruyi Zhang
2024-08-13 12:06 ` Jens Axboe
2024-08-13 13:19 ` Pavel Begunkov
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] \
[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