From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>, Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH 03/10] tracing: Add boiler plate for subsystem filter
Date: Mon, 07 Nov 2011 20:29:42 -0500 [thread overview]
Message-ID: <20111108013037.560493198@goodmis.org> (raw)
In-Reply-To: 20111108012939.372220547@goodmis.org
[-- Attachment #1: Type: text/plain, Size: 3130 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
The system filter can be used to set multiple event filters that
exist within the system. But currently it displays the last filter
written that does not necessarily correspond to the filters within
the system. The system filter itself is not used to filter any events.
The system filter is just a means to set filters of the events within
it.
Because this causes an ambiguous state when the system filter reads
a filter string but the events within the system have different strings
it is best to just show a boiler plate:
### global filter ###
# Use this to set filters for multiple events.
# Only events with the given fields will be affected.
# If no events are modified, an error message will be displayed here.
If an error occurs while writing to the system filter, the system
filter will replace the boiler plate with the error message as it
currently does.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace_events_filter.c | 26 +++++++++++++++++++-------
1 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 86040d9..fdc6d22 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -27,6 +27,12 @@
#include "trace.h"
#include "trace_output.h"
+#define DEFAULT_SYS_FILTER_MESSAGE \
+ "### global filter ###\n" \
+ "# Use this to set filters for multiple events.\n" \
+ "# Only events with the given fields will be affected.\n" \
+ "# If no events are modified, an error message will be displayed here"
+
enum filter_op_ids
{
OP_OR,
@@ -646,7 +652,7 @@ void print_subsystem_event_filter(struct event_subsystem *system,
if (filter && filter->filter_string)
trace_seq_printf(s, "%s\n", filter->filter_string);
else
- trace_seq_printf(s, "none\n");
+ trace_seq_printf(s, DEFAULT_SYS_FILTER_MESSAGE "\n");
mutex_unlock(&event_mutex);
}
@@ -1838,7 +1844,10 @@ int apply_subsystem_event_filter(struct event_subsystem *system,
if (!filter)
goto out;
- replace_filter_string(filter, filter_string);
+ /* System filters just show a default message */
+ kfree(filter->filter_string);
+ filter->filter_string = NULL;
+
/*
* No event actually uses the system filter
* we can free it without synchronize_sched().
@@ -1848,14 +1857,12 @@ int apply_subsystem_event_filter(struct event_subsystem *system,
parse_init(ps, filter_ops, filter_string);
err = filter_parse(ps);
- if (err) {
- append_filter_err(ps, system->filter);
- goto out;
- }
+ if (err)
+ goto err_filter;
err = replace_system_preds(system, ps, filter_string);
if (err)
- append_filter_err(ps, system->filter);
+ goto err_filter;
out:
filter_opstack_clear(ps);
@@ -1865,6 +1872,11 @@ out_unlock:
mutex_unlock(&event_mutex);
return err;
+
+err_filter:
+ replace_filter_string(filter, filter_string);
+ append_filter_err(ps, system->filter);
+ goto out;
}
#ifdef CONFIG_PERF_EVENTS
--
1.7.7
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2011-11-08 1:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-08 1:29 [PATCH 00/10] [GIT PULL] tracing: various fixes Steven Rostedt
2011-11-08 1:29 ` [PATCH 01/10] tracing: fix event_subsystem ref counting Steven Rostedt
2011-11-08 1:29 ` [PATCH 02/10] tracing: Restore system filter behavior Steven Rostedt
2011-11-08 1:29 ` Steven Rostedt [this message]
2011-11-08 1:29 ` [PATCH 04/10] tracing: update Documentation on max preds limit Steven Rostedt
2011-11-08 1:29 ` [PATCH 05/10] lockdep: Show subclass in pretty print of lockdep output Steven Rostedt
2011-11-08 1:29 ` [PATCH 06/10] ftrace: Remove force undef config value left for testing Steven Rostedt
2011-11-08 1:29 ` [PATCH 07/10] jump_label: jump_label_inc may return before the code is patched Steven Rostedt
2011-11-08 1:29 ` [PATCH 08/10] perf: Fix parsing of __print_flags() in TP_printk() Steven Rostedt
2011-11-08 1:29 ` [PATCH 09/10] ftrace: Fix hash record accounting bug Steven Rostedt
2011-11-08 1:29 ` [PATCH 10/10] tracing/latency: Fix header output for latency tracers Steven Rostedt
2011-11-11 8:33 ` [PATCH 00/10] [GIT PULL] tracing: various fixes Ingo Molnar
2011-11-29 21:33 ` Steven Rostedt
2011-12-03 9:20 ` Ingo Molnar
2011-12-05 0:31 ` Steven Rostedt
2011-12-05 9:47 ` Ingo Molnar
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=20111108013037.560493198@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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