mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: He Zhe <zhe.he@windriver.com>
To: catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, jolsa@redhat.com,
	namhyung@kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] perf tools: Improve EOPNOTSUPP error reporting
Date: Tue, 23 Feb 2021 16:25:35 +0800	[thread overview]
Message-ID: <20210223082535.48730-2-zhe.he@windriver.com> (raw)
In-Reply-To: <20210223082535.48730-1-zhe.he@windriver.com>

There may be multiple reasons for EOPNOTSUPP. Sometimes we cannot determine
which one it is.

For example, when we set up uprobe with 32-bit perf and arm64 kernel on
some hardware that does not support sampling/overflow-interrupts,
$ perf probe -x /lib/libc.so.6 malloc
$ perf record -e probe_libc:malloc -a ls

Before this patch:
probe_libc:malloc: PMU Hardware doesn't support sampling/overflow-interrupts. Try 'perf stat'

After this patch:
probe_libc:malloc: PMU Hardware may not support sampling/overflow-interrupts. Try 'perf stat'.
Some 64-bit architectures may not support 32-bit instruction probing.

Signed-off-by: He Zhe <zhe.he@windriver.com>
---
 tools/perf/util/evsel.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 1bf76864c4f2..aa56511ddf60 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -2697,22 +2697,24 @@ int evsel__open_strerror(struct evsel *evsel, struct target *target,
 		break;
 	case EOPNOTSUPP:
 		if (evsel->core.attr.aux_output)
-			return scnprintf(msg, size,
-	"%s: PMU Hardware doesn't support 'aux_output' feature",
+			printed += scnprintf(msg + printed, size,
+	"%s: PMU Hardware may not support 'aux_output' feature.\n",
 					 evsel__name(evsel));
 		if (evsel->core.attr.sample_period != 0)
-			return scnprintf(msg, size,
-	"%s: PMU Hardware doesn't support sampling/overflow-interrupts. Try 'perf stat'",
+			printed += scnprintf(msg + printed, size,
+	"%s: PMU Hardware doesn't support sampling/overflow-interrupts. Try 'perf stat'.\n",
 					 evsel__name(evsel));
 		if (evsel->core.attr.precise_ip)
-			return scnprintf(msg, size, "%s",
-	"\'precise\' request may not be supported. Try removing 'p' modifier.");
+			printed += scnprintf(msg + printed, size, "%s",
+	"\'precise\' request may not be supported. Try removing 'p' modifier.\n");
 #if defined(__i386__) || defined(__x86_64__)
 		if (evsel->core.attr.type == PERF_TYPE_HARDWARE)
-			return scnprintf(msg, size, "%s",
+			printed += scnprintf(msg + printed, size, "%s",
 	"No hardware sampling interrupt available.\n");
 #endif
-		break;
+		scnprintf(msg + printed, size, "%s",
+	"Some 64-bit architectures may not support 32-bit instruction uprobe.\n");
+		return;
 	case EBUSY:
 		if (find_process("oprofiled"))
 			return scnprintf(msg, size,
-- 
2.17.1


  reply	other threads:[~2021-02-23  8:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-23  8:25 [PATCH 1/2] arm64: uprobe: Return EOPNOTSUPP for AARCH32 instruction probing He Zhe
2021-02-23  8:25 ` He Zhe [this message]
2021-03-03  8:30   ` [PATCH 2/2] perf tools: Improve EOPNOTSUPP error reporting He Zhe
2021-02-23 15:28 ` [PATCH 1/2] arm64: uprobe: Return EOPNOTSUPP for AARCH32 instruction probing Will Deacon

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=20210223082535.48730-2-zhe.he@windriver.com \
    --to=zhe.he@windriver.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=catalin.marinas@arm.com \
    --cc=jolsa@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=namhyung@kernel.org \
    --cc=will@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

all inboxes | Powered by JetHome®