linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Tom Zanussi <zanussi@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>
Subject: Re: [PATCH v2 2/2] tracing: Allow execnames to be passed as args for synthetic events
Date: Sun, 25 Jul 2021 11:18:30 +0900	[thread overview]
Message-ID: <20210725111830.2f424ae3978443241b6d4a2d@kernel.org> (raw)
In-Reply-To: <20210724193145.c63b44aa843e05ed9c0b4fdc@kernel.org>

Hi,

On Sat, 24 Jul 2021 19:31:45 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:

> Hi Steve,
> 
> On Thu, 22 Jul 2021 21:24:38 -0400
> Steven Rostedt <rostedt@goodmis.org> wrote:
> 
> > On Fri, 23 Jul 2021 10:11:33 +0900
> > Masami Hiramatsu <mhiramat@kernel.org> wrote:
> > 
> > > I understand. As far as I can see the code, it looks a bit complicated.
> > > To simplify it, I need to understand the spec for "hist_field"
> > > for keys and for vars. And maybe need to split both case.
> > 
> > I'll give you a hint that took me a bit to figure out.
> > 
> > 1) The execname is saved at the start of the histogram and not by one
> > of the ->fn() functions.
> > 
> > It's saved by hist_trigger_elt_data_init() if the elt_data->comm is
> > allocated. That function is part of the "tracing_map_ops" which gets
> > assigned by tracing_map_create() (in tracing_map.c) as the "elt_init"
> > function, which is called when getting a new elt element by
> > get_free_elt().
> > 
> > 2) That elt_data->comm is only allocated if it finds a "hist_field"
> > that has HIST_FIELD_FL_EXECNAME flag set. It currently only looks for
> > that flag in the "keys" fields, which means that .execname is useless
> > for everything else. This patch changed it to search all hist_fields so
> > that it can find that flag if a variable has it set (which I added).
> 
> Thanks for the hints, but actually, that part looks good to me.
> 
> So, what I pointed was the part of update_var_execname(). Below diff
> is what I intended.
> This moves HIST_FIELD_FL_EXECNAME setup in the create_hist_field()
> as same as other flags, and removed the add-hoc update_var_execname()
> fixup function.
> 
> I confirmed it passed the ftracetest trigger testcases and your
> example code.
> 
> Thank you,
> 

I found a bug in this change.

[..]
> @@ -1682,6 +1703,16 @@ static struct hist_field *create_hist_field(struct hist_trigger_data *hist_data,
>  		goto out;
>  	}
>  
> +	if ((flags & HIST_FIELD_FL_EXECNAME) && var_name) {
> +		flags |= HIST_FIELD_FL_STRING | HIST_FIELD_FL_VAR;

Here, we don't need to check 'var_name' and remove HIST_FIELD_FL_VAR, since it must be set in the flag.

	if (flags & HIST_FIELD_FL_EXECNAME) {
		flags |= HIST_FIELD_FL_STRING;


> +		hist_field->size = MAX_FILTER_STR_VAL;
> +		hist_field->is_signed = 0;
> +
> +		hist_field->type = "char[]";
> +		hist_field->fn = hist_field_execname;
> +		goto out;
> +	}
> +



Thank you,


-- 
Masami Hiramatsu <mhiramat@kernel.org>

  reply	other threads:[~2021-07-25  2:18 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-22 14:27 [PATCH v2 0/2] tracing: Allow execnames to be passed as args for synthetic events Steven Rostedt
2021-07-22 14:27 ` [PATCH v2 1/2] tracing: Have histogram types be constant when possible Steven Rostedt
2021-07-22 15:24   ` Masami Hiramatsu
2021-07-22 22:11   ` Tom Zanussi
2021-07-22 14:27 ` [PATCH v2 2/2] tracing: Allow execnames to be passed as args for synthetic events Steven Rostedt
2021-07-22 16:19   ` Masami Hiramatsu
2021-07-22 16:32     ` Steven Rostedt
2021-07-23  1:11       ` Masami Hiramatsu
2021-07-23  1:22         ` Masami Hiramatsu
2021-07-23  1:26           ` Steven Rostedt
2021-07-23  1:24         ` Steven Rostedt
2021-07-24 10:31           ` Masami Hiramatsu
2021-07-25  2:18             ` Masami Hiramatsu [this message]
2021-07-25  3:45               ` Masami Hiramatsu
2021-07-26 13:28                 ` Steven Rostedt
2021-07-27 22:54                   ` Masami Hiramatsu
2021-07-22 22:09   ` Tom Zanussi
2021-07-22 15:14 ` [PATCH v2 0/2] " 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=20210725111830.2f424ae3978443241b6d4a2d@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@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).