fuse: add fuse_request_recv tracepoint
Subsystems (2)
PATCH 1/1 fuse: add fuse_request_recv tracepoint
This new tracepoint complements the existing fuse_request_send (enqueue) and fuse_request_end (completion) with a tracepoint at the transition from "pending" to "in-progress" at the moment a daemon thread dequeues a request from fiq->pending.
This is needed for tools tracking the in-flight state of fuse requests.
---
Miklos,
This patch is not technically a fix patch, but it complements the tracepoints that were added in 6.12 by commit 396b209e405a5 ("fuse: add simple request tracepoints"), so it is my intention to backport it up to 6.12.y for use on production kernels.
I came across the need for this tracepoint when working on fuse queue monitoring tools [1] for our production env.
The fuse_request_send tracepoint is broken on 6.12.y, so I also plan to post a backport patch for 0d375a1385ed8 ("fuse: capture the unique id of fuse commands being sent"). Not sure why it was not tagged as Fixes. The existence of fuse_request_recv
This patch is intentionally based on upstream fuse (v7.1-rc2) and not on for-next branch, with ease of backport in mind.
Specifically, commit 80cea98b648ba ("fuse: change req->fm to req->chan") on for-next needs to apply the same change to the new tracepoint as well.
Would you consider applying this patch at the bottom of for-next and make this adjustment to your refactoring commit?
Thanks,
Amir.
[1] https://github.com/amir73il/bcc/commits/fuseq/
fs/fuse/dev.c | 1 + fs/fuse/fuse_trace.h | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+)
fs/fuse/dev.c +1 -0
@@ -1475,6 +1475,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, req = list_entry(fiq->pending.next, struct fuse_req, list);clear_bit (FR_PENDING , &req->flags);list_del_init (&req->list); +trace_fuse_request_recv (req);spin_unlock (&fiq->lock); args = req->args;
fs/fuse/fuse_trace.h +22 -0
@@ -101,6 +101,28 @@ TRACE_EVENT(fuse_request_send, __print_symbolic(__entry->opcode, OPCODES), __entry->len) ); +TRACE_EVENT (fuse_request_recv, + TP_PROTO(const struct fuse_req *req), + +TP_ARGS (req), + +TP_STRUCT__entry ( + __field(dev_t, connection) + __field(uint64_t, unique) + __field(enum fuse_opcode, opcode) + ), + +TP_fast_assign ( + __entry->connection = req->fm->fc->dev; + __entry->unique = req->in.h.unique; + __entry->opcode = req->in.h.opcode; + ), + +TP_printk ("connection %u req %llu opcode %u (%s)" , + __entry->connection, __entry->unique, __entry->opcode, +__print_symbolic (__entry->opcode,OPCODES )) +); + TRACE_EVENT(fuse_request_end, TP_PROTO(const struct fuse_req *req),
Signature · 1 line
2.54.0
Quoted 18 lines · Amir Goldstein
This new tracepoint complements the existing
fuse_request_send(enqueue) andfuse_request_end(completion) with a tracepoint at the transition from "pending" to "in-progress" at the moment a daemon thread dequeues a request fromfiq->pending.This is needed for tools tracking the in-flight state of fuse requests.
Signed-off-by Amir Goldstein <[email protected]>---
Miklos,
This patch is not technically a fix patch, but it complements the tracepoints that were added in 6.12 by commit
396b209e405a5("fuse: add simple request tracepoints"), so it is my intention to backport it up to 6.12.y for use on production kernels.
Quoted 7 lines
I came across the need for this tracepoint when working on fuse queue monitoring tools [1] for our production env.
The
fuse_request_sendtracepoint is broken on 6.12.y, so I also plan to post a backport patch for0d375a1385ed8("fuse: capture the unique id of fuse commands being sent"). Not sure why it was not tagged as Fixes. The existence offuse_request_recv
... in an LTS kernel will serve as a hint that the fuse_request_send tracepoint isn't broken...
Quoted 67 lines
This patch is intentionally based on upstream fuse (v7.1-rc2) and not on for-next branch, with ease of backport in mind.
Specifically, commit
80cea98b648ba("fuse: changereq->fmtoreq->chan") on for-next needs to apply the same change to the new tracepoint as well.Would you consider applying this patch at the bottom of for-next and make this adjustment to your refactoring commit?
Thanks,
Amir.[1] https://github.com/amir73il/bcc/commits/fuseq/
fs/fuse/dev.c | 1 + fs/fuse/fuse_trace.h | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+)fs/fuse/dev.c +1
-0@@ -1475,6 +1475,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, req = list_entry(fiq->pending.next, struct fuse_req, list);clear_bit (FR_PENDING , &req->flags);list_del_init (&req->list); +trace_fuse_request_recv (req);spin_unlock (&fiq->lock); args = req->args;fs/fuse/fuse_trace.h +22
-1@@ -101,6 +101,28 @@ TRACE_EVENT(fuse_request_send, __print_symbolic(__entry->opcode, OPCODES), __entry->len) ); +TRACE_EVENT (fuse_request_recv, + TP_PROTO(const struct fuse_req *req), + +TP_ARGS (req), + +TP_STRUCT__entry ( + __field(dev_t, connection) + __field(uint64_t, unique) + __field(enum fuse_opcode, opcode) + ), + +TP_fast_assign ( + __entry->connection = req->fm->fc->dev; + __entry->unique = req->in.h.unique; + __entry->opcode = req->in.h.opcode; + ), + +TP_printk ("connection %u req %llu opcode %u (%s)" , + __entry->connection, __entry->unique, __entry->opcode, +__print_symbolic (__entry->opcode,OPCODES )) +); + TRACE_EVENT(fuse_request_end, TP_PROTO(const struct fuse_req *req), --2.54.0
Quoted 9 lines · Amir Goldstein
This new tracepoint complements the existing
fuse_request_send(enqueue) andfuse_request_end(completion) with a tracepoint at the transition from "pending" to "in-progress" at the moment a daemon thread dequeues a request fromfiq->pending.This is needed for tools tracking the in-flight state of fuse requests.
Signed-off-by Amir Goldstein <[email protected]>
Quoted 78 lines · Amir Goldstein
This new tracepoint complements the existing
fuse_request_send(enqueue) andfuse_request_end(completion) with a tracepoint at the transition from "pending" to "in-progress" at the moment a daemon thread dequeues a request fromfiq->pending.This is needed for tools tracking the in-flight state of fuse requests.
Signed-off-by Amir Goldstein <[email protected]>---
Miklos,
This patch is not technically a fix patch, but it complements the tracepoints that were added in 6.12 by commit
396b209e405a5("fuse: add simple request tracepoints"), so it is my intention to backport it up to 6.12.y for use on production kernels.I came across the need for this tracepoint when working on fuse queue monitoring tools [1] for our production env.
The
fuse_request_sendtracepoint is broken on 6.12.y, so I also plan to post a backport patch for0d375a1385ed8("fuse: capture the unique id of fuse commands being sent"). Not sure why it was not tagged as Fixes. The existence offuse_request_recvThis patch is intentionally based on upstream fuse (v7.1-rc2) and not on for-next branch, with ease of backport in mind.
Specifically, commit
80cea98b648ba("fuse: changereq->fmtoreq->chan") on for-next needs to apply the same change to the new tracepoint as well.Would you consider applying this patch at the bottom of for-next and make this adjustment to your refactoring commit?
Thanks,
Amir.[1] https://github.com/amir73il/bcc/commits/fuseq/
fs/fuse/dev.c | 1 + fs/fuse/fuse_trace.h | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+)fs/fuse/dev.c +1
-0@@ -1475,6 +1475,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, req = list_entry(fiq->pending.next, struct fuse_req, list);clear_bit (FR_PENDING , &req->flags);list_del_init (&req->list); +trace_fuse_request_recv (req);spin_unlock (&fiq->lock); args = req->args;fs/fuse/fuse_trace.h +15
-0@@ -101,6 +101,28 @@ TRACE_EVENT(fuse_request_send, __print_symbolic(__entry->opcode, OPCODES), __entry->len) ); +TRACE_EVENT(fuse_request_recv, + TP_PROTO(const struct fuse_req *req), + + TP_ARGS(req), + + TP_STRUCT__entry( + __field(dev_t, connection) + __field(uint64_t, unique) + __field(enum fuse_opcode, opcode) + ), + + TP_fast_assign( + __entry->connection = req->fm->fc->dev; + __entry->unique = req->in.h.unique; + __entry->opcode = req->in.h.opcode;
fs/fuse/fuse_trace.h TRACE_EVENT(fuse_request_send, · line 128
Quoted 10 lines
fs/fuse/fuse_trace.h +7
-0+ ), + +TP_printk ("connection %u req %llu opcode %u (%s)" , + __entry->connection, __entry->unique, __entry->opcode, +__print_symbolic (__entry->opcode,OPCODES )) +); + TRACE_EVENT(fuse_request_end, TP_PROTO(const struct fuse_req *req),
I find the name 'fuse_request_recv' a bit confusing. Why not 'fuse_request_read'?
Quoted 87 lines · Bernd Schubert
Quoted 83 lines · Amir Goldstein
This new tracepoint complements the existing
fuse_request_send(enqueue) andfuse_request_end(completion) with a tracepoint at the transition from "pending" to "in-progress" at the moment a daemon thread dequeues a request fromfiq->pending.This is needed for tools tracking the in-flight state of fuse requests.
Signed-off-by Amir Goldstein <[email protected]>---
Miklos,
This patch is not technically a fix patch, but it complements the tracepoints that were added in 6.12 by commit
396b209e405a5("fuse: add simple request tracepoints"), so it is my intention to backport it up to 6.12.y for use on production kernels.I came across the need for this tracepoint when working on fuse queue monitoring tools [1] for our production env.
The
fuse_request_sendtracepoint is broken on 6.12.y, so I also plan to post a backport patch for0d375a1385ed8("fuse: capture the unique id of fuse commands being sent"). Not sure why it was not tagged as Fixes. The existence offuse_request_recvThis patch is intentionally based on upstream fuse (v7.1-rc2) and not on for-next branch, with ease of backport in mind.
Specifically, commit
80cea98b648ba("fuse: changereq->fmtoreq->chan") on for-next needs to apply the same change to the new tracepoint as well.Would you consider applying this patch at the bottom of for-next and make this adjustment to your refactoring commit?
Thanks,
Amir.[1] https://github.com/amir73il/bcc/commits/fuseq/
fs/fuse/dev.c | 1 + fs/fuse/fuse_trace.h | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+)fs/fuse/dev.c +1
-0@@ -1475,6 +1475,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, req = list_entry(fiq->pending.next, struct fuse_req, list);clear_bit (FR_PENDING , &req->flags);list_del_init (&req->list); +trace_fuse_request_recv (req);spin_unlock (&fiq->lock); args = req->args;fs/fuse/fuse_trace.h +20
-0@@ -101,6 +101,28 @@ TRACE_EVENT(fuse_request_send, __print_symbolic(__entry->opcode, OPCODES), __entry->len) ); +TRACE_EVENT (fuse_request_recv, + TP_PROTO(const struct fuse_req *req), + +TP_ARGS (req), + +TP_STRUCT__entry ( + __field(dev_t, connection) + __field(uint64_t, unique) + __field(enum fuse_opcode, opcode) + ), + +TP_fast_assign ( + __entry->connection = req->fm->fc->dev; + __entry->unique = req->in.h.unique; + __entry->opcode = req->in.h.opcode; + ), + +TP_printk ("connection %u req %llu opcode %u (%s)" , + __entry->connection, __entry->unique, __entry->opcode, + __print_symbolic(__entry->opcode, OPCODES))
Quoted 8 lines
fs/fuse/fuse_trace.h TRACE_EVENT(fuse_request_send, · line 128
Quoted 5 lines
fs/fuse/fuse_trace.h +2
-0+); + TRACE_EVENT(fuse_request_end, TP_PROTO(const struct fuse_req *req),I find the name '
fuse_request_recv' a bit confusing. Why not 'fuse_request_read'?
Well, to balance fuse_request_send of course ;)
I'll note that _read() is not adequate for iouring, which bares the question, should we also add a tracepoint at iouring dispatch:
fs/fuse/dev_uring.c +0 -0
@@ -702,10 +702,12 @@ static int fuse_uring_prepare_send(struct
fuse_ring_ent *ent,
int err;
err = fuse_uring_copy_to_ring(ent, req);
- if (!err)
+ if (!err) {
set_bit(FR_SENT, &req->flags);
- else
+ trace_fuse_request_recv(req);
+ } else {
fuse_uring_req_end(ent, req, err);+ }
return err;
}
Not sure which pid will be traced here? the libfuse queue worker thread pid? Is that meaningful to someone?
Another option for a tracepoint name, looking at the above would be trace_fuse_request_sent()
But I would not change the name until anyone insists.
Thanks,
Amir.
Quoted 124 lines · Amir Goldstein
Quoted 87 lines · Bernd Schubert
Quoted 83 lines · Amir Goldstein
This new tracepoint complements the existing
fuse_request_send(enqueue) andfuse_request_end(completion) with a tracepoint at the transition from "pending" to "in-progress" at the moment a daemon thread dequeues a request fromfiq->pending.This is needed for tools tracking the in-flight state of fuse requests.
Signed-off-by Amir Goldstein <[email protected]>---
Miklos,
This patch is not technically a fix patch, but it complements the tracepoints that were added in 6.12 by commit
396b209e405a5("fuse: add simple request tracepoints"), so it is my intention to backport it up to 6.12.y for use on production kernels.I came across the need for this tracepoint when working on fuse queue monitoring tools [1] for our production env.
The
fuse_request_sendtracepoint is broken on 6.12.y, so I also plan to post a backport patch for0d375a1385ed8("fuse: capture the unique id of fuse commands being sent"). Not sure why it was not tagged as Fixes. The existence offuse_request_recvThis patch is intentionally based on upstream fuse (v7.1-rc2) and not on for-next branch, with ease of backport in mind.
Specifically, commit
80cea98b648ba("fuse: changereq->fmtoreq->chan") on for-next needs to apply the same change to the new tracepoint as well.Would you consider applying this patch at the bottom of for-next and make this adjustment to your refactoring commit?
Thanks,
Amir.[1] https://github.com/amir73il/bcc/commits/fuseq/
fs/fuse/dev.c | 1 + fs/fuse/fuse_trace.h | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+)fs/fuse/dev.c +1
-0@@ -1475,6 +1475,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, req = list_entry(fiq->pending.next, struct fuse_req, list);clear_bit (FR_PENDING , &req->flags);list_del_init (&req->list); +trace_fuse_request_recv (req);spin_unlock (&fiq->lock); args = req->args;fs/fuse/fuse_trace.h +20
-0@@ -101,6 +101,28 @@ TRACE_EVENT(fuse_request_send, __print_symbolic(__entry->opcode, OPCODES), __entry->len) ); +TRACE_EVENT (fuse_request_recv, + TP_PROTO(const struct fuse_req *req), + +TP_ARGS (req), + +TP_STRUCT__entry ( + __field(dev_t, connection) + __field(uint64_t, unique) + __field(enum fuse_opcode, opcode) + ), + +TP_fast_assign ( + __entry->connection = req->fm->fc->dev; + __entry->unique = req->in.h.unique; + __entry->opcode = req->in.h.opcode; + ), + +TP_printk ("connection %u req %llu opcode %u (%s)" , + __entry->connection, __entry->unique, __entry->opcode, + __print_symbolic(__entry->opcode, OPCODES))Quoted 8 lines
fs/fuse/fuse_trace.h TRACE_EVENT(fuse_request_send, · line 128
Quoted 5 lines
fs/fuse/fuse_trace.h +2
-0+); + TRACE_EVENT(fuse_request_end, TP_PROTO(const struct fuse_req *req),I find the name '
fuse_request_recv' a bit confusing. Why not 'fuse_request_read'?Well, to balance
fuse_request_sendof course ;)I'll note that
_read()is not adequate for iouring, which bares the question, should we also add a tracepoint at iouring dispatch:fs/fuse/dev_uring.c +4
-2@@ -702,10 +702,12 @@ static int fuse_uring_prepare_send(structfuse_ring_ent *ent, int err; err =fuse_uring_copy_to_ring (ent, req); -if (!err) +if (!err) {set_bit (FR_SENT , &req->flags); -else +trace_fuse_request_recv (req); + }else {fuse_uring_req_end (ent, req, err); + }return err;}
Quoted 8 lines
Not sure which pid will be traced here? the libfuse queue worker thread pid? Is that meaningful to someone?
Another option for a tracepoint name, looking at the above would be
trace_fuse_request_sent()But I would not change the name until anyone insists.
So the sad part is that I had done all of that
https://lore.kernel.org/all/[email protected]/
However, I had noticed that we take the fiq lock just to increase the request unique, changed it to an atomic and then Miklos asked to change it to a per CPU counter. That got complex with per-cpu, the updated series had bugs, new unpublished versions maybe did not have anymore, but I didn't have time to test and triple verify the complexity. Then Darrick also changed traces - I had even less time to fix conflicts - there were are. From todays point of view, I just should pushed back for the atomic change, we now still have the worse spin lock and incomplete traces.
Thanks,
Bernd
Quoted 98 lines · Amir Goldstein
Quoted 87 lines · Bernd Schubert
Quoted 83 lines · Amir Goldstein
This new tracepoint complements the existing
fuse_request_send(enqueue) andfuse_request_end(completion) with a tracepoint at the transition from "pending" to "in-progress" at the moment a daemon thread dequeues a request fromfiq->pending.This is needed for tools tracking the in-flight state of fuse requests.
Signed-off-by Amir Goldstein <[email protected]>---
Miklos,
This patch is not technically a fix patch, but it complements the tracepoints that were added in 6.12 by commit
396b209e405a5("fuse: add simple request tracepoints"), so it is my intention to backport it up to 6.12.y for use on production kernels.I came across the need for this tracepoint when working on fuse queue monitoring tools [1] for our production env.
The
fuse_request_sendtracepoint is broken on 6.12.y, so I also plan to post a backport patch for0d375a1385ed8("fuse: capture the unique id of fuse commands being sent"). Not sure why it was not tagged as Fixes. The existence offuse_request_recvThis patch is intentionally based on upstream fuse (v7.1-rc2) and not on for-next branch, with ease of backport in mind.
Specifically, commit
80cea98b648ba("fuse: changereq->fmtoreq->chan") on for-next needs to apply the same change to the new tracepoint as well.Would you consider applying this patch at the bottom of for-next and make this adjustment to your refactoring commit?
Thanks,
Amir.[1] https://github.com/amir73il/bcc/commits/fuseq/
fs/fuse/dev.c | 1 + fs/fuse/fuse_trace.h | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+)fs/fuse/dev.c +1
-0@@ -1475,6 +1475,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, req = list_entry(fiq->pending.next, struct fuse_req, list);clear_bit (FR_PENDING , &req->flags);list_del_init (&req->list); +trace_fuse_request_recv (req);spin_unlock (&fiq->lock); args = req->args;fs/fuse/fuse_trace.h +20
-0@@ -101,6 +101,28 @@ TRACE_EVENT(fuse_request_send, __print_symbolic(__entry->opcode, OPCODES), __entry->len) ); +TRACE_EVENT (fuse_request_recv, + TP_PROTO(const struct fuse_req *req), + +TP_ARGS (req), + +TP_STRUCT__entry ( + __field(dev_t, connection) + __field(uint64_t, unique) + __field(enum fuse_opcode, opcode) + ), + +TP_fast_assign ( + __entry->connection = req->fm->fc->dev; + __entry->unique = req->in.h.unique; + __entry->opcode = req->in.h.opcode; + ), + +TP_printk ("connection %u req %llu opcode %u (%s)" , + __entry->connection, __entry->unique, __entry->opcode, + __print_symbolic(__entry->opcode, OPCODES))Quoted 8 lines
fs/fuse/fuse_trace.h TRACE_EVENT(fuse_request_send, · line 128
Quoted 5 lines
fs/fuse/fuse_trace.h +2
-0+); + TRACE_EVENT(fuse_request_end, TP_PROTO(const struct fuse_req *req),I find the name '
fuse_request_recv' a bit confusing. Why not 'fuse_request_read'?
Quoted 1 line
Well, to balance
fuse_request_sendof course ;)
Reading my own patch:
Rename trace_fuse_request_send to trace_fuse_request_enqueue Add trace_fuse_request_send
Add trace_fuse_request_bg_enqueue
Add trace_fuse_request_enqueue
with
fs/fuse/dev.c +0 -0
index 1ccf5a9c61ae2b11bc1d0b799c08e6da908a9782..8e1a95f80e5454d1351ecb90beacbb35779731bb 100644
fs/fuse/dev.c +0 -0
@@ -281,7 +281,9 @@ static void fuse_send_one(struct fuse_iqueue *fiq,
struct fuse_req *req)
req->in.h.len = sizeof(struct fuse_in_header) +
fuse_len_args(req->args->in_numargs,
(struct fuse_arg *) req->args->in_args);
- trace_fuse_request_send(req);
+
+ /* enqueue, as it is send to "fiq->ops queue" */
+ trace_fuse_request_enqueue(req);
fiq->ops->send_req(fiq, req);
}
@@ -580,6 +582,8 @@ static int fuse_request_queue_background(struct fuse_req *req)
}
__set_bit(FR_ISREPLY, &req->flags);
+ trace_fuse_request_bg_enqueue(req);
+
@@ -1314,6 +1318,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file,
clear_bit(FR_PENDING, &req->flags); list_del_init(&req->list); spin_unlock(&fiq->lock);
+ trace_fuse_request_send(req);
args = req->args;
reqsize = req->in.h.len;
IMHO, trace_fuse_request_enqueue / trace_fuse_request_bg_enqueue for adding to the queue and trace_fuse_request_send for reading/handling the request is less confusing.
Thanks,
Bernd
Quoted 102 lines · Bernd Schubert
Quoted 98 lines · Amir Goldstein
Quoted 95 lines · Bernd Schubert
Quoted 78 lines · Amir Goldstein
This new tracepoint complements the existing
fuse_request_send(enqueue) andfuse_request_end(completion) with a tracepoint at the transition from "pending" to "in-progress" at the moment a daemon thread dequeues a request fromfiq->pending.This is needed for tools tracking the in-flight state of fuse requests.
Signed-off-by Amir Goldstein <[email protected]>---
Miklos,
This patch is not technically a fix patch, but it complements the tracepoints that were added in 6.12 by commit
396b209e405a5("fuse: add simple request tracepoints"), so it is my intention to backport it up to 6.12.y for use on production kernels.I came across the need for this tracepoint when working on fuse queue monitoring tools [1] for our production env.
The
fuse_request_sendtracepoint is broken on 6.12.y, so I also plan to post a backport patch for0d375a1385ed8("fuse: capture the unique id of fuse commands being sent"). Not sure why it was not tagged as Fixes. The existence offuse_request_recvThis patch is intentionally based on upstream fuse (v7.1-rc2) and not on for-next branch, with ease of backport in mind.
Specifically, commit
80cea98b648ba("fuse: changereq->fmtoreq->chan") on for-next needs to apply the same change to the new tracepoint as well.Would you consider applying this patch at the bottom of for-next and make this adjustment to your refactoring commit?
Thanks,
Amir.[1] https://github.com/amir73il/bcc/commits/fuseq/
fs/fuse/dev.c | 1 + fs/fuse/fuse_trace.h | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+)fs/fuse/dev.c +1
-0@@ -1475,6 +1475,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, req = list_entry(fiq->pending.next, struct fuse_req, list);clear_bit (FR_PENDING , &req->flags);list_del_init (&req->list); +trace_fuse_request_recv (req);spin_unlock (&fiq->lock); args = req->args;fs/fuse/fuse_trace.h +15
-0@@ -101,6 +101,28 @@ TRACE_EVENT(fuse_request_send, __print_symbolic(__entry->opcode, OPCODES), __entry->len) ); +TRACE_EVENT(fuse_request_recv, + TP_PROTO(const struct fuse_req *req), + + TP_ARGS(req), + + TP_STRUCT__entry( + __field(dev_t, connection) + __field(uint64_t, unique) + __field(enum fuse_opcode, opcode) + ), + + TP_fast_assign( + __entry->connection = req->fm->fc->dev; + __entry->unique = req->in.h.unique; + __entry->opcode = req->in.h.opcode;fs/fuse/fuse_trace.h TRACE_EVENT(fuse_request_send, · line 128
Quoted 10 lines
fs/fuse/fuse_trace.h +7
-0+ ), + +TP_printk ("connection %u req %llu opcode %u (%s)" , + __entry->connection, __entry->unique, __entry->opcode, +__print_symbolic (__entry->opcode,OPCODES )) +); + TRACE_EVENT(fuse_request_end, TP_PROTO(const struct fuse_req *req),I find the name '
fuse_request_recv' a bit confusing. Why not 'fuse_request_read'?
Quoted 5 lines
Quoted 1 line
Well, to balance
fuse_request_sendof course ;)Reading my own patch:
Rename
trace_fuse_request_sendtotrace_fuse_request_enqueue
IDGI. I don't see the value of this name change
Darick already fixed the _send() tracepoints in 6.18
and I see to reason to change them and break existing tracing scripts unless there is a really good reason to do so.
Quoted 13 lines
Add
trace_fuse_request_send
Addtrace_fuse_request_bg_enqueue
Addtrace_fuse_request_enqueuewith
fs/fuse/dev.c +0
-0index
1ccf5a9c61ae2b11bc1d0b799c08e6da908a9782..8e1a95f80e5454d1351ecb90beacbb35779731bb100644
fs/fuse/dev.c static void fuse_send_one(struct fuse_iqueue *fiq, · line 287
Quoted 8 lines
fs/fuse/dev.c +3
-1@@ -281,7 +281,9 @@ static void fuse_send_one(struct fuse_iqueue *fiq, struct fuse_req *req) req->in.h.len = sizeof(struct fuse_in_header) +fuse_len_args (req->args->in_numargs, (struct fuse_arg *) req->args->in_args); -trace_fuse_request_send (req); + +/* enqueue, as it is send to "fiq->ops queue" */ +trace_fuse_request_enqueue (req);
Looks like this patch is based on old code?
fs/fuse/dev.c static int fuse_request_queue_background(struct · line 587
Quoted 10 lines
fs/fuse/dev.c +2
-0fiq->ops->send_req (fiq, req); }@@ -580,6 +582,8 @@ static int fuse_request_queue_background(struct fuse_req *req) }__set_bit (FR_ISREPLY , &req->flags); +trace_fuse_request_bg_enqueue (req); +
Is this path not handled in current upstream code?
Quoted 12 lines
fs/fuse/dev.c +1
-0@@ -1314,6 +1318,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file,clear_bit (FR_PENDING , &req->flags);list_del_init (&req->list);spin_unlock (&fiq->lock); +trace_fuse_request_send (req); args = req->args;reqsize = req->in.h.len;
Quoted 3 lines
IMHO,
trace_fuse_request_enqueue/trace_fuse_request_bg_enqueuefor adding to the queue andtrace_fuse_request_sendfor reading/handling the request is less confusing.
Potato potatoenqueue->send / send->recv
There will be arguments for and against any names we pick I don't think that the name matters a lot here as long as the required information is provided to tracing tools
My question was, regarding fuse_uring_prepare_send(),
do we need a _recv()/_send()/_fetch()/_whatnot()
tracepoint in this code point and whether the pid reported in this tracepoint is useful. Is it the libfuse worker thread or something else?
Thanks,
Amir.
Quoted 130 lines · Amir Goldstein
Quoted 102 lines · Bernd Schubert
Quoted 98 lines · Amir Goldstein
Quoted 95 lines · Bernd Schubert
Quoted 78 lines · Amir Goldstein
This new tracepoint complements the existing
fuse_request_send(enqueue) andfuse_request_end(completion) with a tracepoint at the transition from "pending" to "in-progress" at the moment a daemon thread dequeues a request fromfiq->pending.This is needed for tools tracking the in-flight state of fuse requests.
Signed-off-by Amir Goldstein <[email protected]>---
Miklos,
This patch is not technically a fix patch, but it complements the tracepoints that were added in 6.12 by commit
396b209e405a5("fuse: add simple request tracepoints"), so it is my intention to backport it up to 6.12.y for use on production kernels.I came across the need for this tracepoint when working on fuse queue monitoring tools [1] for our production env.
The
fuse_request_sendtracepoint is broken on 6.12.y, so I also plan to post a backport patch for0d375a1385ed8("fuse: capture the unique id of fuse commands being sent"). Not sure why it was not tagged as Fixes. The existence offuse_request_recvThis patch is intentionally based on upstream fuse (v7.1-rc2) and not on for-next branch, with ease of backport in mind.
Specifically, commit
80cea98b648ba("fuse: changereq->fmtoreq->chan") on for-next needs to apply the same change to the new tracepoint as well.Would you consider applying this patch at the bottom of for-next and make this adjustment to your refactoring commit?
Thanks,
Amir.[1] https://github.com/amir73il/bcc/commits/fuseq/
fs/fuse/dev.c | 1 + fs/fuse/fuse_trace.h | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+)fs/fuse/dev.c +1
-0@@ -1475,6 +1475,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, req = list_entry(fiq->pending.next, struct fuse_req, list);clear_bit (FR_PENDING , &req->flags);list_del_init (&req->list); +trace_fuse_request_recv (req);spin_unlock (&fiq->lock); args = req->args;fs/fuse/fuse_trace.h +15
-0@@ -101,6 +101,28 @@ TRACE_EVENT(fuse_request_send, __print_symbolic(__entry->opcode, OPCODES), __entry->len) ); +TRACE_EVENT(fuse_request_recv, + TP_PROTO(const struct fuse_req *req), + + TP_ARGS(req), + + TP_STRUCT__entry( + __field(dev_t, connection) + __field(uint64_t, unique) + __field(enum fuse_opcode, opcode) + ), + + TP_fast_assign( + __entry->connection = req->fm->fc->dev; + __entry->unique = req->in.h.unique; + __entry->opcode = req->in.h.opcode;fs/fuse/fuse_trace.h TRACE_EVENT(fuse_request_send, · line 128
Quoted 10 lines
fs/fuse/fuse_trace.h +7
-0+ ), + +TP_printk ("connection %u req %llu opcode %u (%s)" , + __entry->connection, __entry->unique, __entry->opcode, +__print_symbolic (__entry->opcode,OPCODES )) +); + TRACE_EVENT(fuse_request_end, TP_PROTO(const struct fuse_req *req),I find the name '
fuse_request_recv' a bit confusing. Why not 'fuse_request_read'?Quoted 5 lines
Quoted 1 line
Well, to balance
fuse_request_sendof course ;)Reading my own patch:
Rename
trace_fuse_request_sendtotrace_fuse_request_enqueueIDGI. I don't see the value of this name change
Darick already fixed the_send()tracepoints in 6.18
and I see to reason to change them and break existing tracing scripts unless there is a really good reason to do so.Quoted 15 lines
Add
trace_fuse_request_send
Addtrace_fuse_request_bg_enqueue
Addtrace_fuse_request_enqueuewith
fs/fuse/dev.c +0
-0index
1ccf5a9c61ae2b11bc1d0b799c08e6da908a9782..8e1a95f80e5454d1351ecb90beacbb35779731bb100644fs/fuse/dev.c +0
-0@@ -281,7 +281,9 @@ static void fuse_send_one(struct fuse_iqueue *fiq, struct fuse_req *req) req->in.h.len = sizeof(struct fuse_in_header) +
Quoted 8 lines
fs/fuse/dev.c static void fuse_send_one(struct fuse_iqueue *fiq, · line 287
Quoted 6 lines
fs/fuse/dev.c +3
-1fuse_len_args (req->args->in_numargs, (struct fuse_arg *) req->args->in_args); -trace_fuse_request_send (req); + +/* enqueue, as it is send to "fiq->ops queue" */ +trace_fuse_request_enqueue (req);Looks like this patch is based on old code?
Sorry, I had posted part of the the old patch-
Quoted 36 lines
fs/fuse/dev.c static int fuse_request_queue_background(struct · line 587
Quoted 11 lines
fs/fuse/dev.c +2
-0fiq->ops->send_req (fiq, req); }@@ -580,6 +582,8 @@ static int fuse_request_queue_background(struct fuse_req *req) }__set_bit (FR_ISREPLY , &req->flags); +trace_fuse_request_bg_enqueue (req); +Is this path not handled in current upstream code?
Quoted 12 lines
fs/fuse/dev.c +1
-0@@ -1314,6 +1318,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file,clear_bit (FR_PENDING , &req->flags);list_del_init (&req->list);spin_unlock (&fiq->lock); +trace_fuse_request_send (req); args = req->args;reqsize = req->in.h.len;Quoted 3 lines
IMHO,
trace_fuse_request_enqueue/trace_fuse_request_bg_enqueuefor adding to the queue andtrace_fuse_request_sendfor reading/handling the request is less confusing.Potato potato
enqueue->send/send->recv
There will be arguments for and against any names we pick I don't think that the name matters a lot here as long as the required information is provided to tracing tools
Quoted 4 lines
My question was, regarding
fuse_uring_prepare_send(),
do we need a _recv()/_send()/_fetch()/_whatnot()
tracepoint in this code point and whether the pid reported in this tracepoint is useful. Is it the libfuse worker thread or something else?
Yeah, that is the libfuse worker thread. I don't think the pid is useful, the tracepoint probably is, because it allows to determine how long requests have been queued.
I had created a script last year based on the old kernel patch
https://github.com/libfuse/libfuse/pull/1186
Thanks,
Bernd