public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: acme@kernel.org
Cc: jolsa@kernel.org, mhiramat@kernel.org, adrian.hunter@intel.com,
	linux-kernel@vger.kernel.org, Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 06/12] perf, tools, probe: Support a quiet argument for debug info open
Date: Mon, 27 Nov 2017 16:23:15 -0800	[thread overview]
Message-ID: <20171128002321.2878-7-andi@firstfloor.org> (raw)
In-Reply-To: <20171128002321.2878-1-andi@firstfloor.org>

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.

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

  parent reply	other threads:[~2017-11-28  0:26 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-28  0:23 Implement dwarf variable/type resolving for perf script Andi Kleen
2017-11-28  0:23 ` [PATCH 01/12] perf, tools, pt: Clear instruction for ptwrite samples Andi Kleen
2017-11-28  0:23 ` [PATCH 02/12] perf, tools, script: Print insn/insnlen for non PT sample Andi Kleen
2017-11-28  0:23 ` [PATCH 03/12] perf, tools: Support storing additional data in strlist Andi Kleen
2017-11-28 13:31   ` Masami Hiramatsu
2017-11-28  0:23 ` [PATCH 04/12] perf, tools: Store variable name and register for dwarf variable lists Andi Kleen
2017-11-28  0:23 ` [PATCH 05/12] perf, tools, probe: Print location for resolved variables Andi Kleen
2017-11-29  1:19   ` Masami Hiramatsu
2017-11-28  0:23 ` Andi Kleen [this message]
2017-11-29  3:14   ` [PATCH 06/12] perf, tools, probe: Support a quiet argument for debug info open Masami Hiramatsu
2017-11-29  3:39     ` Andi Kleen
2017-11-30  2:36       ` Masami Hiramatsu
2017-11-28  0:23 ` [PATCH 07/12] perf, tools, script: Resolve variable names for registers Andi Kleen
2017-11-28  0:23 ` [PATCH 08/12] perf, tools: Always print probe finder warnings with -v Andi Kleen
2017-11-29  3:16   ` Masami Hiramatsu
2017-11-28  0:23 ` [PATCH 09/12] perf, tools: Downgrade register mapping message to warning Andi Kleen
2017-11-29  5:56   ` Masami Hiramatsu
2017-11-28  0:23 ` [PATCH 10/12] perf, tools: Add args and gprs shortcut for registers Andi Kleen
2017-11-28  0:23 ` [PATCH 11/12] perf, tools: Print probe warnings for binaries only once per binary Andi Kleen
2017-11-30  2:38   ` Masami Hiramatsu
2017-11-28  0:23 ` [PATCH 12/12] perf, tools, script: Implement dwarf resolving of instructions Andi Kleen
2017-12-01  2:36   ` Masami Hiramatsu
2017-11-28  5:31 ` Implement dwarf variable/type resolving for perf script Masami Hiramatsu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171128002321.2878-7-andi@firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox