diff options
author | Oleg Nesterov <oleg@redhat.com> | 2014-04-24 07:26:01 -0400 |
---|---|---|
committer | Oleg Nesterov <oleg@redhat.com> | 2014-04-30 13:10:42 -0400 |
commit | ce5f36a58fd1d92cb945cf2568751d40e8598508 (patch) | |
tree | d0f80b787f02175b60977dbedbb7933848dc156c | |
parent | c90a6950120a7e45f31a22653fe6543507ae64d0 (diff) |
uprobes/tracing: Make uprobe_perf_close() visible to uprobe_perf_open()
Preparation. Move uprobe_perf_close() up before uprobe_perf_open() to
avoid the forward declaration in the next patch and make it readable.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
-rw-r--r-- | kernel/trace/trace_uprobe.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index c082a7441345..51bd071eaca0 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c | |||
@@ -1009,54 +1009,54 @@ uprobe_filter_event(struct trace_uprobe *tu, struct perf_event *event) | |||
1009 | return __uprobe_perf_filter(&tu->filter, event->hw.tp_target->mm); | 1009 | return __uprobe_perf_filter(&tu->filter, event->hw.tp_target->mm); |
1010 | } | 1010 | } |
1011 | 1011 | ||
1012 | static int uprobe_perf_open(struct trace_uprobe *tu, struct perf_event *event) | 1012 | static int uprobe_perf_close(struct trace_uprobe *tu, struct perf_event *event) |
1013 | { | 1013 | { |
1014 | bool done; | 1014 | bool done; |
1015 | 1015 | ||
1016 | write_lock(&tu->filter.rwlock); | 1016 | write_lock(&tu->filter.rwlock); |
1017 | if (event->hw.tp_target) { | 1017 | if (event->hw.tp_target) { |
1018 | /* | 1018 | list_del(&event->hw.tp_list); |
1019 | * event->parent != NULL means copy_process(), we can avoid | ||
1020 | * uprobe_apply(). current->mm must be probed and we can rely | ||
1021 | * on dup_mmap() which preserves the already installed bp's. | ||
1022 | * | ||
1023 | * attr.enable_on_exec means that exec/mmap will install the | ||
1024 | * breakpoints we need. | ||
1025 | */ | ||
1026 | done = tu->filter.nr_systemwide || | 1019 | done = tu->filter.nr_systemwide || |
1027 | event->parent || event->attr.enable_on_exec || | 1020 | (event->hw.tp_target->flags & PF_EXITING) || |
1028 | uprobe_filter_event(tu, event); | 1021 | uprobe_filter_event(tu, event); |
1029 | list_add(&event->hw.tp_list, &tu->filter.perf_events); | ||
1030 | } else { | 1022 | } else { |
1023 | tu->filter.nr_systemwide--; | ||
1031 | done = tu->filter.nr_systemwide; | 1024 | done = tu->filter.nr_systemwide; |
1032 | tu->filter.nr_systemwide++; | ||
1033 | } | 1025 | } |
1034 | write_unlock(&tu->filter.rwlock); | 1026 | write_unlock(&tu->filter.rwlock); |
1035 | 1027 | ||
1036 | if (!done) | 1028 | if (!done) |
1037 | uprobe_apply(tu->inode, tu->offset, &tu->consumer, true); | 1029 | uprobe_apply(tu->inode, tu->offset, &tu->consumer, false); |
1038 | 1030 | ||
1039 | return 0; | 1031 | return 0; |
1040 | } | 1032 | } |
1041 | 1033 | ||
1042 | static int uprobe_perf_close(struct trace_uprobe *tu, struct perf_event *event) | 1034 | static int uprobe_perf_open(struct trace_uprobe *tu, struct perf_event *event) |
1043 | { | 1035 | { |
1044 | bool done; | 1036 | bool done; |
1045 | 1037 | ||
1046 | write_lock(&tu->filter.rwlock); | 1038 | write_lock(&tu->filter.rwlock); |
1047 | if (event->hw.tp_target) { | 1039 | if (event->hw.tp_target) { |
1048 | list_del(&event->hw.tp_list); | 1040 | /* |
1041 | * event->parent != NULL means copy_process(), we can avoid | ||
1042 | * uprobe_apply(). current->mm must be probed and we can rely | ||
1043 | * on dup_mmap() which preserves the already installed bp's. | ||
1044 | * | ||
1045 | * attr.enable_on_exec means that exec/mmap will install the | ||
1046 | * breakpoints we need. | ||
1047 | */ | ||
1049 | done = tu->filter.nr_systemwide || | 1048 | done = tu->filter.nr_systemwide || |
1050 | (event->hw.tp_target->flags & PF_EXITING) || | 1049 | event->parent || event->attr.enable_on_exec || |
1051 | uprobe_filter_event(tu, event); | 1050 | uprobe_filter_event(tu, event); |
1051 | list_add(&event->hw.tp_list, &tu->filter.perf_events); | ||
1052 | } else { | 1052 | } else { |
1053 | tu->filter.nr_systemwide--; | ||
1054 | done = tu->filter.nr_systemwide; | 1053 | done = tu->filter.nr_systemwide; |
1054 | tu->filter.nr_systemwide++; | ||
1055 | } | 1055 | } |
1056 | write_unlock(&tu->filter.rwlock); | 1056 | write_unlock(&tu->filter.rwlock); |
1057 | 1057 | ||
1058 | if (!done) | 1058 | if (!done) |
1059 | uprobe_apply(tu->inode, tu->offset, &tu->consumer, false); | 1059 | uprobe_apply(tu->inode, tu->offset, &tu->consumer, true); |
1060 | 1060 | ||
1061 | return 0; | 1061 | return 0; |
1062 | } | 1062 | } |