public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: Tom Zanussi <tzanussi@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@elte.hu>, Steven Rostedt <rostedt@goodmis.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] tracing/filters: Improve subsystem filter
Date: Tue, 21 Jul 2009 14:35:00 +0800	[thread overview]
Message-ID: <4A656194.50700@cn.fujitsu.com> (raw)
In-Reply-To: <1248154585.6323.26.camel@tropicana>

Tom Zanussi wrote:
> Hi,
> 
> On Mon, 2009-07-20 at 10:20 +0800, Li Zefan wrote:
>> Currently a subsystem filter should be applicable to all events
>> under the subsystem, and if it failed, all the event filters
>> will be cleared. Those behaviors make subsys filter much less
>> useful:
>>
>>   # echo 'vec == 1' > irq/softirq_entry/filter
>>   # echo 'irq == 5' > irq/filter
>>   bash: echo: write error: Invalid argument
>>   # cat irq/softirq_entry/filter
>>   none
>>
>> I'd expect it set the filter for irq_handler_entry/exit, and
>> not touch softirq_entry/exit.
>>
>> The basic idea is, try to see if the filter can be applied
>> to which events, and then just apply to the those events:
>>
>>   # echo 'vec == 1' > softirq_entry/filter
>>   # echo 'irq == 5' > filter
>>   # cat irq_handler_entry/filter
>>   irq == 5
>>   # cat softirq_entry/filter
>>   vec == 1
>>
> 
> It looks like it accomplishes the goal, but I wonder if you could
> simplify it by getting rid of the no_reset flag and all the state-saving
> while keeping the dry_run param on filter_add_pred to use from
> filter_add_subsysystem_pred() e.g. something like this:
> 
> filter_add_subsystem_pred(...)
> {
> 	...
> 	list_for_each_entry(call, &ftrace_events, list) {
> 		err = filter_add_pred(ps, call, pred, dry_run = 1);
> 		if (!err)
> 			filter_add_pred(ps, call, pred, dry_run = 0);

This is the same with just call "filter_add_pred(ps, call, pred)"

> 		...
> 	}
> }
> 
> IIRC the state-saving was necessary if the idea was to back out of (or
> avoid setting) all the filters if one failed, but the new model is to
> set whichever apply while leaving the rest alone.  I think the simpler
> approach above accomplishes that, but I may be missing something or have
> forgotten the original motivation for doing it this way.
> 

This won't work as expected. The state-saving is necessary, because
if any pred is not appliable for an event, the whole operation should
fail for that event.

What this patch does is apply the filter to those events that the
filter is appliable, but not apply parts of the filter to each event.

Imaging the result for those filters with the above code:

  # echo 'irq == 5 && vec == 1' > filter
  # echo 'irq == 5 || vec == 1' > filter
  # echo 'irq == 5 || foo == bar' > fitler
  # echo '(irq == 5 && vec == 1) || irq == 2' > filter


  reply	other threads:[~2009-07-21  6:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-20  2:20 [PATCH v2] tracing/filters: Improve subsystem filter Li Zefan
2009-07-20 16:08 ` Steven Rostedt
2009-07-20 16:16   ` Frederic Weisbecker
2009-07-20 16:35   ` Steven Rostedt
2009-07-21  1:25     ` Li Zefan
2009-07-21  1:35       ` Steven Rostedt
2009-07-21  1:46         ` Li Zefan
2009-07-21  2:14           ` Steven Rostedt
2009-07-21  5:56           ` Tom Zanussi
2009-07-21  5:36 ` Tom Zanussi
2009-07-21  6:35   ` Li Zefan [this message]
2009-07-21  7:22     ` Tom Zanussi
2009-08-05  8:19 ` [tip:tracing/core] tracing/filters: improve " tip-bot for Li Zefan

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=4A656194.50700@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    --cc=tzanussi@gmail.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