virtio-fs: Add some tracepoints
Subsystems (3)
cover virtio-fs: Add some tracepoints
From: Masayoshi Mizuma <[email protected]>
This patch series introduce some tracepoints. It will be useful to debug the I/O request flow.
New trace events:
- virtiofs_request_dispatched
- virtiofs_request_done
- virtiofs_hiprio_request_dispatched
- virtiofs_hiprio_request_done
Above trace events is added to the following functions as the tracepoints:
- virtio_fs_enqueue_req
- virtio_fs_requests_done_work
- virtio_fs_hiprio_dispatch_work
- virtio_fs_hiprio_done_work
Example of the trace record:
cat-1420 [002] .... 34.687462: virtiofs_request_dispatched: opcode
FUSE_READ unique 0x1a nodeid 0x2 in.len 80 flags ISREPLY|WAITING|SENT
notify 1
kworker/4:1-67 [004] .... 34.687531: virtiofs_request_done: opcode FUSE_READ
unique 0x1a nodeid 0x2 in.len 80 flags ISREPLY|WAITINGMasayoshi Mizuma (2):
add ftrace events
add tracepoints
fs/fuse/virtio_fs.c | 21 ++++ include/trace/events/virtiofs.h | 195 ++++++++++++++++++++++++++++++++ 2 files changed, 216 insertions(+) create mode 100644 include/trace/events/virtiofs.h
Signature · 1 line
2.18.1
RFC PATCH 1/2 virtio-fs: add ftrace events
From: Masayoshi Mizuma <[email protected]>
Introduce the following ftrace events.
- virtiofs_request_dispatched
- virtiofs_request_done
- virtiofs_hiprio_request_dispatched
- virtiofs_hiprio_request_done
--- include/trace/events/virtiofs.h | 195 ++++++++++++++++++++++++++++++++ 1 file changed, 195 insertions(+) create mode 100644 include/trace/events/virtiofs.h
include/trace/events/virtiofs.h new file +195 -0
@@ -0,0 +1,195 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM virtiofs + +#if !defined(_TRACE_VIRTIOFS_H) || defined(TRACE_HEADER_MULTI_READ ) +#define _TRACE_VIRTIOFS_H + +#include <linux/tracepoint.h> +#include <uapi/linux/fuse.h> + +#define fuse_opcode_name (opcode) { opcode, #opcode } +#define show_opcode_name (val) \ + __print_symbolic(val, \ + fuse_opcode_name(FUSE_LOOKUP), \ + fuse_opcode_name(FUSE_FORGET), \ + fuse_opcode_name(FUSE_GETATTR), \ + fuse_opcode_name(FUSE_SETATTR), \ + fuse_opcode_name(FUSE_READLINK), \ + fuse_opcode_name(FUSE_SYMLINK), \ + fuse_opcode_name(FUSE_MKNOD), \ + fuse_opcode_name(FUSE_MKDIR), \ + fuse_opcode_name(FUSE_UNLINK), \ + fuse_opcode_name(FUSE_RMDIR), \ + fuse_opcode_name(FUSE_RENAME), \ + fuse_opcode_name(FUSE_LINK), \ + fuse_opcode_name(FUSE_OPEN), \ + fuse_opcode_name(FUSE_READ), \ + fuse_opcode_name(FUSE_WRITE), \ + fuse_opcode_name(FUSE_STATFS), \ + fuse_opcode_name(FUSE_RELEASE), \ + fuse_opcode_name(FUSE_FSYNC), \ + fuse_opcode_name(FUSE_SETXATTR), \ + fuse_opcode_name(FUSE_GETXATTR), \ + fuse_opcode_name(FUSE_LISTXATTR), \ + fuse_opcode_name(FUSE_REMOVEXATTR), \ + fuse_opcode_name(FUSE_FLUSH), \ + fuse_opcode_name(FUSE_INIT), \ + fuse_opcode_name(FUSE_OPENDIR), \ + fuse_opcode_name(FUSE_READDIR), \ + fuse_opcode_name(FUSE_RELEASEDIR), \ + fuse_opcode_name(FUSE_FSYNCDIR), \ + fuse_opcode_name(FUSE_GETLK), \ + fuse_opcode_name(FUSE_SETLK), \ + fuse_opcode_name(FUSE_SETLKW), \ + fuse_opcode_name(FUSE_ACCESS), \ + fuse_opcode_name(FUSE_CREATE), \ + fuse_opcode_name(FUSE_INTERRUPT), \ + fuse_opcode_name(FUSE_BMAP), \ + fuse_opcode_name(FUSE_DESTROY), \ + fuse_opcode_name(FUSE_IOCTL), \ + fuse_opcode_name(FUSE_POLL), \ + fuse_opcode_name(FUSE_NOTIFY_REPLY), \ + fuse_opcode_name(FUSE_BATCH_FORGET), \ + fuse_opcode_name(FUSE_FALLOCATE), \ + fuse_opcode_name(FUSE_READDIRPLUS), \ + fuse_opcode_name(FUSE_RENAME2), \ + fuse_opcode_name(FUSE_LSEEK), \ + fuse_opcode_name(FUSE_COPY_FILE_RANGE), \ + fuse_opcode_name(FUSE_SETUPMAPPING), \ + fuse_opcode_name(FUSE_REMOVEMAPPING)) + +#define show_req_flag (flags) __print_flags(flags, "|", \ + { (1UL << FR_ISREPLY), "ISREPLY"}, \ + { (1UL << FR_FORCE), "FORCE"}, \ + { (1UL << FR_BACKGROUND), "BACKGROUND"}, \ + { (1UL << FR_WAITING), "WAITING"}, \ + { (1UL << FR_ABORTED), "ABORTED"}, \ + { (1UL << FR_INTERRUPTED), "INTERRUPTED"}, \ + { (1UL << FR_LOCKED), "LOCKED"}, \ + { (1UL << FR_PENDING), "PENDING"}, \ + { (1UL << FR_SENT), "SENT"}, \ + { (1UL << FR_FINISHED), "FINISHED"}, \ + { (1UL << FR_PRIVATE), "PRIVATE"}) + +TRACE_EVENT (virtiofs_request_dispatched, + + TP_PROTO(uint32_t opcode, uint64_t unique, uint64_t nodeid, + uint32_t inlen, unsigned long flags, bool notify), + +TP_ARGS (opcode, unique, nodeid, inlen, flags, notify), + +TP_STRUCT__entry ( + __field(uint32_t, opcode) + __field(uint64_t, unique) + __field(uint64_t, nodeid) + __field(uint32_t, inlen) + __field(unsigned long, flags) +__field (bool, notify) + ), + +TP_fast_assign ( + __entry->opcode = opcode; + __entry->unique = unique; + __entry->nodeid = nodeid; + __entry->inlen = inlen; + __entry->flags = flags; + __entry->notify = notify; + ), + +TP_printk ("opcode %s unique %#llx nodeid %#llx in.len %u flags %s notify %d\n" , +show_opcode_name (__entry->opcode), + __entry->unique, __entry->nodeid, + __entry->inlen,show_req_flag (__entry->flags), + __entry->notify) +); + +TRACE_EVENT (virtiofs_request_done, + + TP_PROTO(uint32_t opcode, uint64_t unique, uint64_t nodeid, + uint32_t inlen, unsigned long flags), + +TP_ARGS (opcode, unique, nodeid, inlen, flags), + +TP_STRUCT__entry ( + __field(uint32_t, opcode) + __field(uint64_t, unique) + __field(uint64_t, nodeid) + __field(uint32_t, inlen) + __field(unsigned long, flags) + ), + +TP_fast_assign ( + __entry->opcode = opcode; + __entry->unique = unique; + __entry->nodeid = nodeid; + __entry->inlen = inlen; + __entry->flags = flags; + ), + +TP_printk ("opcode %s unique %#llx nodeid %#llx in.len %u flags %s\n" , +show_opcode_name (__entry->opcode), + __entry->unique, __entry->nodeid, + __entry->inlen,show_req_flag (__entry->flags)) +); + +TRACE_EVENT (virtiofs_hiprio_request_dispatched, + + TP_PROTO(uint32_t opcode, uint64_t unique, uint64_t nodeid, + uint32_t inlen, bool notify), + +TP_ARGS (opcode, unique, nodeid, inlen, notify), + +TP_STRUCT__entry ( + __field(uint32_t, opcode) + __field(uint64_t, unique) + __field(uint64_t, nodeid) + __field(uint32_t, inlen) +__field (bool, notify) + ), + +TP_fast_assign ( + __entry->opcode = opcode; + __entry->unique = unique; + __entry->nodeid = nodeid; + __entry->inlen = inlen; + __entry->notify = notify; + ), + +TP_printk ("opcode %s unique %#llx nodeid %#llx in.len %u notify %d\n" , +show_opcode_name (__entry->opcode), + __entry->unique, __entry->nodeid, + __entry->inlen, __entry->notify) +); + +TRACE_EVENT (virtiofs_hiprio_request_done, + + TP_PROTO(uint32_t opcode, uint64_t unique, uint64_t nodeid, + uint32_t inlen), + +TP_ARGS (opcode, unique, nodeid, inlen), + +TP_STRUCT__entry ( + __field(uint32_t, opcode) + __field(uint64_t, unique) + __field(uint64_t, nodeid) +__field (uint32_t, inlen) + ), + +TP_fast_assign ( + __entry->opcode = opcode; + __entry->unique = unique; + __entry->nodeid = nodeid; + __entry->inlen = inlen; + ), + +TP_printk ("opcode %s unique %#llx nodeid %#llx in.len %u\n" , +show_opcode_name (__entry->opcode), + __entry->unique, __entry->nodeid, + __entry->inlen) +); + +#endif /* _TRACE_VIRTIOFS_H */ + +/* This part must be outside protection */ +#include <trace/define_trace.h>
Signature · 1 line
2.18.1
Vivek Goyal
maintainerRe: [Virtio-fs] [PATCH 1/2][RFC] virtio-fs: add ftrace events
Quoted 9 lines · Masayoshi Mizuma
From: Masayoshi Mizuma <[email protected]>
Introduce the following ftrace events.
-
virtiofs_request_dispatched
-virtiofs_request_done
-virtiofs_hiprio_request_dispatched
-virtiofs_hiprio_request_done
Quoted 5 lines
Signed-off-by Masayoshi Mizuma <[email protected]>--- include/trace/events/virtiofs.h | 195 ++++++++++++++++++++++++++++++++ 1 file changed, 195 insertions(+) create mode 100644 include/trace/events/virtiofs.h
Hi Masayoshi,
How about naming this file vitio_fs.h (instead of virtiofs.h). We name it fs/fuse/virtio_fs.c in fuse code as well.
Can we easily change trace points later? Or there is resistance to changing static trace points upstream once introdced.
I can carry tracepoints in devel branch so that its easy to debug issues. When it comes to sending tracepoints upstream, may be it is a good idea to first upstream core code and then send tracepoints in a separate patch series later.
Thanks
Vivek
Quoted 209 lines
include/trace/events/virtiofs.h new file +195
-0@@ -0,0 +1,195 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM virtiofs + +#if !defined(_TRACE_VIRTIOFS_H) || defined(TRACE_HEADER_MULTI_READ ) +#define _TRACE_VIRTIOFS_H + +#include <linux/tracepoint.h> +#include <uapi/linux/fuse.h> + +#define fuse_opcode_name (opcode) { opcode, #opcode } +#define show_opcode_name (val) \ + __print_symbolic(val, \ + fuse_opcode_name(FUSE_LOOKUP), \ + fuse_opcode_name(FUSE_FORGET), \ + fuse_opcode_name(FUSE_GETATTR), \ + fuse_opcode_name(FUSE_SETATTR), \ + fuse_opcode_name(FUSE_READLINK), \ + fuse_opcode_name(FUSE_SYMLINK), \ + fuse_opcode_name(FUSE_MKNOD), \ + fuse_opcode_name(FUSE_MKDIR), \ + fuse_opcode_name(FUSE_UNLINK), \ + fuse_opcode_name(FUSE_RMDIR), \ + fuse_opcode_name(FUSE_RENAME), \ + fuse_opcode_name(FUSE_LINK), \ + fuse_opcode_name(FUSE_OPEN), \ + fuse_opcode_name(FUSE_READ), \ + fuse_opcode_name(FUSE_WRITE), \ + fuse_opcode_name(FUSE_STATFS), \ + fuse_opcode_name(FUSE_RELEASE), \ + fuse_opcode_name(FUSE_FSYNC), \ + fuse_opcode_name(FUSE_SETXATTR), \ + fuse_opcode_name(FUSE_GETXATTR), \ + fuse_opcode_name(FUSE_LISTXATTR), \ + fuse_opcode_name(FUSE_REMOVEXATTR), \ + fuse_opcode_name(FUSE_FLUSH), \ + fuse_opcode_name(FUSE_INIT), \ + fuse_opcode_name(FUSE_OPENDIR), \ + fuse_opcode_name(FUSE_READDIR), \ + fuse_opcode_name(FUSE_RELEASEDIR), \ + fuse_opcode_name(FUSE_FSYNCDIR), \ + fuse_opcode_name(FUSE_GETLK), \ + fuse_opcode_name(FUSE_SETLK), \ + fuse_opcode_name(FUSE_SETLKW), \ + fuse_opcode_name(FUSE_ACCESS), \ + fuse_opcode_name(FUSE_CREATE), \ + fuse_opcode_name(FUSE_INTERRUPT), \ + fuse_opcode_name(FUSE_BMAP), \ + fuse_opcode_name(FUSE_DESTROY), \ + fuse_opcode_name(FUSE_IOCTL), \ + fuse_opcode_name(FUSE_POLL), \ + fuse_opcode_name(FUSE_NOTIFY_REPLY), \ + fuse_opcode_name(FUSE_BATCH_FORGET), \ + fuse_opcode_name(FUSE_FALLOCATE), \ + fuse_opcode_name(FUSE_READDIRPLUS), \ + fuse_opcode_name(FUSE_RENAME2), \ + fuse_opcode_name(FUSE_LSEEK), \ + fuse_opcode_name(FUSE_COPY_FILE_RANGE), \ + fuse_opcode_name(FUSE_SETUPMAPPING), \ + fuse_opcode_name(FUSE_REMOVEMAPPING)) + +#define show_req_flag (flags) __print_flags(flags, "|", \ + { (1UL << FR_ISREPLY), "ISREPLY"}, \ + { (1UL << FR_FORCE), "FORCE"}, \ + { (1UL << FR_BACKGROUND), "BACKGROUND"}, \ + { (1UL << FR_WAITING), "WAITING"}, \ + { (1UL << FR_ABORTED), "ABORTED"}, \ + { (1UL << FR_INTERRUPTED), "INTERRUPTED"}, \ + { (1UL << FR_LOCKED), "LOCKED"}, \ + { (1UL << FR_PENDING), "PENDING"}, \ + { (1UL << FR_SENT), "SENT"}, \ + { (1UL << FR_FINISHED), "FINISHED"}, \ + { (1UL << FR_PRIVATE), "PRIVATE"}) + +TRACE_EVENT (virtiofs_request_dispatched, + + TP_PROTO(uint32_t opcode, uint64_t unique, uint64_t nodeid, + uint32_t inlen, unsigned long flags, bool notify), + +TP_ARGS (opcode, unique, nodeid, inlen, flags, notify), + +TP_STRUCT__entry ( + __field(uint32_t, opcode) + __field(uint64_t, unique) + __field(uint64_t, nodeid) + __field(uint32_t, inlen) + __field(unsigned long, flags) +__field (bool, notify) + ), + +TP_fast_assign ( + __entry->opcode = opcode; + __entry->unique = unique; + __entry->nodeid = nodeid; + __entry->inlen = inlen; + __entry->flags = flags; + __entry->notify = notify; + ), + +TP_printk ("opcode %s unique %#llx nodeid %#llx in.len %u flags %s notify %d\n" , +show_opcode_name (__entry->opcode), + __entry->unique, __entry->nodeid, + __entry->inlen,show_req_flag (__entry->flags), + __entry->notify) +); + +TRACE_EVENT (virtiofs_request_done, + + TP_PROTO(uint32_t opcode, uint64_t unique, uint64_t nodeid, + uint32_t inlen, unsigned long flags), + +TP_ARGS (opcode, unique, nodeid, inlen, flags), + +TP_STRUCT__entry ( + __field(uint32_t, opcode) + __field(uint64_t, unique) + __field(uint64_t, nodeid) + __field(uint32_t, inlen) + __field(unsigned long, flags) + ), + +TP_fast_assign ( + __entry->opcode = opcode; + __entry->unique = unique; + __entry->nodeid = nodeid; + __entry->inlen = inlen; + __entry->flags = flags; + ), + +TP_printk ("opcode %s unique %#llx nodeid %#llx in.len %u flags %s\n" , +show_opcode_name (__entry->opcode), + __entry->unique, __entry->nodeid, + __entry->inlen,show_req_flag (__entry->flags)) +); + +TRACE_EVENT (virtiofs_hiprio_request_dispatched, + + TP_PROTO(uint32_t opcode, uint64_t unique, uint64_t nodeid, + uint32_t inlen, bool notify), + +TP_ARGS (opcode, unique, nodeid, inlen, notify), + +TP_STRUCT__entry ( + __field(uint32_t, opcode) + __field(uint64_t, unique) + __field(uint64_t, nodeid) + __field(uint32_t, inlen) +__field (bool, notify) + ), + +TP_fast_assign ( + __entry->opcode = opcode; + __entry->unique = unique; + __entry->nodeid = nodeid; + __entry->inlen = inlen; + __entry->notify = notify; + ), + +TP_printk ("opcode %s unique %#llx nodeid %#llx in.len %u notify %d\n" , +show_opcode_name (__entry->opcode), + __entry->unique, __entry->nodeid, + __entry->inlen, __entry->notify) +); + +TRACE_EVENT (virtiofs_hiprio_request_done, + + TP_PROTO(uint32_t opcode, uint64_t unique, uint64_t nodeid, + uint32_t inlen), + +TP_ARGS (opcode, unique, nodeid, inlen), + +TP_STRUCT__entry ( + __field(uint32_t, opcode) + __field(uint64_t, unique) + __field(uint64_t, nodeid) +__field (uint32_t, inlen) + ), + +TP_fast_assign ( + __entry->opcode = opcode; + __entry->unique = unique; + __entry->nodeid = nodeid; + __entry->inlen = inlen; + ), + +TP_printk ("opcode %s unique %#llx nodeid %#llx in.len %u\n" , +show_opcode_name (__entry->opcode), + __entry->unique, __entry->nodeid, + __entry->inlen) +); + +#endif /* _TRACE_VIRTIOFS_H */ + +/* This part must be outside protection */ +#include <trace/define_trace.h> Signature · 6 lines
2.18.1 _______________________________________________ Virtio-fs mailing list [email protected] https://www.redhat.com/mailman/listinfo/virtio-fs
Re: [Virtio-fs] [PATCH 1/2][RFC] virtio-fs: add ftrace events
Quoted 10 lines · Vivek Goyal
Quoted 9 lines · Masayoshi Mizuma
From: Masayoshi Mizuma <[email protected]>
Introduce the following ftrace events.
-
virtiofs_request_dispatched
-virtiofs_request_done
-virtiofs_hiprio_request_dispatched
-virtiofs_hiprio_request_done
Quoted 5 lines
Quoted 5 lines
Signed-off-by Masayoshi Mizuma <[email protected]>--- include/trace/events/virtiofs.h | 195 ++++++++++++++++++++++++++++++++ 1 file changed, 195 insertions(+) create mode 100644 include/trace/events/virtiofs.h
Hi Vivek,
Quoted 6 lines
Hi Masayoshi,
How about naming this file
vitio_fs.h(instead ofvirtiofs.h). We name itfs/fuse/virtio_fs.cin fuse code as well.
Got it. I change the file name to virtio_fs.c.
Quoted 3 lines
Can we easily change trace points later? Or there is resistance to changing static trace points upstream once introdced.
The tracepoints are useful for debugging purpose only at the moment, so I belive we can easily change the tracepoints later. If the tracepoints get used by userland tools, for example a tool corrects the I/O statistics info, I suppose we cannot change the tracepoints easily...
Quoted 5 lines
I can carry tracepoints in devel branch so that its easy to debug issues. When it comes to sending tracepoints upstream, may be it is a good idea to first upstream core code and then send tracepoints in a separate patch series later.
Yeah, I think it's a good idea.
Thanks!
Masa
Quoted 213 lines
Thanks
VivekQuoted 209 lines
include/trace/events/virtiofs.h new file +195
-0@@ -0,0 +1,195 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM virtiofs + +#if !defined(_TRACE_VIRTIOFS_H) || defined(TRACE_HEADER_MULTI_READ ) +#define _TRACE_VIRTIOFS_H + +#include <linux/tracepoint.h> +#include <uapi/linux/fuse.h> + +#define fuse_opcode_name (opcode) { opcode, #opcode } +#define show_opcode_name (val) \ + __print_symbolic(val, \ + fuse_opcode_name(FUSE_LOOKUP), \ + fuse_opcode_name(FUSE_FORGET), \ + fuse_opcode_name(FUSE_GETATTR), \ + fuse_opcode_name(FUSE_SETATTR), \ + fuse_opcode_name(FUSE_READLINK), \ + fuse_opcode_name(FUSE_SYMLINK), \ + fuse_opcode_name(FUSE_MKNOD), \ + fuse_opcode_name(FUSE_MKDIR), \ + fuse_opcode_name(FUSE_UNLINK), \ + fuse_opcode_name(FUSE_RMDIR), \ + fuse_opcode_name(FUSE_RENAME), \ + fuse_opcode_name(FUSE_LINK), \ + fuse_opcode_name(FUSE_OPEN), \ + fuse_opcode_name(FUSE_READ), \ + fuse_opcode_name(FUSE_WRITE), \ + fuse_opcode_name(FUSE_STATFS), \ + fuse_opcode_name(FUSE_RELEASE), \ + fuse_opcode_name(FUSE_FSYNC), \ + fuse_opcode_name(FUSE_SETXATTR), \ + fuse_opcode_name(FUSE_GETXATTR), \ + fuse_opcode_name(FUSE_LISTXATTR), \ + fuse_opcode_name(FUSE_REMOVEXATTR), \ + fuse_opcode_name(FUSE_FLUSH), \ + fuse_opcode_name(FUSE_INIT), \ + fuse_opcode_name(FUSE_OPENDIR), \ + fuse_opcode_name(FUSE_READDIR), \ + fuse_opcode_name(FUSE_RELEASEDIR), \ + fuse_opcode_name(FUSE_FSYNCDIR), \ + fuse_opcode_name(FUSE_GETLK), \ + fuse_opcode_name(FUSE_SETLK), \ + fuse_opcode_name(FUSE_SETLKW), \ + fuse_opcode_name(FUSE_ACCESS), \ + fuse_opcode_name(FUSE_CREATE), \ + fuse_opcode_name(FUSE_INTERRUPT), \ + fuse_opcode_name(FUSE_BMAP), \ + fuse_opcode_name(FUSE_DESTROY), \ + fuse_opcode_name(FUSE_IOCTL), \ + fuse_opcode_name(FUSE_POLL), \ + fuse_opcode_name(FUSE_NOTIFY_REPLY), \ + fuse_opcode_name(FUSE_BATCH_FORGET), \ + fuse_opcode_name(FUSE_FALLOCATE), \ + fuse_opcode_name(FUSE_READDIRPLUS), \ + fuse_opcode_name(FUSE_RENAME2), \ + fuse_opcode_name(FUSE_LSEEK), \ + fuse_opcode_name(FUSE_COPY_FILE_RANGE), \ + fuse_opcode_name(FUSE_SETUPMAPPING), \ + fuse_opcode_name(FUSE_REMOVEMAPPING)) + +#define show_req_flag (flags) __print_flags(flags, "|", \ + { (1UL << FR_ISREPLY), "ISREPLY"}, \ + { (1UL << FR_FORCE), "FORCE"}, \ + { (1UL << FR_BACKGROUND), "BACKGROUND"}, \ + { (1UL << FR_WAITING), "WAITING"}, \ + { (1UL << FR_ABORTED), "ABORTED"}, \ + { (1UL << FR_INTERRUPTED), "INTERRUPTED"}, \ + { (1UL << FR_LOCKED), "LOCKED"}, \ + { (1UL << FR_PENDING), "PENDING"}, \ + { (1UL << FR_SENT), "SENT"}, \ + { (1UL << FR_FINISHED), "FINISHED"}, \ + { (1UL << FR_PRIVATE), "PRIVATE"}) + +TRACE_EVENT (virtiofs_request_dispatched, + + TP_PROTO(uint32_t opcode, uint64_t unique, uint64_t nodeid, + uint32_t inlen, unsigned long flags, bool notify), + +TP_ARGS (opcode, unique, nodeid, inlen, flags, notify), + +TP_STRUCT__entry ( + __field(uint32_t, opcode) + __field(uint64_t, unique) + __field(uint64_t, nodeid) + __field(uint32_t, inlen) + __field(unsigned long, flags) +__field (bool, notify) + ), + +TP_fast_assign ( + __entry->opcode = opcode; + __entry->unique = unique; + __entry->nodeid = nodeid; + __entry->inlen = inlen; + __entry->flags = flags; + __entry->notify = notify; + ), + +TP_printk ("opcode %s unique %#llx nodeid %#llx in.len %u flags %s notify %d\n" , +show_opcode_name (__entry->opcode), + __entry->unique, __entry->nodeid, + __entry->inlen,show_req_flag (__entry->flags), + __entry->notify) +); + +TRACE_EVENT (virtiofs_request_done, + + TP_PROTO(uint32_t opcode, uint64_t unique, uint64_t nodeid, + uint32_t inlen, unsigned long flags), + +TP_ARGS (opcode, unique, nodeid, inlen, flags), + +TP_STRUCT__entry ( + __field(uint32_t, opcode) + __field(uint64_t, unique) + __field(uint64_t, nodeid) + __field(uint32_t, inlen) + __field(unsigned long, flags) + ), + +TP_fast_assign ( + __entry->opcode = opcode; + __entry->unique = unique; + __entry->nodeid = nodeid; + __entry->inlen = inlen; + __entry->flags = flags; + ), + +TP_printk ("opcode %s unique %#llx nodeid %#llx in.len %u flags %s\n" , +show_opcode_name (__entry->opcode), + __entry->unique, __entry->nodeid, + __entry->inlen,show_req_flag (__entry->flags)) +); + +TRACE_EVENT (virtiofs_hiprio_request_dispatched, + + TP_PROTO(uint32_t opcode, uint64_t unique, uint64_t nodeid, + uint32_t inlen, bool notify), + +TP_ARGS (opcode, unique, nodeid, inlen, notify), + +TP_STRUCT__entry ( + __field(uint32_t, opcode) + __field(uint64_t, unique) + __field(uint64_t, nodeid) + __field(uint32_t, inlen) +__field (bool, notify) + ), + +TP_fast_assign ( + __entry->opcode = opcode; + __entry->unique = unique; + __entry->nodeid = nodeid; + __entry->inlen = inlen; + __entry->notify = notify; + ), + +TP_printk ("opcode %s unique %#llx nodeid %#llx in.len %u notify %d\n" , +show_opcode_name (__entry->opcode), + __entry->unique, __entry->nodeid, + __entry->inlen, __entry->notify) +); + +TRACE_EVENT (virtiofs_hiprio_request_done, + + TP_PROTO(uint32_t opcode, uint64_t unique, uint64_t nodeid, + uint32_t inlen), + +TP_ARGS (opcode, unique, nodeid, inlen), + +TP_STRUCT__entry ( + __field(uint32_t, opcode) + __field(uint64_t, unique) + __field(uint64_t, nodeid) +__field (uint32_t, inlen) + ), + +TP_fast_assign ( + __entry->opcode = opcode; + __entry->unique = unique; + __entry->nodeid = nodeid; + __entry->inlen = inlen; + ), + +TP_printk ("opcode %s unique %#llx nodeid %#llx in.len %u\n" , +show_opcode_name (__entry->opcode), + __entry->unique, __entry->nodeid, + __entry->inlen) +); + +#endif /* _TRACE_VIRTIOFS_H */ + +/* This part must be outside protection */ +#include <trace/define_trace.h> Signature · 6 lines
2.18.1 _______________________________________________ Virtio-fs mailing list [email protected] https://www.redhat.com/mailman/listinfo/virtio-fs
RFC PATCH 2/2 virtio-fs: add tracepoints
In reply to Masayoshi MizumaFrom: Masayoshi Mizuma <[email protected]>
Add tracepoint to the following function. It will be useful to debug the I/O request flow.
- virtio_fs_enqueue_req
- virtio_fs_requests_done_work
- virtio_fs_hiprio_dispatch_work
- virtio_fs_hiprio_done_work
Example of the trace record:
cat-1420 [002] .... 34.687462: virtiofs_request_dispatched: opcode
FUSE_READ unique 0x1a nodeid 0x2 in.len 80 flags ISREPLY|WAITING|SENT
notify 1
kworker/4:1-67 [004] .... 34.687531: virtiofs_request_done: opcode FUSE_READ
unique 0x1a nodeid 0x2 in.len 80 flags ISREPLY|WAITING--- fs/fuse/virtio_fs.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
fs/fuse/virtio_fs.c +21 -0
@@ -14,6 +14,9 @@#include <linux/delay.h> #include "fuse_i.h" +#define CREATE_TRACE_POINTS +#include <trace/events/virtiofs.h> +/* List of virtio-fs device instances and a lock for the list */ static DEFINE_MUTEX (virtio_fs_mutex);static LIST_HEAD (virtio_fs_instances);
@@ -175,6 +178,7 @@ static void virtio_fs_hiprio_done_work(struct work_struct *work) struct virtio_fs_vq *fsvq = container_of(work, struct virtio_fs_vq, done_work);struct virtqueue *vq = fsvq->vq; +struct virtio_fs_forget *forget;/* Free completed FUSE_FORGET requests */ spin_lock (&fsvq->lock);
@@ -185,6 +189,10 @@ static void virtio_fs_hiprio_done_work(struct work_struct *work)virtqueue_disable_cb (vq);while ((req =virtqueue_get_buf (vq, &len)) !=NULL ) { + forget = (struct virtio_fs_forget *)req; +trace_virtiofs_hiprio_request_done ( + forget->ih.opcode, forget->ih.unique, + forget->ih.nodeid, forget->ih.len);kfree (req); fsvq->in_flight--; }
@@ -251,6 +259,11 @@ static void virtio_fs_hiprio_dispatch_work(struct work_struct *work) notify =virtqueue_kick_prepare (vq);spin_unlock (&fsvq->lock); +trace_virtiofs_hiprio_request_dispatched ( + forget->ih.opcode, forget->ih.unique, + forget->ih.nodeid, forget->ih.len, + notify); +if (notify)virtqueue_notify (vq);pr_debug ("worker virtio_fs_hiprio_dispatch_work() dispatched one forget request.\n" );
@@ -364,6 +377,10 @@ static void virtio_fs_requests_done_work(struct work_struct *work)list_del_init (&req->list);spin_unlock (&fpq->lock); +trace_virtiofs_request_done ( + req->in.h.opcode, req->in.h.unique, + req->in.h.nodeid, req->in.h.len, req->flags); +fuse_request_end (fc, req); } }
@@ -914,6 +931,10 @@ static int virtio_fs_enqueue_req(struct virtqueue *vq, struct fuse_req *req)spin_unlock (&fsvq->lock); +trace_virtiofs_request_dispatched ( + req->in.h.opcode, req->in.h.unique, + req->in.h.nodeid, req->in.h.len, req->flags, notify); +if (notify)virtqueue_notify (vq);
Signature · 1 line
2.18.1
Stefan Hajnoczi
maintainerQuoted 28 lines · Masayoshi Mizuma
From: Masayoshi Mizuma <[email protected]>
This patch series introduce some tracepoints. It will be useful to debug the I/O request flow.
New trace events:
-
virtiofs_request_dispatched
-virtiofs_request_done
-virtiofs_hiprio_request_dispatched
-virtiofs_hiprio_request_doneAbove trace events is added to the following functions as the tracepoints:
-
virtio_fs_enqueue_req
-virtio_fs_requests_done_work
-virtio_fs_hiprio_dispatch_work
-virtio_fs_hiprio_done_workExample of the trace record:
cat-1420 [002] .... 34.687462:
virtiofs_request_dispatched: opcodeFUSE_READ unique 0x1a nodeid 0x2 in.len 80 flags ISREPLY|WAITING|SENT notify 1 kworker/4:1-67 [004] .... 34.687531: virtiofs_request_done: opcode FUSE_READ unique 0x1a nodeid 0x2 in.len 80 flags ISREPLY|WAITING
Quoted 8 lines
Masayoshi Mizuma (2):
add ftrace events
add tracepointsfs/fuse/virtio_fs.c | 21 ++++ include/trace/events/virtiofs.h | 195 ++++++++++++++++++++++++++++++++ 2 files changed, 216 insertions(+) create mode 100644 include/trace/events/virtiofs.h
Looks good. Two suggestions although I don't have a strong opinion:
1. Please use "virtio_fs" instead of "virtiofs" for consistency with the existing kernel code.
2. Please consider adding generic fuse.ko trace events for the request lifecycle so both traditional FUSE and virtio-fs can benefit. The argument against this is that your patches correspond more closely to virtqueue activity than tracepoints in the shared FUSE code, but I wanted to mention the idea.
Hi Stefan,
Quoted 38 lines · Stefan Hajnoczi
Quoted 28 lines · Masayoshi Mizuma
From: Masayoshi Mizuma <[email protected]>
This patch series introduce some tracepoints. It will be useful to debug the I/O request flow.
New trace events:
-
virtiofs_request_dispatched
-virtiofs_request_done
-virtiofs_hiprio_request_dispatched
-virtiofs_hiprio_request_doneAbove trace events is added to the following functions as the tracepoints:
-
virtio_fs_enqueue_req
-virtio_fs_requests_done_work
-virtio_fs_hiprio_dispatch_work
-virtio_fs_hiprio_done_workExample of the trace record:
cat-1420 [002] .... 34.687462:
virtiofs_request_dispatched: opcodeFUSE_READ unique 0x1a nodeid 0x2 in.len 80 flags ISREPLY|WAITING|SENT notify 1 kworker/4:1-67 [004] .... 34.687531: virtiofs_request_done: opcode FUSE_READ unique 0x1a nodeid 0x2 in.len 80 flags ISREPLY|WAITINGQuoted 8 lines
Masayoshi Mizuma (2):
add ftrace events
add tracepointsfs/fuse/virtio_fs.c | 21 ++++ include/trace/events/virtiofs.h | 195 ++++++++++++++++++++++++++++++++ 2 files changed, 216 insertions(+) create mode 100644 include/trace/events/virtiofs.h
Quoted 4 lines
Looks good. Two suggestions although I don't have a strong opinion:
1. Please use "
virtio_fs" instead of "virtiofs" for consistency with the existing kernel code.
OK, I use virtio_fs.
Quoted 6 lines
2. Please consider adding generic fuse.ko trace events for the request lifecycle so both traditional FUSE and virtio-fs can benefit. The argument against this is that your patches correspond more closely to virtqueue activity than tracepoints in the shared FUSE code, but I wanted to mention the idea.
Yeah, it's a good idea to add generic fuse.ko trace events.
Thanks!
Masa