From: Masami Hiramatsu <mhiramat@kernel.org>
To: Tom Zanussi <zanussi@kernel.org>
Cc: rostedt@goodmis.org, axelrasmussen@google.com,
mhiramat@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 4/7] tracing: Add support for dynamic strings to synthetic events
Date: Thu, 8 Oct 2020 18:22:07 +0900 [thread overview]
Message-ID: <20201008182207.7526e70da842a01e373dd8cd@kernel.org> (raw)
In-Reply-To: <3ed35b6d0e390f5b94cb4a9ba1cc18f5982ab277.1601848695.git.zanussi@kernel.org>
Hi Tom,
On Sun, 4 Oct 2020 17:14:06 -0500
Tom Zanussi <zanussi@kernel.org> wrote:
> Currently, sythetic events only support static string fields such as:
>
> # echo 'test_latency u64 lat; char somename[32]' > /sys/kernel/debug/tracing/synthetic_events
>
> Which is fine, but wastes a lot of space in the event.
>
> It also prevents the most commonly-defined strings in the existing
> trace events e.g. those defined using __string(), from being passed to
> synthetic events via the trace() action.
>
> With this change, synthetic events with dynamic fields can be defined:
>
> # echo 'test_latency u64 lat; char somename[]' > /sys/kernel/debug/tracing/synthetic_events
>
> And the trace() action can be used to generate events using either
> dynamic or static strings:
>
> # echo 'hist:keys=name:lat=common_timestamp.usecs-$ts0:onmatch(sys.event).test_latency($lat,name)' > /sys/kernel/debug/tracing/events
>
> The synthetic event dynamic strings are implemented in the same way as
> the existing __data_loc strings and appear as such in the format file.
>
> [ <rostedt@goodmis.org>: added __set_synth_event_print_fmt() changes:
>
> I added the following to make it work with trace-cmd. Dynamic strings
> must have __get_str() for events in the print_fmt otherwise it can't be
> parsed correctly. ]
I confirmed this works, but have some questions;
- It seems no error message when we failed to define with wrong syntax
/sys/kernel/debug/tracing # echo 'myevent char name []' >> synthetic_events
sh: write error: Invalid argument
/sys/kernel/debug/tracing # cat error_log
/sys/kernel/debug/tracing #
- what we write and what we see in synthetic_events are different
/sys/kernel/debug/tracing # echo 'myevent char name[]' >> synthetic_events
/sys/kernel/debug/tracing # cat synthetic_events
myevent __data_loc char[] name
- And it is not able to re-define with that syntax
/sys/kernel/debug/tracing # echo > synthetic_events
/sys/kernel/debug/tracing # echo 'myevent __data_loc char[] name' >> synthetic_events
sh: write error: Invalid argument
/sys/kernel/debug/tracing #
- It seems to accept wrong name for variables
/sys/kernel/debug/tracing # echo 'myevent char name]' >> synthetic_events
/sys/kernel/debug/tracing # echo 'myevent2 char name;[]' >> synthetic_events
/sys/kernel/debug/tracing # cat synthetic_events
myevent char name]
myevent2 __data_loc char[] name;
Some of those issues are not introduced from this series. I think
we'd better fix those before introducing this series so that
we can backport it to stable kernels.
Thank you,
--
Masami Hiramatsu <mhiramat@kernel.org>
next prev parent reply other threads:[~2020-10-08 9:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-04 22:14 [PATCH v4 0/7] tracing: Add dynamic strings for synthetic events Tom Zanussi
2020-10-04 22:14 ` [PATCH v4 1/7] tracing: Change STR_VAR_MAX_LEN Tom Zanussi
2020-10-04 22:14 ` [PATCH v4 2/7] tracing: Fix parse_synth_field() error handling Tom Zanussi
2020-10-04 22:14 ` [PATCH v4 3/7] tracing: Save normal string variables Tom Zanussi
2020-10-04 22:14 ` [PATCH v4 4/7] tracing: Add support for dynamic strings to synthetic events Tom Zanussi
2020-10-08 9:22 ` Masami Hiramatsu [this message]
2020-10-08 19:21 ` Steven Rostedt
2020-10-09 11:15 ` Masami Hiramatsu
2020-10-08 20:33 ` Tom Zanussi
2020-10-04 22:14 ` [PATCH v4 5/7] tracing: Add README information for synthetic_events file Tom Zanussi
2020-10-08 0:38 ` Masami Hiramatsu
2020-10-04 22:14 ` [PATCH v4 6/7] selftests/ftrace: Add test case for synthetic event dynamic strings Tom Zanussi
2020-10-08 0:21 ` Masami Hiramatsu
2020-10-04 22:14 ` [PATCH v4 7/7] tracing: Change synthetic event string format to limit printed length Tom Zanussi
2020-10-05 22:17 ` Steven Rostedt
2020-10-07 14:24 ` Tom Zanussi
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=20201008182207.7526e70da842a01e373dd8cd@kernel.org \
--to=mhiramat@kernel.org \
--cc=axelrasmussen@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=zanussi@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).