lkml.org 
[lkml]   [2021]   [Jun]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] tools/perf probe: Print a hint if adding a probe fails
Date
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

\
 
 \ /
  Last update: 2021-06-10 11:46    [W:0.056 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site