aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@kernel.org>2019-09-18 23:41:10 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-09-20 14:22:00 -0400
commit1a375ae7659ab740d4c885ea98c1659b8a6e2071 (patch)
treec5d7ae0684b4aaa2c74e98d56c5011b4958880cb /tools
parent0216234c2eed1367a318daeb9f4a97d8217412a0 (diff)
perf probe: Skip same probe address for a given line
Fix to skip making a same probe address on given line. Since a DWARF line info contains several entries for one line with different column, perf probe will make a different probe on same address if user specifies a probe point by "function:line" or "file:line". e.g. $ perf probe -D kernel_read:8 p:probe/kernel_read_L8 kernel_read+39 p:probe/kernel_read_L8_1 kernel_read+39 This skips such duplicated probe addresses. Committer testing: # uname -a Linux quaco 5.3.0+ #2 SMP Thu Sep 19 16:13:22 -03 2019 x86_64 x86_64 x86_64 GNU/Linux # Before: # perf probe -D kernel_read:8 p:probe/kernel_read _text+3115191 p:probe/kernel_read_1 _text+3115191 # After: # perf probe -D kernel_read:8 p:probe/kernel_read _text+3115191 # Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lore.kernel.org/lkml/156886447061.10772.4261569305869149178.stgit@devnote2 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/probe-finder.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 505905fc21c5..cd9f95e5044e 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -1245,6 +1245,17 @@ static int expand_probe_args(Dwarf_Die *sc_die, struct probe_finder *pf,
1245 return n; 1245 return n;
1246} 1246}
1247 1247
1248static bool trace_event_finder_overlap(struct trace_event_finder *tf)
1249{
1250 int i;
1251
1252 for (i = 0; i < tf->ntevs; i++) {
1253 if (tf->pf.addr == tf->tevs[i].point.address)
1254 return true;
1255 }
1256 return false;
1257}
1258
1248/* Add a found probe point into trace event list */ 1259/* Add a found probe point into trace event list */
1249static int add_probe_trace_event(Dwarf_Die *sc_die, struct probe_finder *pf) 1260static int add_probe_trace_event(Dwarf_Die *sc_die, struct probe_finder *pf)
1250{ 1261{
@@ -1255,6 +1266,14 @@ static int add_probe_trace_event(Dwarf_Die *sc_die, struct probe_finder *pf)
1255 struct perf_probe_arg *args = NULL; 1266 struct perf_probe_arg *args = NULL;
1256 int ret, i; 1267 int ret, i;
1257 1268
1269 /*
1270 * For some reason (e.g. different column assigned to same address)
1271 * This callback can be called with the address which already passed.
1272 * Ignore it first.
1273 */
1274 if (trace_event_finder_overlap(tf))
1275 return 0;
1276
1258 /* Check number of tevs */ 1277 /* Check number of tevs */
1259 if (tf->ntevs == tf->max_tevs) { 1278 if (tf->ntevs == tf->max_tevs) {
1260 pr_warning("Too many( > %d) probe point found.\n", 1279 pr_warning("Too many( > %d) probe point found.\n",