On 22/03/10 07:39PM, Steven Rostedt wrote: > On Thu, 10 Mar 2022 22:37:31 +0530 > Ritesh Harjani <riteshh@xxxxxxxxxxxxx> wrote: > > > On 22/03/10 11:05AM, Steven Rostedt wrote: > > > On Thu, 10 Mar 2022 21:28:54 +0530 > > > Ritesh Harjani <riteshh@xxxxxxxxxxxxx> wrote: > > > > > > > Note:- I still couldn't figure out how to expose EXT4_FC_REASON_MAX in patch-2 > > > > which (I think) might be (only) needed by trace-cmd or perf record for trace_ext4_fc_stats. > > > > But it seems "cat /sys/kernel/debug/tracing/trace_pipe" gives the right output > > > > for ext4_fc_stats trace event (as shown below). > > > > > > > > So with above reasoning, do you think we should take these patches in? > > > > And we can later see how to provide EXT4_FC_REASON_MAX definition available to > > > > libtraceevent? > > > > > > I don't see EXT4_FC_REASON_MAX being used in the TP_printk(). If it isn't > > > used there, it doesn't need to be exposed. Or did I miss something? > > > > I was mentioning about EXT4_FC_REASON_MAX used in TP_STRUCT__entry. > > When I hard code EXT4_FC_REASON_MAX to 9 in TP_STRUCT__entry, I could > > see proper values using trace-cmd. Otherwise I see all 0 (when using trace-cmd > > or perf record). > > > > + TP_STRUCT__entry( > > + __field(dev_t, dev) > > + __array(unsigned int, fc_ineligible_rc, EXT4_FC_REASON_MAX) > > Ah, I bet it's showing up in the format portion and not the print fmt part > of the format file. > > Just to confirm, can you do the following: > > # cat /sys/kernel/tracing/events/ext4/ext4_fc_commit_stop/format I think you meant ext4_fc_stats. > > and show me what it outputs. root@qemu:/home/qemu# cat /sys/kernel/tracing/events/ext4/ext4_fc_stats/format name: ext4_fc_stats ID: 986 format: field:unsigned short common_type; offset:0; size:2; signed:0; field:unsigned char common_flags; offset:2; size:1; signed:0; field:unsigned char common_preempt_count; offset:3; size:1; signed:0; field:int common_pid; offset:4; size:4; signed:1; field:dev_t dev; offset:8; size:4; signed:0; field:unsigned int fc_ineligible_rc[EXT4_FC_REASON_MAX]; offset:12; size:36; signed:0; field:unsigned long fc_commits; offset:48; size:8; signed:0; field:unsigned long fc_ineligible_commits; offset:56; size:8; signed:0; field:unsigned long fc_numblks; offset:64; size:8; signed:0; print fmt: "dev %d,%d fc ineligible reasons: %s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u num_commits:%lu, ineligible: %lu, numblks: %lu", ((unsigned int) ((REC->dev) >> 20)), ((unsigned int) ((REC->dev) & ((1U << 20) - 1))), __print_symbolic(0, { 0, "XATTR"}, { 1, "CROSS_RENAME"}, { 2, "JOURNAL_FLAG_CHANGE"}, { 3, "NO_MEM"}, { 4, "SWAP_BOOT"}, { 5, "RESIZE"}, { 6, "RENAME_DIR"}, { 7, "FALLOC_RANGE"}, { 8, "INODE_JOURNAL_DATA"}), REC->fc_ineligible_rc[0], __print_symbolic(1, { 0, "XATTR"}, { 1, "CROSS_RENAME"}, { 2, "JOURNAL_FLAG_CHANGE"}, { 3, "NO_MEM"}, { 4, "SWAP_BOOT"}, { 5, "RESIZE"}, { 6, "RENAME_DIR"}, { 7, "FALLOC_RANGE"}, { 8, "INODE_JOURNAL_DATA"}), REC->fc_ineligible_rc[1], __print_symbolic(2, { 0, "XATTR"}, { 1, "CROSS_RENAME"}, { 2, "JOURNAL_FLAG_CHANGE"}, { 3, "NO_MEM"}, { 4, "SWAP_BOOT"}, { 5, "RESIZE"}, { 6, "RENAME_DIR"}, { 7, "FALLOC_RANGE"}, { 8, "INODE_JOURNAL_DATA"}), REC->fc_ineligible_rc[2], __print_symbolic(3, { 0, "XATTR"}, { 1, "CROSS_RENAME"}, { 2, "JOURNAL_FLAG_CHANGE"}, { 3, "NO_MEM"}, { 4, "SWAP_BOOT"}, { 5, "RESIZE"}, { 6, "RENAME_DIR"}, { 7, "FALLOC_RANGE"}, { 8, "INODE_JOURNAL_DATA"}), REC->fc_ineligible_rc[3], __print_symbolic(4, { 0, "XATTR"}, { 1, "CROSS_RENAME"}, { 2, "JOURNAL_FLAG_CHANGE"}, { 3, "NO_MEM"}, { 4, "SWAP_BOOT"}, { 5, "RESIZE"}, { 6, "RENAME_DIR"}, { 7, "FALLOC_RANGE"}, { 8, "INODE_JOURNAL_DATA"}), REC->fc_ineligible_rc[4], __print_symbolic(5, { 0, "XATTR"}, { 1, "CROSS_RENAME"}, { 2, "JOURNAL_FLAG_CHANGE"}, { 3, "NO_MEM"}, { 4, "SWAP_BOOT"}, { 5, "RESIZE"}, { 6, "RENAME_DIR"}, { 7, "FALLOC_RANGE"}, { 8, "INODE_JOURNAL_DATA"}), REC->fc_ineligible_rc[5], __print_symbolic(6, { 0, "XATTR"}, { 1, "CROSS_RENAME"}, { 2, "JOURNAL_FLAG_CHANGE"}, { 3, "NO_MEM"}, { 4, "SWAP_BOOT"}, { 5, "RESIZE"}, { 6, "RENAME_DIR"}, { 7, "FALLOC_RANGE"}, { 8, "INODE_JOURNAL_DATA"}), REC->fc_ineligible_rc[6], __print_symbolic(7, { 0, "XATTR"}, { 1, "CROSS_RENAME"}, { 2, "JOURNAL_FLAG_CHANGE"}, { 3, "NO_MEM"}, { 4, "SWAP_BOOT"}, { 5, "RESIZE"}, { 6, "RENAME_DIR"}, { 7, "FALLOC_RANGE"}, { 8, "INODE_JOURNAL_DATA"}), REC->fc_ineligible_rc[7], __print_symbolic(8, { 0, "XATTR"}, { 1, "CROSS_RENAME"}, { 2, "JOURNAL_FLAG_CHANGE"}, { 3, "NO_MEM"}, { 4, "SWAP_BOOT"}, { 5, "RESIZE"}, { 6, "RENAME_DIR"}, { 7, "FALLOC_RANGE"}, { 8, "INODE_JOURNAL_DATA"}), REC->fc_ineligible_rc[8], REC->fc_commits, REC->fc_ineligible_commits, REC->fc_numblks output of ext4_fc_stats (FALLOC_RANGE:0 v/s FALLOC_RANGE:13) ========================================================================== <perf-report or trace-cmd report> xfs_io 8336 [003] 42950.923784: ext4:ext4_fc_stats: dev 7,2 fc ineligible reasons: XATTR:0, CROSS_RENAME:0, JOURNAL_FLAG_CHANGE:0, NO_MEM:0, SWAP_BOOT:0, RESIZE:0, RENAME_DIR:0, FALLOC_RANGE:0, INODE_JOURNAL_DATA:0 num_commits:22, ineligible: 12, numblks: 22 <cat /sys/kernel/debug/tracing/trace_pipe> xfs_io-8336 [003] ..... 42951.224155: ext4_fc_stats: dev 7,2 fc ineligible reasons: XATTR:0, CROSS_RENAME:0, JOURNAL_FLAG_CHANGE:0, NO_MEM:0, SWAP_BOOT:0, RESIZE:0, RENAME_DIR:0, FALLOC_RANGE:13, INODE_JOURNAL_DATA:0 num_commits:22, ineligible: 12, numblks: 22 Thanks -ritesh > > Thanks, > > -- Steve > > > > > > Should we anyway hard code this to 9. Since we are anyway printing all the > > 9 elements of array values individually. > > > > + TP_printk("dev %d,%d fc ineligible reasons:\n" > > + "%s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u " > > + "num_commits:%lu, ineligible: %lu, numblks: %lu", > > + MAJOR(__entry->dev), MINOR(__entry->dev), > > + FC_REASON_NAME_STAT(EXT4_FC_REASON_XATTR), > > + FC_REASON_NAME_STAT(EXT4_FC_REASON_CROSS_RENAME), > > + FC_REASON_NAME_STAT(EXT4_FC_REASON_JOURNAL_FLAG_CHANGE), > > + FC_REASON_NAME_STAT(EXT4_FC_REASON_NOMEM), > > + FC_REASON_NAME_STAT(EXT4_FC_REASON_SWAP_BOOT), > > + FC_REASON_NAME_STAT(EXT4_FC_REASON_RESIZE), > > + FC_REASON_NAME_STAT(EXT4_FC_REASON_RENAME_DIR), > > + FC_REASON_NAME_STAT(EXT4_FC_REASON_FALLOC_RANGE), > > + FC_REASON_NAME_STAT(EXT4_FC_REASON_INODE_JOURNAL_DATA), > > + __entry->fc_commits, __entry->fc_ineligible_commits, > > + __entry->fc_numblks) > > > > > > Thanks > > -ritesh >