linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Zanussi <zanussi@kernel.org>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: rostedt@goodmis.org, axelrasmussen@google.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 4/7] tracing: Add support for dynamic strings to synthetic events
Date: Thu, 08 Oct 2020 15:33:41 -0500	[thread overview]
Message-ID: <dce75e64b996c9d676376440a9acf087395eec99.camel@kernel.org> (raw)
In-Reply-To: <20201008182207.7526e70da842a01e373dd8cd@kernel.org>

Hi Masami,

On Thu, 2020-10-08 at 18:22 +0900, Masami Hiramatsu wrote:
> 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

Yes, I need to add an error message for this (as well as others in this
file).

> 
> /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 # 
> 

Yes, only the format needs to have the __data_loc, but the event
description shouldn't.

> - 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;
> 

Yes, I think all these other errors boil down to allowing illegal
names.  Applying your is_good_name() function for probe events to these
fields should get rid of them.

> 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.
> 

I should have patches addressing all of these shortly, tomorrow at the
latest.

Thanks,

Tom

> Thank you,
> 
> 


  parent reply	other threads:[~2020-10-08 20:33 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
2020-10-08 19:21     ` Steven Rostedt
2020-10-09 11:15       ` Masami Hiramatsu
2020-10-08 20:33     ` Tom Zanussi [this message]
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=dce75e64b996c9d676376440a9acf087395eec99.camel@kernel.org \
    --to=zanussi@kernel.org \
    --cc=axelrasmussen@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.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).