All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
To: <linux-kernel@vger.kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
Subject: [PATCH] tools/perf probe: Print a hint if adding a probe fails
Date: Thu, 10 Jun 2021 15:14:42 +0530	[thread overview]
Message-ID: <20210610094442.1602714-1-naveen.n.rao@linux.vnet.ibm.com> (raw)

Adding a probe can fail in a few scenarios. perf already checks for the
address in the kprobe blacklist. However, the address could still be a
jump label, or have a BUG_ON(). In such cases, it isn't always evident
why adding the probe failed. Add a hint so that the user knows how to
proceed.

Reported-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
 tools/perf/builtin-probe.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 6b150756677014..ff9f3fdce600dd 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -352,8 +352,11 @@ static int perf_add_probe_events(struct perf_probe_event *pevs, int npevs)
 	}
 
 	ret = apply_perf_probe_events(pevs, npevs);
-	if (ret < 0)
+	if (ret < 0) {
+		pr_info("Hint: Check dmesg to understand reason for probe failure.\n"
+			"      Consider probing at the next/previous instruction.\n");
 		goto out_cleanup;
+	}
 
 	for (i = k = 0; i < npevs; i++)
 		k += pevs[i].ntevs;

base-commit: 0808b3d5b7514dc856178dbc509929329bbf301d
-- 
2.31.1


             reply	other threads:[~2021-06-10  9:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10  9:44 Naveen N. Rao [this message]
2021-06-10 10:29 ` [PATCH] tools/perf probe: Print a hint if adding a probe fails Masami Hiramatsu
2021-06-18 13:15   ` Arnaldo Carvalho de Melo
2021-06-21  9:40     ` Naveen N. Rao

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=20210610094442.1602714-1-naveen.n.rao@linux.vnet.ibm.com \
    --to=naveen.n.rao@linux.vnet.ibm.com \
    --cc=acme@kernel.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.