All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Tom Zanussi <tom.zanussi@linux.intel.com>
Cc: rostedt@goodmis.org, tglx@linutronix.de, mhiramat@kernel.org,
	namhyung@kernel.org, vedang.patel@intel.com,
	bigeasy@linutronix.de, joel.opensrc@gmail.com, joelaf@google.com,
	mathieu.desnoyers@efficios.com, baohong.liu@intel.com,
	rajvi.jingar@intel.com, julia@ni.com, fengguang.wu@intel.com,
	linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org
Subject: Re: [PATCH 3/4] tracing: Add action comparisons when testing matching hist triggers
Date: Tue, 3 Apr 2018 00:10:25 +0900	[thread overview]
Message-ID: <20180403001025.6dfed9403d50d20104e54458@kernel.org> (raw)
In-Reply-To: <a7fd668b87ec10736c8f016ac4279c8480d50c2b.1522256721.git.tom.zanussi@linux.intel.com>

On Wed, 28 Mar 2018 15:10:55 -0500
Tom Zanussi <tom.zanussi@linux.intel.com> wrote:

> Actions also need to be considered when checking for matching triggers
> - triggers differing only by action should be allowed, but currently
> aren't because the matching check ignores the action and erroneously
> returns -EEXIST.

Hi Tom,

Could you show us the bad/good examples (maybe different onmatch() actions)?
And if it is real bugfix, I would like to add a ftracetest testcase for this fix.

Thank you,

> 
> Add and call an actions_match() function to address that.
> 
> Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
> ---
>  kernel/trace/trace_events_hist.c | 50 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 50 insertions(+)
> 
> diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
> index 468e43f..ae84470 100644
> --- a/kernel/trace/trace_events_hist.c
> +++ b/kernel/trace/trace_events_hist.c
> @@ -4363,6 +4363,53 @@ static void print_onmatch_spec(struct seq_file *m,
>  	seq_puts(m, ")");
>  }
>  
> +static bool actions_match(struct hist_trigger_data *hist_data,
> +			  struct hist_trigger_data *hist_data_test)
> +{
> +	unsigned int i, j;
> +
> +	if (hist_data->n_actions != hist_data_test->n_actions)
> +		return false;
> +
> +	for (i = 0; i < hist_data->n_actions; i++) {
> +		struct action_data *data = hist_data->actions[i];
> +		struct action_data *data_test = hist_data_test->actions[i];
> +
> +		if (data->fn != data_test->fn)
> +			return false;
> +
> +		if (data->n_params != data_test->n_params)
> +			return false;
> +
> +		for (j = 0; j < data->n_params; j++) {
> +			if (strcmp(data->params[j], data_test->params[j]) != 0)
> +				return false;
> +		}
> +
> +		if (data->fn == action_trace) {
> +			if (strcmp(data->onmatch.synth_event_name,
> +				   data_test->onmatch.synth_event_name) != 0)
> +				return false;
> +			if (strcmp(data->onmatch.match_event_system,
> +				   data_test->onmatch.match_event_system) != 0)
> +				return false;
> +			if (strcmp(data->onmatch.match_event,
> +				   data_test->onmatch.match_event) != 0)
> +				return false;
> +		} else if (data->fn == onmax_save) {
> +			if (strcmp(data->onmax.var_str,
> +				   data_test->onmax.var_str) != 0)
> +				return false;
> +			if (strcmp(data->onmax.fn_name,
> +				   data_test->onmax.fn_name) != 0)
> +				return false;
> +		}
> +	}
> +
> +	return true;
> +}
> +
> +
>  static void print_actions_spec(struct seq_file *m,
>  			       struct hist_trigger_data *hist_data)
>  {
> @@ -5173,6 +5220,9 @@ static bool hist_trigger_match(struct event_trigger_data *data,
>  	    (strcmp(data->filter_str, data_test->filter_str) != 0))
>  		return false;
>  
> +	if (!actions_match(hist_data, hist_data_test))
> +		return false;
> +
>  	return true;
>  }
>  
> -- 
> 1.9.3
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

  reply	other threads:[~2018-04-02 15:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-28 20:10 [PATCH 0/4] tracing: A few inter-event bugfixes Tom Zanussi
2018-03-28 20:10 ` [PATCH 1/4] tracing: Fix display of hist trigger expressions containing timestamps Tom Zanussi
2018-03-28 20:10 ` [PATCH 2/4] tracing: Don't add flag strings when displaying variable references Tom Zanussi
2018-03-28 20:10 ` [PATCH 3/4] tracing: Add action comparisons when testing matching hist triggers Tom Zanussi
2018-04-02 15:10   ` Masami Hiramatsu [this message]
2018-04-02 17:09     ` Tom Zanussi
2018-04-04 12:33       ` Masami Hiramatsu
2018-04-04 13:01         ` Steven Rostedt
2018-04-04 15:17         ` Tom Zanussi
2018-04-05  3:50           ` Masami Hiramatsu
2018-04-05 23:34             ` Tom Zanussi
2018-04-06  1:53               ` Masami Hiramatsu
2018-04-06 16:47                 ` Tom Zanussi
2018-04-07 12:16                   ` Masami Hiramatsu
2018-04-12 15:22                     ` Tom Zanussi
2018-03-28 20:10 ` [PATCH 4/4] tracing: Make sure variable string fields are NULL-terminated Tom Zanussi
2018-04-02 15:26 ` [PATCH 0/4] tracing: A few inter-event bugfixes 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=20180403001025.6dfed9403d50d20104e54458@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=baohong.liu@intel.com \
    --cc=bigeasy@linutronix.de \
    --cc=fengguang.wu@intel.com \
    --cc=joel.opensrc@gmail.com \
    --cc=joelaf@google.com \
    --cc=julia@ni.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=namhyung@kernel.org \
    --cc=rajvi.jingar@intel.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=tom.zanussi@linux.intel.com \
    --cc=vedang.patel@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.