Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752722AbbEJHMF (ORCPT ); Sun, 10 May 2015 03:12:05 -0400 Received: from terminus.zytor.com ([198.137.202.10]:44978 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752439AbbEJHMB (ORCPT ); Sun, 10 May 2015 03:12:01 -0400 Date: Sun, 10 May 2015 00:11:20 -0700 From: tip-bot for Masami Hiramatsu Message-ID: Cc: peterz@infradead.org, masami.hiramatsu.pt@hitachi.com, jolsa@redhat.com, acme@redhat.com, namhyung@kernel.org, hpa@zytor.com, dsahern@gmail.com, linux-kernel@vger.kernel.org, hemant@linux.vnet.ibm.com, tglx@linutronix.de, mingo@kernel.org, ananth@in.ibm.com Reply-To: jolsa@redhat.com, masami.hiramatsu.pt@hitachi.com, peterz@infradead.org, hpa@zytor.com, acme@redhat.com, namhyung@kernel.org, hemant@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, dsahern@gmail.com, ananth@in.ibm.com, mingo@kernel.org, tglx@linutronix.de In-Reply-To: <20150508010328.24812.67887.stgit@localhost.localdomain> References: <20150508010328.24812.67887.stgit@localhost.localdomain> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf probe: Use perf_probe_event.target instead of passing as an argument Git-Commit-ID: 442255215cb9651668cb09350b0d51e111219f17 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 10525 Lines: 273 Commit-ID: 442255215cb9651668cb09350b0d51e111219f17 Gitweb: http://git.kernel.org/tip/442255215cb9651668cb09350b0d51e111219f17 Author: Masami Hiramatsu AuthorDate: Fri, 8 May 2015 10:03:28 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 8 May 2015 16:25:21 -0300 perf probe: Use perf_probe_event.target instead of passing as an argument Use perf_probe_event.target field for the target binary instead of passing it as an argument. Signed-off-by: Masami Hiramatsu Cc: Ananth N Mavinakayanahalli Cc: David Ahern Cc: Hemant Kumar Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20150508010328.24812.67887.stgit@localhost.localdomain Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-probe.c | 1 - tools/perf/util/probe-event.c | 55 ++++++++++++++++++++----------------------- tools/perf/util/probe-event.h | 4 ++-- 3 files changed, 27 insertions(+), 33 deletions(-) diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index 9c4cf5e..233f941 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c @@ -478,7 +478,6 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) ret = show_available_vars(params.events, params.nevents, params.max_probe_points, - params.target, params.filter, params.show_ext_vars); if (ret < 0) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 37a3a8b..b8fd48d 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -344,15 +344,14 @@ out: static int get_alternative_probe_event(struct debuginfo *dinfo, struct perf_probe_event *pev, - struct perf_probe_point *tmp, - const char *target) + struct perf_probe_point *tmp) { int ret; memcpy(tmp, &pev->point, sizeof(*tmp)); memset(&pev->point, 0, sizeof(pev->point)); ret = find_alternative_probe_point(dinfo, tmp, &pev->point, - target, pev->uprobes); + pev->target, pev->uprobes); if (ret < 0) memcpy(&pev->point, tmp, sizeof(*tmp)); @@ -601,15 +600,14 @@ static int post_process_probe_trace_events(struct probe_trace_event *tevs, /* Try to find perf_probe_event with debuginfo */ static int try_to_find_probe_trace_events(struct perf_probe_event *pev, struct probe_trace_event **tevs, - int max_tevs, const char *target) + int max_tevs) { bool need_dwarf = perf_probe_event_need_dwarf(pev); struct perf_probe_point tmp; struct debuginfo *dinfo; int ntevs, ret = 0; - dinfo = open_debuginfo(target, !need_dwarf); - + dinfo = open_debuginfo(pev->target, !need_dwarf); if (!dinfo) { if (need_dwarf) return -ENOENT; @@ -622,7 +620,7 @@ static int try_to_find_probe_trace_events(struct perf_probe_event *pev, ntevs = debuginfo__find_trace_events(dinfo, pev, tevs, max_tevs); if (ntevs == 0) { /* Not found, retry with an alternative */ - ret = get_alternative_probe_event(dinfo, pev, &tmp, target); + ret = get_alternative_probe_event(dinfo, pev, &tmp); if (!ret) { ntevs = debuginfo__find_trace_events(dinfo, pev, tevs, max_tevs); @@ -640,7 +638,7 @@ static int try_to_find_probe_trace_events(struct perf_probe_event *pev, if (ntevs > 0) { /* Succeeded to find trace events */ pr_debug("Found %d probe_trace_events.\n", ntevs); ret = post_process_probe_trace_events(*tevs, ntevs, - target, pev->uprobes); + pev->target, pev->uprobes); if (ret < 0 || ret == ntevs) { clear_probe_trace_events(*tevs, ntevs); zfree(tevs); @@ -824,7 +822,7 @@ int show_line_range(struct line_range *lr, const char *module, bool user) static int show_available_vars_at(struct debuginfo *dinfo, struct perf_probe_event *pev, int max_vls, struct strfilter *_filter, - bool externs, const char *target) + bool externs) { char *buf; int ret, i, nvars; @@ -841,7 +839,7 @@ static int show_available_vars_at(struct debuginfo *dinfo, ret = debuginfo__find_available_vars_at(dinfo, pev, &vls, max_vls, externs); if (!ret) { /* Not found, retry with an alternative */ - ret = get_alternative_probe_event(dinfo, pev, &tmp, target); + ret = get_alternative_probe_event(dinfo, pev, &tmp); if (!ret) { ret = debuginfo__find_available_vars_at(dinfo, pev, &vls, max_vls, externs); @@ -891,8 +889,7 @@ end: /* Show available variables on given probe point */ int show_available_vars(struct perf_probe_event *pevs, int npevs, - int max_vls, const char *module, - struct strfilter *_filter, bool externs) + int max_vls, struct strfilter *_filter, bool externs) { int i, ret = 0; struct debuginfo *dinfo; @@ -901,7 +898,7 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs, if (ret < 0) return ret; - dinfo = open_debuginfo(module, false); + dinfo = open_debuginfo(pevs->target, false); if (!dinfo) { ret = -ENOENT; goto out; @@ -911,7 +908,7 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs, for (i = 0; i < npevs && ret >= 0; i++) ret = show_available_vars_at(dinfo, &pevs[i], max_vls, _filter, - externs, module); + externs); debuginfo__delete(dinfo); out: @@ -931,8 +928,7 @@ find_perf_probe_point_from_dwarf(struct probe_trace_point *tp __maybe_unused, static int try_to_find_probe_trace_events(struct perf_probe_event *pev, struct probe_trace_event **tevs __maybe_unused, - int max_tevs __maybe_unused, - const char *target __maybe_unused) + int max_tevs __maybe_unused) { if (perf_probe_event_need_dwarf(pev)) { pr_warning("Debuginfo-analysis is not supported.\n"); @@ -952,7 +948,6 @@ int show_line_range(struct line_range *lr __maybe_unused, int show_available_vars(struct perf_probe_event *pevs __maybe_unused, int npevs __maybe_unused, int max_vls __maybe_unused, - const char *module __maybe_unused, struct strfilter *filter __maybe_unused, bool externs __maybe_unused) { @@ -2520,7 +2515,7 @@ void __weak arch__fix_tev_from_maps(struct perf_probe_event *pev __maybe_unused, */ static int find_probe_trace_events_from_map(struct perf_probe_event *pev, struct probe_trace_event **tevs, - int max_tevs, const char *target) + int max_tevs) { struct map *map = NULL; struct ref_reloc_sym *reloc_sym = NULL; @@ -2531,7 +2526,7 @@ static int find_probe_trace_events_from_map(struct perf_probe_event *pev, int num_matched_functions; int ret, i; - map = get_target_map(target, pev->uprobes); + map = get_target_map(pev->target, pev->uprobes); if (!map) { ret = -EINVAL; goto out; @@ -2544,12 +2539,12 @@ static int find_probe_trace_events_from_map(struct perf_probe_event *pev, num_matched_functions = find_probe_functions(map, pp->function); if (num_matched_functions == 0) { pr_err("Failed to find symbol %s in %s\n", pp->function, - target ? : "kernel"); + pev->target ? : "kernel"); ret = -ENOENT; goto out; } else if (num_matched_functions > max_tevs) { pr_err("Too many functions matched in %s\n", - target ? : "kernel"); + pev->target ? : "kernel"); ret = -E2BIG; goto out; } @@ -2597,8 +2592,9 @@ static int find_probe_trace_events_from_map(struct perf_probe_event *pev, tp->offset = pp->offset; } tp->retprobe = pp->retprobe; - if (target) - tev->point.module = strdup_or_goto(target, nomem_out); + if (pev->target) + tev->point.module = strdup_or_goto(pev->target, + nomem_out); tev->uprobes = pev->uprobes; tev->nargs = pev->nargs; if (tev->nargs) { @@ -2639,13 +2635,13 @@ bool __weak arch__prefers_symtab(void) { return false; } static int convert_to_probe_trace_events(struct perf_probe_event *pev, struct probe_trace_event **tevs, - int max_tevs, const char *target) + int max_tevs) { int ret; if (pev->uprobes && !pev->group) { /* Replace group name if not given */ - ret = convert_exec_to_group(target, &pev->group); + ret = convert_exec_to_group(pev->target, &pev->group); if (ret != 0) { pr_warning("Failed to make a group name.\n"); return ret; @@ -2653,17 +2649,17 @@ static int convert_to_probe_trace_events(struct perf_probe_event *pev, } if (arch__prefers_symtab() && !perf_probe_event_need_dwarf(pev)) { - ret = find_probe_trace_events_from_map(pev, tevs, max_tevs, target); + ret = find_probe_trace_events_from_map(pev, tevs, max_tevs); if (ret > 0) return ret; /* Found in symbol table */ } /* Convert perf_probe_event with debuginfo */ - ret = try_to_find_probe_trace_events(pev, tevs, max_tevs, target); + ret = try_to_find_probe_trace_events(pev, tevs, max_tevs); if (ret != 0) return ret; /* Found in debuginfo or got an error */ - return find_probe_trace_events_from_map(pev, tevs, max_tevs, target); + return find_probe_trace_events_from_map(pev, tevs, max_tevs); } struct __event_package { @@ -2696,8 +2692,7 @@ int add_perf_probe_events(struct perf_probe_event *pevs, int npevs, /* Convert with or without debuginfo */ ret = convert_to_probe_trace_events(pkgs[i].pev, &pkgs[i].tevs, - max_tevs, - pkgs[i].pev->target); + max_tevs); if (ret < 0) goto end; pkgs[i].ntevs = ret; diff --git a/tools/perf/util/probe-event.h b/tools/perf/util/probe-event.h index e10aedc..e3d9bb1 100644 --- a/tools/perf/util/probe-event.h +++ b/tools/perf/util/probe-event.h @@ -131,8 +131,8 @@ extern int show_perf_probe_events(struct strfilter *filter); extern int show_line_range(struct line_range *lr, const char *module, bool user); extern int show_available_vars(struct perf_probe_event *pevs, int npevs, - int max_probe_points, const char *module, - struct strfilter *filter, bool externs); + int max_probe_points, struct strfilter *filter, + bool externs); extern int show_available_funcs(const char *module, struct strfilter *filter, bool user); bool arch__prefers_symtab(void); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/