From: Ingo Molnar <mingo@elte.hu>
To: Tom Zanussi <tzanussi@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
fweisbec@gmail.com, paulmck@linux.vnet.ibm.com
Subject: Re: [PATCH] tracing/filters: allow on-the-fly filter switching
Date: Mon, 13 Apr 2009 23:52:14 +0200 [thread overview]
Message-ID: <20090413215214.GD8514@elte.hu> (raw)
In-Reply-To: <1239610670.6660.49.camel@tropicana>
* Tom Zanussi <tzanussi@gmail.com> wrote:
> This patch allows event filters to be safely removed or switched
> on-the-fly while avoiding the use of rcu or the suspension of
> tracing of previous versions.
>
> It does it by adding a new filter_pred_none() predicate function
> which does nothing and by never deallocating either the predicates
> or any of the filter_pred members used in matching; the predicate
> lists are allocated and initialized during ftrace_event_calls
> initialization.
>
> Whenever a filter is removed or replaced, the filter_pred_*
> functions currently in use by the affected ftrace_event_call are
> immediately switched over to to the filter_pred_none() function,
> while the rest of the filter_pred members are left intact,
> allowing any currently executing filter_pred_* functions to finish
> up, using the values they're currently using.
>
> In the case of filter replacement, the new predicate values are
> copied into the old predicates after the above step, and the
> filter_pred_none() functions are replaced by the filter_pred_*
> functions for the new filter. In this case, it is possible though
> very unlikely that a previous filter_pred_* is still running even
> after the filter_pred_none() switch and the switch to the new
> filter_pred_*. In that case, however, because nothing has been
> deallocated in the filter_pred, the worst that can happen is that
> the old filter_pred_* function sees the new values and as a result
> produces either a false positive or a false negative, depending on
> the values it finds.
>
> So one downside to this method is that rarely, it can produce a
> bad match during the filter switch, but it should be possible to
> live with that, IMHO.
Yeah.
It is really a strong thing to avoid RCU here. Instrumentation
should be self-sufficient to a large degree, and it does not get any
more lowlevel than filter expression evaluation engine. Forcing the
use of rcu_read_lock() there would limit its utility.
> The other downside is that at least in this patch the predicate
> lists are always pre-allocated, taking up memory from the start.
> They could probably be allocated on first-use, and de-allocated
> when tracing is completely stopped - if this patch makes sense, I
> could create another one to do that later on.
That's not a big issue IMO.
> Oh, and it also places a restriction on the size of __arrays in
> events, currently set to 128, since they can't be larger than the
> now embedded str_val arrays in the filter_pred struct.
that's OK too - we really want pre-calculated filter expressions and
as atomic evaluations as possible. So having the maximum width
specified is no big deal.
The only exception would be if we ever do PATH_MAX type of field
value comparisons - and i dont see any reason why not, once tracing
is extended to the VFS or once the syscall tracer . That would
increase it to 4096 bytes, making the max kzalloc larger than page
size - still not outrageous so not a big problem. Just lets keep it
in mind that 128 is a bit on the low side.
also:
> + if (!val_str || !strlen(val_str)
> + || strlen(val_str) >= MAX_FILTER_STR_VAL) {
> pred->field_name = NULL;
> return -EINVAL;
> }
it might be quite cryptic to the user why a complex expression was
not installed. I think a single-line KERN_INFO syslog entry would be
most helpful.
Ingo
next prev parent reply other threads:[~2009-04-13 21:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-13 8:17 [PATCH] tracing/filters: allow on-the-fly filter switching Tom Zanussi
2009-04-13 21:52 ` Ingo Molnar [this message]
2009-04-14 0:33 ` [tip:tracing/core] " tip-bot for Tom Zanussi
2009-04-14 20:56 ` [PATCH] " Frederic Weisbecker
2009-04-15 1:12 ` Li Zefan
2009-04-15 1:55 ` Frederic Weisbecker
2009-04-15 4:17 ` Tom Zanussi
2009-04-15 4:32 ` Tom Zanussi
2009-04-15 16:21 ` Frederic Weisbecker
2009-04-16 0:54 ` Li Zefan
2009-04-16 5:34 ` Tom Zanussi
2009-04-16 15:29 ` Frederic Weisbecker
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=20090413215214.GD8514@elte.hu \
--to=mingo@elte.hu \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--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