From: Ritesh Harjani <riteshh@linux.ibm.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-ext4@vger.kernel.org, Jan Kara <jack@suse.cz>,
"Theodore Ts'o" <tytso@mit.edu>,
Harshad Shirwadkar <harshadshirwadkar@gmail.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCHv2 00/10] ext4: Improve FC trace events
Date: Fri, 11 Mar 2022 10:42:49 +0530 [thread overview]
Message-ID: <20220311051249.ltgqbjjothbrkbno@riteshh-domain> (raw)
In-Reply-To: <20220310233234.4418186a@gandalf.local.home>
On 22/03/10 11:32PM, Steven Rostedt wrote:
> On Fri, 11 Mar 2022 08:44:31 +0530
> Ritesh Harjani <riteshh@linux.ibm.com> wrote:
>
> > > I could update it to do so though.
> >
> > Please let me know if you have any patch for me to try.
>
> Can you try this?
Thanks a lot Steve for quick patch.
I tested your patch and it seems to be working fine.
Below are the details -
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[9]; offset:12; size:36; signed:0;
^^^^ It's now taking the enum value of EXT4_FC_REASON_MAX in array field too.
Also output from trace-cmd and perf script shows the right data
xfs_io 1856 [000] 173.411127: 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:2, INODE_JOURNAL_DATA:0 num_commits:0, ineligible: 1, numblks: 0
>
> -- Steve
>
> From 392b91c598da2a8c5bbaebad08cd0410f4607bf4 Mon Sep 17 00:00:00 2001
> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> Date: Thu, 10 Mar 2022 23:27:38 -0500
> Subject: [PATCH] tracing: Have TRACE_DEFINE_ENUM affect trace event types as
> well
>
> The macro TRACE_DEFINE_ENUM is used to convert enums in the kernel to
> their actual value when they are exported to user space via the trace
> event format file.
>
> Currently only the enums in the "print fmt" (TP_printk in the TRACE_EVENT
> macro) have the enums converted. But the enums can be used to denote array
> size:
>
> field:unsigned int fc_ineligible_rc[EXT4_FC_REASON_MAX]; offset:12; size:36; signed:0;
>
> The EXT4_FC_REASON_MAX has no meaning to userspace but it needs to know
> that information to know how to parse the array.
>
> Have the array indexes also be parsed as well.
>
> Link: https://lore.kernel.org/all/cover.1646922487.git.riteshh@linux.ibm.com/
>
> Reported-by: Ritesh Harjani <riteshh@linux.ibm.com>
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
> kernel/trace/trace_events.c | 28 ++++++++++++++++++++++++++++
> 1 file changed, 28 insertions(+)
You may add below, if you like:-
Reported-and-tested-by: Ritesh Harjani <riteshh@linux.ibm.com>
-ritesh
>
> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index 38afd66d80e3..ae9a3b8481f5 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -2633,6 +2633,33 @@ static void update_event_printk(struct trace_event_call *call,
> }
> }
>
> +static void update_event_fields(struct trace_event_call *call,
> + struct trace_eval_map *map)
> +{
> + struct ftrace_event_field *field;
> + struct list_head *head;
> + char *ptr;
> + int len = strlen(map->eval_string);
> +
> + head = trace_get_fields(call);
> + list_for_each_entry(field, head, link) {
> + ptr = strchr(field->type, '[');
> + if (!ptr)
> + continue;
> + ptr++;
> +
> + if (!isalpha(*ptr) && *ptr != '_')
> + continue;
> +
> + if (strncmp(map->eval_string, ptr, len) != 0)
> + continue;
> +
> + ptr = eval_replace(ptr, map, len);
> + /* enum/sizeof string smaller than value */
> + WARN_ON_ONCE(!ptr);
> + }
> +}
> +
> void trace_event_eval_update(struct trace_eval_map **map, int len)
> {
> struct trace_event_call *call, *p;
> @@ -2668,6 +2695,7 @@ void trace_event_eval_update(struct trace_eval_map **map, int len)
> first = false;
> }
> update_event_printk(call, map[i]);
> + update_event_fields(call, map[i]);
> }
> }
> }
> --
> 2.34.1
>
next prev parent reply other threads:[~2022-03-11 5:13 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-10 15:58 [PATCHv2 00/10] ext4: Improve FC trace events Ritesh Harjani
2022-03-10 15:58 ` [PATCHv2 01/10] ext4: Remove unused enum EXT4_FC_COMMIT_FAILED Ritesh Harjani
2022-03-10 15:58 ` [PATCHv2 02/10] ext4: Fix ext4_fc_stats trace point Ritesh Harjani
2022-03-10 15:58 ` [PATCHv2 03/10] ext4: Convert ext4_fc_track_dentry type events to use event class Ritesh Harjani
2022-03-10 15:58 ` [PATCHv2 04/10] ext4: Do not call FC trace event in ext4_fc_commit() if FS does not support FC Ritesh Harjani
2022-03-10 15:58 ` [PATCHv2 05/10] ext4: Return early for non-eligible fast_commit track events Ritesh Harjani
2022-03-10 15:59 ` [PATCHv2 06/10] ext4: Add new trace event in ext4_fc_cleanup Ritesh Harjani
2022-03-10 15:59 ` [PATCHv2 07/10] ext4: Add transaction tid info in fc_track events Ritesh Harjani
2022-03-10 15:59 ` [PATCHv2 08/10] ext4: Add commit_tid info in jbd debug log Ritesh Harjani
2022-03-10 15:59 ` [PATCHv2 09/10] ext4: Add commit tid info in ext4_fc_commit_start/stop trace events Ritesh Harjani
2022-03-10 15:59 ` [PATCHv2 10/10] ext4: Fix remaining two trace events to use same printk convention Ritesh Harjani
2022-03-10 16:05 ` [PATCHv2 00/10] ext4: Improve FC trace events Steven Rostedt
2022-03-10 17:07 ` Ritesh Harjani
2022-03-11 0:39 ` Steven Rostedt
2022-03-11 2:19 ` Ritesh Harjani
2022-03-11 2:33 ` Steven Rostedt
2022-03-11 3:14 ` Ritesh Harjani
2022-03-11 4:32 ` Steven Rostedt
2022-03-11 5:12 ` Ritesh Harjani [this message]
2022-03-11 14:45 ` Steven Rostedt
2022-03-11 15:03 ` Ritesh Harjani
2022-03-11 16:42 ` Steven Rostedt
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 \
--in-reply-to=20220311051249.ltgqbjjothbrkbno@riteshh-domain \
--to=riteshh@linux.ibm.com \
--cc=harshadshirwadkar@gmail.com \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tytso@mit.edu \
/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