mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Jiri Olsa <jolsa@redhat.com>
Cc: fweisbec@gmail.com, mingo@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 09/10] tracing/filter: Change filter_match_preds function to use walk_pred_tree
Date: Wed, 10 Aug 2011 17:16:32 -0400	[thread overview]
Message-ID: <1313010992.18583.276.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <1313010869.18583.274.camel@gandalf.stny.rr.com>

On Wed, 2011-08-10 at 17:14 -0400, Steven Rostedt wrote:
> On Thu, 2011-08-04 at 12:08 +0200, Jiri Olsa wrote:
> > Changing filter_match_preds function to use unified predicates tree
> > processing.
> > 
> > Signed-off-by: Jiri Olsa <jolsa@redhat.com>
> > ---
> >  kernel/trace/trace_events_filter.c |  119 +++++++++++++++++-------------------
> >  1 files changed, 55 insertions(+), 64 deletions(-)
> > 
> > diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
> > index d4e0c09..55b13b9 100644
> > --- a/kernel/trace/trace_events_filter.c
> > +++ b/kernel/trace/trace_events_filter.c
> > @@ -467,6 +467,7 @@ static int process_ops(struct filter_pred *preds,
> >  
> >  	for (i = 0; i < op->val; i++) {
> >  		pred = &preds[op->ops[i]];
> > +		BUG_ON(!pred->fn);
> 
> Why the added BUG_ON()s? Do we really need to crash the kernel on error
> here?

I mean, could be instead have:

	if (!WARN_ON_ONCE(!pred->fn))
> >  		match = pred->fn(pred, rec);


> >  		if (!!match == type)
> >  			return match;
> > @@ -474,92 +475,82 @@ static int process_ops(struct filter_pred *preds,
> >  	return match;
> >  }
> >  
> > +struct filter_match_preds_data {
> > +	struct filter_pred *preds;
> > +	int match;
> > +	void *rec;
> > +};
> > +
> > +static int filter_match_preds_cb(enum move_type move, struct filter_pred *pred,
> > +				 int *err, void *data)
> > +{
> > +	struct filter_match_preds_data *d = data;
> > +
> > +	*err = 0;
> > +	switch (move) {
> > +	case MOVE_DOWN:
> > +		/* only AND and OR have children */
> > +		if (pred->left != FILTER_PRED_INVALID) {
> > +			/* If ops is set, then it was folded. */
> > +			if (!pred->ops)
> > +				return WALK_PRED_DEFAULT;
> > +			/* We can treat folded ops as a leaf node */
> > +			d->match = process_ops(d->preds, pred, d->rec);
> > +		} else {
> > +			BUG_ON(!pred->fn);

			if (!WARN_ON_ONCE(!pred->fn))
> > +			d->match = pred->fn(pred, d->rec);

-- Steve

> > +		}
> 



  reply	other threads:[~2011-08-10 21:16 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-04 10:08 [PATCH 0/10] ftrace/filter: Trace events filtering related fixies Jiri Olsa
2011-08-04 10:08 ` [PATCH 01/10] tracing/filter: Use static allocation for filter predicates Jiri Olsa
2011-08-04 10:08 ` [PATCH 02/10] tracing/filter: Separate predicate init and filter addition Jiri Olsa
2011-08-10 20:51   ` Steven Rostedt
2011-08-04 10:08 ` [PATCH 03/10] tracing/filter: Remove field_name from filter_pred struct Jiri Olsa
2011-08-04 10:08 ` [PATCH 04/10] tracing/filter: Simplify tracepoint event lookup Jiri Olsa
2011-08-04 10:08 ` [PATCH 05/10] tracing/filter: Unify predicate tree walking, change check_pred_tree function to use it Jiri Olsa
2011-08-04 10:08 ` [PATCH 06/10] tracing/filter: Change count_leafs function to use walk_pred_tree Jiri Olsa
2011-08-10 21:05   ` Steven Rostedt
2011-08-04 10:08 ` [PATCH 07/10] tracing/filter: Change fold_pred_tree " Jiri Olsa
2011-08-04 10:08 ` [PATCH 08/10] tracing/filter: Change fold_pred " Jiri Olsa
2011-08-04 10:08 ` [PATCH 09/10] tracing/filter: Change filter_match_preds " Jiri Olsa
2011-08-10 21:14   ` Steven Rostedt
2011-08-10 21:16     ` Steven Rostedt [this message]
2011-08-04 10:08 ` [PATCH 10/10] tracing/filter: Add startup tests for events filter Jiri Olsa
2011-08-04 11:22   ` [PATCHv2 " Jiri Olsa
2011-08-10 21:24     ` Steven Rostedt
2011-08-10 21:25 ` [PATCH 0/10] ftrace/filter: Trace events filtering related fixies Steven Rostedt
2011-08-11 14:21   ` Jiri Olsa
2011-08-11 14:25   ` [PATCHv2 " Jiri Olsa
2011-08-11 14:25     ` [PATCHv2 01/10] tracing/filter: Use static allocation for filter predicates Jiri Olsa
2011-08-11 14:25     ` [PATCHv2 02/10] tracing/filter: Separate predicate init and filter addition Jiri Olsa
2011-08-11 14:25     ` [PATCHv2 03/10] tracing/filter: Remove field_name from filter_pred struct Jiri Olsa
2011-08-11 14:25     ` [PATCHv2 04/10] tracing/filter: Simplify tracepoint event lookup Jiri Olsa
2011-08-11 14:25     ` [PATCHv2 05/10] tracing/filter: Unify predicate tree walking, change check_pred_tree function to use it Jiri Olsa
2011-08-11 14:25     ` [PATCHv2 06/10] tracing/filter: Change count_leafs function to use walk_pred_tree Jiri Olsa
2011-08-11 14:25     ` [PATCHv2 07/10] tracing/filter: Change fold_pred_tree " Jiri Olsa
2011-08-11 14:25     ` [PATCHv2 08/10] tracing/filter: Change fold_pred " Jiri Olsa
2011-08-11 14:25     ` [PATCHv2 09/10] tracing/filter: Change filter_match_preds " Jiri Olsa
2011-08-11 14:25     ` [PATCHv2 10/10] tracing/filter: Add startup tests for events filter Jiri Olsa

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=1313010992.18583.276.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®