Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1727044 > unrolled thread

[PATCH v2 19/40] tracing: Account for variables in named trigger compatibility

Started byTom Zanussi <tom.zanussi@linux.intel.com>
First post2017-09-06 00:10 +0200
Last post2017-09-07 19:10 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 19/40] tracing: Account for variables in named trigger compatibility Tom Zanussi <tom.zanussi@linux.intel.com> - 2017-09-06 00:10 +0200
    Re: [PATCH v2 19/40] tracing: Account for variables in named  trigger compatibility Steven Rostedt <rostedt@goodmis.org> - 2017-09-07 18:50 +0200
      Re: [PATCH v2 19/40] tracing: Account for variables in named  trigger compatibility Tom Zanussi <tom.zanussi@linux.intel.com> - 2017-09-07 19:10 +0200

#1727044 — [PATCH v2 19/40] tracing: Account for variables in named trigger compatibility

FromTom Zanussi <tom.zanussi@linux.intel.com>
Date2017-09-06 00:10 +0200
Subject[PATCH v2 19/40] tracing: Account for variables in named trigger compatibility
Message-ID<umucH-oz-69@gated-at.bofh.it>
Named triggers must also have the same set of variables in order to be
considered compatible - update the trigger match test to account for
that.

The reason for this requirement is that named triggers with variables
are meant to allow one or more events to set the same variable.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 kernel/trace/trace_events_hist.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index f60e8ee..3c4eae9 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -1598,7 +1598,7 @@ static int event_hist_trigger_print(struct seq_file *m,
 		sort_key = &hist_data->sort_keys[i];
 		idx = sort_key->field_idx;
 
-		if (WARN_ON(idx >= TRACING_MAP_FIELDS_MAX))
+		if (WARN_ON(idx >= HIST_FIELDS_MAX))
 			return -EINVAL;
 
 		if (i > 0)
@@ -1786,6 +1786,12 @@ static bool hist_trigger_match(struct event_trigger_data *data,
 			return false;
 		if (key_field->is_signed != key_field_test->is_signed)
 			return false;
+		if ((key_field->var.name && !key_field_test->var.name) ||
+		    (!key_field->var.name && key_field_test->var.name))
+			return false;
+		if ((key_field->var.name && key_field_test->var.name) &&
+		     strcmp(key_field->var.name, key_field_test->var.name) != 0)
+			return false;
 	}
 
 	for (i = 0; i < hist_data->n_sort_keys; i++) {
-- 
1.9.3

[toc] | [next] | [standalone]


#1728314 — Re: [PATCH v2 19/40] tracing: Account for variables in named trigger compatibility

FromSteven Rostedt <rostedt@goodmis.org>
Date2017-09-07 18:50 +0200
SubjectRe: [PATCH v2 19/40] tracing: Account for variables in named trigger compatibility
Message-ID<un8a6-2Cg-21@gated-at.bofh.it>
In reply to#1727044
On Tue,  5 Sep 2017 16:57:31 -0500
Tom Zanussi <tom.zanussi@linux.intel.com> wrote:

> @@ -1786,6 +1786,12 @@ static bool hist_trigger_match(struct event_trigger_data *data,
>  			return false;
>  		if (key_field->is_signed != key_field_test->is_signed)
>  			return false;
> +		if ((key_field->var.name && !key_field_test->var.name) ||
> +		    (!key_field->var.name && key_field_test->var.name))
> +			return false;

Short cut:

		if (!!key_field->var.name != !!key_field_test->var.name)
			return false;

> +		if ((key_field->var.name && key_field_test->var.name) &&

Only need to test if key_field->var.name, as the previous if statement
would exit out if key_field_test->var.name is false.

-- Steve

> +		     strcmp(key_field->var.name, key_field_test->var.name) != 0)
> +			return false;
>  	}
>  
>  	for (i = 0; i < hist_data->n_sort_keys; i++) {

[toc] | [prev] | [next] | [standalone]


#1728323 — Re: [PATCH v2 19/40] tracing: Account for variables in named trigger compatibility

FromTom Zanussi <tom.zanussi@linux.intel.com>
Date2017-09-07 19:10 +0200
SubjectRe: [PATCH v2 19/40] tracing: Account for variables in named trigger compatibility
Message-ID<un8ts-2XD-19@gated-at.bofh.it>
In reply to#1728314
On Thu, 2017-09-07 at 12:40 -0400, Steven Rostedt wrote:
> On Tue,  5 Sep 2017 16:57:31 -0500
> Tom Zanussi <tom.zanussi@linux.intel.com> wrote:
> 
> > @@ -1786,6 +1786,12 @@ static bool hist_trigger_match(struct event_trigger_data *data,
> >  			return false;
> >  		if (key_field->is_signed != key_field_test->is_signed)
> >  			return false;
> > +		if ((key_field->var.name && !key_field_test->var.name) ||
> > +		    (!key_field->var.name && key_field_test->var.name))
> > +			return false;
> 
> Short cut:
> 
> 		if (!!key_field->var.name != !!key_field_test->var.name)
> 			return false;
> 

Nice!

> > +		if ((key_field->var.name && key_field_test->var.name) &&
> 
> Only need to test if key_field->var.name, as the previous if statement
> would exit out if key_field_test->var.name is false.
> 

OK, will change, thanks.

Tom

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web