aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/trace/trace_kprobe.c3
-rw-r--r--tools/perf/builtin-top.c20
-rw-r--r--tools/perf/util/event.c28
-rw-r--r--tools/perf/util/event.h1
4 files changed, 25 insertions, 27 deletions
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 1b79d1c15726..8b27c9849b42 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -925,14 +925,17 @@ static int create_trace_probe(int argc, char **argv)
925 pr_info("Delete command needs an event name.\n"); 925 pr_info("Delete command needs an event name.\n");
926 return -EINVAL; 926 return -EINVAL;
927 } 927 }
928 mutex_lock(&probe_lock);
928 tp = find_probe_event(event, group); 929 tp = find_probe_event(event, group);
929 if (!tp) { 930 if (!tp) {
931 mutex_unlock(&probe_lock);
930 pr_info("Event %s/%s doesn't exist.\n", group, event); 932 pr_info("Event %s/%s doesn't exist.\n", group, event);
931 return -ENOENT; 933 return -ENOENT;
932 } 934 }
933 /* delete an event */ 935 /* delete an event */
934 unregister_trace_probe(tp); 936 unregister_trace_probe(tp);
935 free_trace_probe(tp); 937 free_trace_probe(tp);
938 mutex_unlock(&probe_lock);
936 return 0; 939 return 0;
937 } 940 }
938 941
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 1e8e92e317b9..b513e40974f4 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1082,26 +1082,6 @@ static void event__process_sample(const event_t *self,
1082 } 1082 }
1083} 1083}
1084 1084
1085static int event__process(event_t *event, struct perf_session *session)
1086{
1087 switch (event->header.type) {
1088 case PERF_RECORD_COMM:
1089 event__process_comm(event, session);
1090 break;
1091 case PERF_RECORD_MMAP:
1092 event__process_mmap(event, session);
1093 break;
1094 case PERF_RECORD_FORK:
1095 case PERF_RECORD_EXIT:
1096 event__process_task(event, session);
1097 break;
1098 default:
1099 break;
1100 }
1101
1102 return 0;
1103}
1104
1105struct mmap_data { 1085struct mmap_data {
1106 int counter; 1086 int counter;
1107 void *base; 1087 void *base;
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 6b0db5577929..dab9e754a281 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -151,7 +151,6 @@ static int event__synthesize_mmap_events(pid_t pid, pid_t tgid,
151 continue; 151 continue;
152 pbf += n + 3; 152 pbf += n + 3;
153 if (*pbf == 'x') { /* vm_exec */ 153 if (*pbf == 'x') { /* vm_exec */
154 u64 vm_pgoff;
155 char *execname = strchr(bf, '/'); 154 char *execname = strchr(bf, '/');
156 155
157 /* Catch VDSO */ 156 /* Catch VDSO */
@@ -162,12 +161,7 @@ static int event__synthesize_mmap_events(pid_t pid, pid_t tgid,
162 continue; 161 continue;
163 162
164 pbf += 3; 163 pbf += 3;
165 n = hex2u64(pbf, &vm_pgoff); 164 n = hex2u64(pbf, &ev.mmap.pgoff);
166 /* pgoff is in bytes, not pages */
167 if (n >= 0)
168 ev.mmap.pgoff = vm_pgoff << getpagesize();
169 else
170 ev.mmap.pgoff = 0;
171 165
172 size = strlen(execname); 166 size = strlen(execname);
173 execname[size - 1] = '\0'; /* Remove \n */ 167 execname[size - 1] = '\0'; /* Remove \n */
@@ -554,6 +548,26 @@ int event__process_task(event_t *self, struct perf_session *session)
554 return 0; 548 return 0;
555} 549}
556 550
551int event__process(event_t *event, struct perf_session *session)
552{
553 switch (event->header.type) {
554 case PERF_RECORD_COMM:
555 event__process_comm(event, session);
556 break;
557 case PERF_RECORD_MMAP:
558 event__process_mmap(event, session);
559 break;
560 case PERF_RECORD_FORK:
561 case PERF_RECORD_EXIT:
562 event__process_task(event, session);
563 break;
564 default:
565 break;
566 }
567
568 return 0;
569}
570
557void thread__find_addr_map(struct thread *self, 571void thread__find_addr_map(struct thread *self,
558 struct perf_session *session, u8 cpumode, 572 struct perf_session *session, u8 cpumode,
559 enum map_type type, pid_t pid, u64 addr, 573 enum map_type type, pid_t pid, u64 addr,
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index 887ee63bbb62..8e790dae7026 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -154,6 +154,7 @@ int event__process_comm(event_t *self, struct perf_session *session);
154int event__process_lost(event_t *self, struct perf_session *session); 154int event__process_lost(event_t *self, struct perf_session *session);
155int event__process_mmap(event_t *self, struct perf_session *session); 155int event__process_mmap(event_t *self, struct perf_session *session);
156int event__process_task(event_t *self, struct perf_session *session); 156int event__process_task(event_t *self, struct perf_session *session);
157int event__process(event_t *event, struct perf_session *session);
157 158
158struct addr_location; 159struct addr_location;
159int event__preprocess_sample(const event_t *self, struct perf_session *session, 160int event__preprocess_sample(const event_t *self, struct perf_session *session,