lkml.org 
[lkml]   [2017]   [Nov]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 06/12] perf, tools, probe: Support a quiet argument for debug info open
On Mon, 27 Nov 2017 16:23:15 -0800
Andi Kleen <andi@firstfloor.org> wrote:

> From: Andi Kleen <ak@linux.intel.com>
>
> Add a extra quiet argument to the debug info open / probe finder
> code that allows perf script to make them quieter. Otherwise
> we may end up with too many error messages when lots of
> instructions fail debug info parsing.

IMHO, this kind of simple suppress warning message would better
be done with pr_* implementation (or its macro) since there
maybe new message added or other function which has warning
messages can be called in the future.

Thank you,

>
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> ---
> tools/perf/util/probe-event.c | 4 ++--
> tools/perf/util/probe-finder.c | 19 ++++++++++++-------
> tools/perf/util/probe-finder.h | 5 ++++-
> 3 files changed, 18 insertions(+), 10 deletions(-)
>
> diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> index b7aaf9b2294d..2f9469e862fb 100644
> --- a/tools/perf/util/probe-event.c
> +++ b/tools/perf/util/probe-event.c
> @@ -1071,12 +1071,12 @@ static int show_available_vars_at(struct debuginfo *dinfo,
> return -EINVAL;
> pr_debug("Searching variables at %s\n", buf);
>
> - ret = debuginfo__find_available_vars_at(dinfo, pev, &vls);
> + ret = debuginfo__find_available_vars_at(dinfo, pev, &vls, false);
> if (!ret) { /* Not found, retry with an alternative */
> ret = get_alternative_probe_event(dinfo, pev, &tmp);
> if (!ret) {
> ret = debuginfo__find_available_vars_at(dinfo, pev,
> - &vls);
> + &vls, false);
> /* Release the old probe_point */
> clear_perf_probe_point(&tmp);
> }
> diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
> index 699f29d8a28e..137b2fe71838 100644
> --- a/tools/perf/util/probe-finder.c
> +++ b/tools/perf/util/probe-finder.c
> @@ -685,12 +685,14 @@ static int call_probe_finder(Dwarf_Die *sc_die, struct probe_finder *pf)
> if (!die_is_func_def(sc_die)) {
> if (!die_find_realfunc(&pf->cu_die, pf->addr, &pf->sp_die)) {
> if (die_find_tailfunc(&pf->cu_die, pf->addr, &pf->sp_die)) {
> - pr_warning("Ignoring tail call from %s\n",
> + if (!pf->quiet)
> + pr_warning("Ignoring tail call from %s\n",
> dwarf_diename(&pf->sp_die));
> return 0;
> } else {
> - pr_warning("Failed to find probe point in any "
> - "functions.\n");
> + if (!pf->quiet)
> + pr_warning("Failed to find probe point in any "
> + "functions.\n");
> return -ENOENT;
> }
> }
> @@ -708,8 +710,9 @@ static int call_probe_finder(Dwarf_Die *sc_die, struct probe_finder *pf)
> if ((dwarf_cfi_addrframe(pf->cfi_eh, pf->addr, &frame) != 0 &&
> (dwarf_cfi_addrframe(pf->cfi_dbg, pf->addr, &frame) != 0)) ||
> dwarf_frame_cfa(frame, &pf->fb_ops, &nops) != 0) {
> - pr_warning("Failed to get call frame on 0x%jx\n",
> - (uintmax_t)pf->addr);
> + if (!pf->quiet)
> + pr_warning("Failed to get call frame on 0x%jx\n",
> + (uintmax_t)pf->addr);
> free(frame);
> return -ENOENT;
> }
> @@ -1499,10 +1502,12 @@ static int add_available_vars(Dwarf_Die *sc_die, struct probe_finder *pf)
> */
> int debuginfo__find_available_vars_at(struct debuginfo *dbg,
> struct perf_probe_event *pev,
> - struct variable_list **vls)
> + struct variable_list **vls,
> + bool be_quiet)
> {
> struct available_var_finder af = {
> - .pf = {.pev = pev, .callback = add_available_vars},
> + .pf = {.pev = pev, .callback = add_available_vars,
> + .quiet = be_quiet},
> .mod = dbg->mod,
> .max_vls = probe_conf.max_probes};
> int ret;
> diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
> index 6368e95a5d16..abcb2262ea72 100644
> --- a/tools/perf/util/probe-finder.h
> +++ b/tools/perf/util/probe-finder.h
> @@ -57,7 +57,8 @@ int debuginfo__find_line_range(struct debuginfo *dbg, struct line_range *lr);
> /* Find available variables */
> int debuginfo__find_available_vars_at(struct debuginfo *dbg,
> struct perf_probe_event *pev,
> - struct variable_list **vls);
> + struct variable_list **vls,
> + bool quiet);
>
> /* Find a src file from a DWARF tag path */
> int get_real_path(const char *raw_path, const char *comp_dir,
> @@ -88,6 +89,8 @@ struct probe_finder {
> unsigned int machine; /* Target machine arch */
> struct perf_probe_arg *pvar; /* Current target variable */
> struct probe_trace_arg *tvar; /* Current result variable */
> +
> + bool quiet; /* Avoid warnings */
> };
>
> struct trace_event_finder {
> --
> 2.13.6
>


--
Masami Hiramatsu <mhiramat@kernel.org>

\
 
 \ /
  Last update: 2017-11-29 04:14    [W:0.087 / U:1.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site