[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-75e33751ca8bbb72dd6f1a74d2810ddc8cbe4bdf@git.kernel.org>
Date: Sat, 21 Nov 2009 13:35:56 GMT
From: tip-bot for Xiao Guangrong <xiaoguangrong@...fujitsu.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, hpa@...or.com, mingo@...hat.com,
rostedt@...dmis.org, xiaoguangrong@...fujitsu.com,
tglx@...utronix.de
Subject: [tip:perf/core] tracing/ksym_tracer: support quick clear for ksym_trace_filter -- v2
Commit-ID: 75e33751ca8bbb72dd6f1a74d2810ddc8cbe4bdf
Gitweb: http://git.kernel.org/tip/75e33751ca8bbb72dd6f1a74d2810ddc8cbe4bdf
Author: Xiao Guangrong <xiaoguangrong@...fujitsu.com>
AuthorDate: Thu, 23 Jul 2009 12:01:22 +0800
Committer: Steven Rostedt <rostedt@...dmis.org>
CommitDate: Thu, 23 Jul 2009 20:54:40 -0400
tracing/ksym_tracer: support quick clear for ksym_trace_filter -- v2
It's rather boring to clear symbol one by one in ksym_trace_filter
file, so, this patch will let ksym_trace_filter file support quickly
clear all break points. We can write "0" to this file and it will clear
all symbols
for example:
# cat ksym_trace_filter
ksym_filter_head:rw-
global_trace:rw-
# echo 0 > ksym_trace_filter
# cat ksym_trace_filter
#
Changelog v1->v2:
Add other ways to clear all breakpoints by writing NULL or "*:---"
to ksym_trace_filter file base on K.Prasad's suggestion
Signed-off-by: Xiao Guangrong <xiaoguangrong@...fujitsu.com>
LKML-Reference: <4A67E092.3080202@...fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@...dmis.org>
---
kernel/trace/trace_ksym.c | 53 +++++++++++++++++++++++++++++---------------
1 files changed, 35 insertions(+), 18 deletions(-)
diff --git a/kernel/trace/trace_ksym.c b/kernel/trace/trace_ksym.c
index cd5cb65..2fde875 100644
--- a/kernel/trace/trace_ksym.c
+++ b/kernel/trace/trace_ksym.c
@@ -163,8 +163,6 @@ static int parse_ksym_trace_str(char *input_string, char **ksymname,
{
int ret;
- strstrip(input_string);
-
*ksymname = strsep(&input_string, ":");
*addr = kallsyms_lookup_name(*ksymname);
@@ -262,6 +260,25 @@ static ssize_t ksym_trace_filter_read(struct file *filp, char __user *ubuf,
return cnt;
}
+static void __ksym_trace_reset(void)
+{
+ struct trace_ksym *entry;
+ struct hlist_node *node, *node1;
+
+ mutex_lock(&ksym_tracer_mutex);
+ hlist_for_each_entry_safe(entry, node, node1, &ksym_filter_head,
+ ksym_hlist) {
+ unregister_kernel_hw_breakpoint(entry->ksym_hbp);
+ ksym_filter_entry_count--;
+ hlist_del_rcu(&(entry->ksym_hlist));
+ synchronize_rcu();
+ kfree(entry->ksym_hbp->info.name);
+ kfree(entry->ksym_hbp);
+ kfree(entry);
+ }
+ mutex_unlock(&ksym_tracer_mutex);
+}
+
static ssize_t ksym_trace_filter_write(struct file *file,
const char __user *buffer,
size_t count, loff_t *ppos)
@@ -282,6 +299,21 @@ static ssize_t ksym_trace_filter_write(struct file *file,
}
input_string[count] = '\0';
+ strstrip(input_string);
+
+ /*
+ * Clear all breakpoints if:
+ * 1: echo > ksym_trace_filter
+ * 2: echo 0 > ksym_trace_filter
+ * 3: echo "*:---" > ksym_trace_filter
+ */
+ if (!input_string[0] || !strcmp(input_string, "0") ||
+ !strcmp(input_string, "*:---")) {
+ __ksym_trace_reset();
+ kfree(input_string);
+ return count;
+ }
+
ret = op = parse_ksym_trace_str(input_string, &ksymname, &ksym_addr);
if (ret < 0) {
kfree(input_string);
@@ -341,23 +373,8 @@ static const struct file_operations ksym_tracing_fops = {
static void ksym_trace_reset(struct trace_array *tr)
{
- struct trace_ksym *entry;
- struct hlist_node *node, *node1;
-
ksym_tracing_enabled = 0;
-
- mutex_lock(&ksym_tracer_mutex);
- hlist_for_each_entry_safe(entry, node, node1, &ksym_filter_head,
- ksym_hlist) {
- unregister_kernel_hw_breakpoint(entry->ksym_hbp);
- ksym_filter_entry_count--;
- hlist_del_rcu(&(entry->ksym_hlist));
- synchronize_rcu();
- kfree(entry->ksym_hbp->info.name);
- kfree(entry->ksym_hbp);
- kfree(entry);
- }
- mutex_unlock(&ksym_tracer_mutex);
+ __ksym_trace_reset();
}
static int ksym_trace_init(struct trace_array *tr)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists