lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171129121400.9ded2948615eaaf110bbec7e@kernel.org>
Date:   Wed, 29 Nov 2017 12:14:00 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     Andi Kleen <andi@...stfloor.org>
Cc:     acme@...nel.org, jolsa@...nel.org, mhiramat@...nel.org,
        adrian.hunter@...el.com, linux-kernel@...r.kernel.org,
        Andi Kleen <ak@...ux.intel.com>
Subject: Re: [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@...stfloor.org> wrote:

> From: Andi Kleen <ak@...ux.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@...ux.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@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ