aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhangwei(Jovi) <jovi.zhangwei@huawei.com>2013-03-11 03:14:03 -0400
committerSteven Rostedt <rostedt@goodmis.org>2013-03-15 13:22:10 -0400
commit52f6ad6dc3f4c6de598fe7cc9b629888d624aa52 (patch)
treeae3d4edf8b44bf9e77e970e58411420e6e164b60
parent36a78e9e8792bfb052643eaf9374f837e634982c (diff)
tracing: Rename trace_event_mutex to trace_event_sem
trace_event_mutex is an rw semaphore now, not a mutex, change the name. Link: http://lkml.kernel.org/r/513D843B.40109@huawei.com Signed-off-by: zhangwei(Jovi) <jovi.zhangwei@huawei.com> [ Forward ported to my new code ] Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--kernel/trace/trace_events.c22
-rw-r--r--kernel/trace/trace_output.c16
-rw-r--r--kernel/trace/trace_output.h2
3 files changed, 20 insertions, 20 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index a71cdc3c5df9..53582e982e51 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -1584,7 +1584,7 @@ int trace_add_event_call(struct ftrace_event_call *call)
1584} 1584}
1585 1585
1586/* 1586/*
1587 * Must be called under locking both of event_mutex and trace_event_mutex. 1587 * Must be called under locking both of event_mutex and trace_event_sem.
1588 */ 1588 */
1589static void __trace_remove_event_call(struct ftrace_event_call *call) 1589static void __trace_remove_event_call(struct ftrace_event_call *call)
1590{ 1590{
@@ -1597,9 +1597,9 @@ static void __trace_remove_event_call(struct ftrace_event_call *call)
1597void trace_remove_event_call(struct ftrace_event_call *call) 1597void trace_remove_event_call(struct ftrace_event_call *call)
1598{ 1598{
1599 mutex_lock(&event_mutex); 1599 mutex_lock(&event_mutex);
1600 down_write(&trace_event_mutex); 1600 down_write(&trace_event_sem);
1601 __trace_remove_event_call(call); 1601 __trace_remove_event_call(call);
1602 up_write(&trace_event_mutex); 1602 up_write(&trace_event_sem);
1603 mutex_unlock(&event_mutex); 1603 mutex_unlock(&event_mutex);
1604} 1604}
1605 1605
@@ -1707,7 +1707,7 @@ static void trace_module_remove_events(struct module *mod)
1707 struct ftrace_event_call *call, *p; 1707 struct ftrace_event_call *call, *p;
1708 bool clear_trace = false; 1708 bool clear_trace = false;
1709 1709
1710 down_write(&trace_event_mutex); 1710 down_write(&trace_event_sem);
1711 list_for_each_entry_safe(call, p, &ftrace_events, list) { 1711 list_for_each_entry_safe(call, p, &ftrace_events, list) {
1712 if (call->mod == mod) { 1712 if (call->mod == mod) {
1713 if (call->flags & TRACE_EVENT_FL_WAS_ENABLED) 1713 if (call->flags & TRACE_EVENT_FL_WAS_ENABLED)
@@ -1725,7 +1725,7 @@ static void trace_module_remove_events(struct module *mod)
1725 list_del(&file_ops->list); 1725 list_del(&file_ops->list);
1726 kfree(file_ops); 1726 kfree(file_ops);
1727 } 1727 }
1728 up_write(&trace_event_mutex); 1728 up_write(&trace_event_sem);
1729 1729
1730 /* 1730 /*
1731 * It is safest to reset the ring buffer if the module being unloaded 1731 * It is safest to reset the ring buffer if the module being unloaded
@@ -2262,9 +2262,9 @@ int event_trace_add_tracer(struct dentry *parent, struct trace_array *tr)
2262 if (ret) 2262 if (ret)
2263 goto out_unlock; 2263 goto out_unlock;
2264 2264
2265 down_write(&trace_event_mutex); 2265 down_write(&trace_event_sem);
2266 __trace_add_event_dirs(tr); 2266 __trace_add_event_dirs(tr);
2267 up_write(&trace_event_mutex); 2267 up_write(&trace_event_sem);
2268 2268
2269 out_unlock: 2269 out_unlock:
2270 mutex_unlock(&event_mutex); 2270 mutex_unlock(&event_mutex);
@@ -2287,9 +2287,9 @@ early_event_add_tracer(struct dentry *parent, struct trace_array *tr)
2287 if (ret) 2287 if (ret)
2288 goto out_unlock; 2288 goto out_unlock;
2289 2289
2290 down_write(&trace_event_mutex); 2290 down_write(&trace_event_sem);
2291 __trace_early_add_event_dirs(tr); 2291 __trace_early_add_event_dirs(tr);
2292 up_write(&trace_event_mutex); 2292 up_write(&trace_event_sem);
2293 2293
2294 out_unlock: 2294 out_unlock:
2295 mutex_unlock(&event_mutex); 2295 mutex_unlock(&event_mutex);
@@ -2304,10 +2304,10 @@ int event_trace_del_tracer(struct trace_array *tr)
2304 2304
2305 mutex_lock(&event_mutex); 2305 mutex_lock(&event_mutex);
2306 2306
2307 down_write(&trace_event_mutex); 2307 down_write(&trace_event_sem);
2308 __trace_remove_event_dirs(tr); 2308 __trace_remove_event_dirs(tr);
2309 debugfs_remove_recursive(tr->event_dir); 2309 debugfs_remove_recursive(tr->event_dir);
2310 up_write(&trace_event_mutex); 2310 up_write(&trace_event_sem);
2311 2311
2312 tr->event_dir = NULL; 2312 tr->event_dir = NULL;
2313 2313
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index 19f48e7edc39..f475b2a7ac88 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -14,7 +14,7 @@
14/* must be a power of 2 */ 14/* must be a power of 2 */
15#define EVENT_HASHSIZE 128 15#define EVENT_HASHSIZE 128
16 16
17DECLARE_RWSEM(trace_event_mutex); 17DECLARE_RWSEM(trace_event_sem);
18 18
19static struct hlist_head event_hash[EVENT_HASHSIZE] __read_mostly; 19static struct hlist_head event_hash[EVENT_HASHSIZE] __read_mostly;
20 20
@@ -826,12 +826,12 @@ static int trace_search_list(struct list_head **list)
826 826
827void trace_event_read_lock(void) 827void trace_event_read_lock(void)
828{ 828{
829 down_read(&trace_event_mutex); 829 down_read(&trace_event_sem);
830} 830}
831 831
832void trace_event_read_unlock(void) 832void trace_event_read_unlock(void)
833{ 833{
834 up_read(&trace_event_mutex); 834 up_read(&trace_event_sem);
835} 835}
836 836
837/** 837/**
@@ -854,7 +854,7 @@ int register_ftrace_event(struct trace_event *event)
854 unsigned key; 854 unsigned key;
855 int ret = 0; 855 int ret = 0;
856 856
857 down_write(&trace_event_mutex); 857 down_write(&trace_event_sem);
858 858
859 if (WARN_ON(!event)) 859 if (WARN_ON(!event))
860 goto out; 860 goto out;
@@ -909,14 +909,14 @@ int register_ftrace_event(struct trace_event *event)
909 909
910 ret = event->type; 910 ret = event->type;
911 out: 911 out:
912 up_write(&trace_event_mutex); 912 up_write(&trace_event_sem);
913 913
914 return ret; 914 return ret;
915} 915}
916EXPORT_SYMBOL_GPL(register_ftrace_event); 916EXPORT_SYMBOL_GPL(register_ftrace_event);
917 917
918/* 918/*
919 * Used by module code with the trace_event_mutex held for write. 919 * Used by module code with the trace_event_sem held for write.
920 */ 920 */
921int __unregister_ftrace_event(struct trace_event *event) 921int __unregister_ftrace_event(struct trace_event *event)
922{ 922{
@@ -931,9 +931,9 @@ int __unregister_ftrace_event(struct trace_event *event)
931 */ 931 */
932int unregister_ftrace_event(struct trace_event *event) 932int unregister_ftrace_event(struct trace_event *event)
933{ 933{
934 down_write(&trace_event_mutex); 934 down_write(&trace_event_sem);
935 __unregister_ftrace_event(event); 935 __unregister_ftrace_event(event);
936 up_write(&trace_event_mutex); 936 up_write(&trace_event_sem);
937 937
938 return 0; 938 return 0;
939} 939}
diff --git a/kernel/trace/trace_output.h b/kernel/trace/trace_output.h
index af77870de278..127a9d8c8357 100644
--- a/kernel/trace/trace_output.h
+++ b/kernel/trace/trace_output.h
@@ -33,7 +33,7 @@ trace_print_lat_fmt(struct trace_seq *s, struct trace_entry *entry);
33 33
34/* used by module unregistering */ 34/* used by module unregistering */
35extern int __unregister_ftrace_event(struct trace_event *event); 35extern int __unregister_ftrace_event(struct trace_event *event);
36extern struct rw_semaphore trace_event_mutex; 36extern struct rw_semaphore trace_event_sem;
37 37
38#define MAX_MEMHEX_BYTES 8 38#define MAX_MEMHEX_BYTES 8
39#define HEX_CHARS (MAX_MEMHEX_BYTES*2 + 1) 39#define HEX_CHARS (MAX_MEMHEX_BYTES*2 + 1)