mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Jiri Olsa <jolsa@redhat.com>,
	Corey Ashford <cjashfor@linux.vnet.ibm.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@elte.hu>, Namhyung Kim <namhyung@kernel.org>,
	Paul Mackerras <paulus@samba.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	David Ahern <dsahern@gmail.com>, Andi Kleen <andi@firstfloor.org>
Subject: [PATCH 4/6] perf tools: Add PERF_EVLIST__ERRNO_IOCTL_ID_GROUP internal error
Date: Fri, 29 Nov 2013 12:45:08 +0100	[thread overview]
Message-ID: <1385725510-20118-5-git-send-email-jolsa@redhat.com> (raw)
In-Reply-To: <1385725510-20118-1-git-send-email-jolsa@redhat.com>

Adding internal error (PERF_EVLIST__ERRNO_IOCTL_ID_GROUP) for
cases when ioctl syscall fails during perf_evlist__mmap call.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Andi Kleen <andi@firstfloor.org>
---
 tools/perf/util/evlist.c | 9 ++++++++-
 tools/perf/util/evlist.h | 1 +
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 4af0cca..f9c5abd 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -399,8 +399,10 @@ static int perf_evlist__id_add_fd(struct perf_evlist *evlist,
 	 * This way does not work with group format read, so bail
 	 * out in that case.
 	 */
-	if (perf_evlist__read_format(evlist) & PERF_FORMAT_GROUP)
+	if (perf_evlist__read_format(evlist) & PERF_FORMAT_GROUP) {
+		SET_ERR(IOCTL_ID_GROUP);
 		return -1;
+	}
 
 	if (!(evsel->attr.read_format & PERF_FORMAT_ID) ||
 	    read(fd, &read_data, sizeof(read_data)) == -1)
@@ -676,6 +678,11 @@ static void __perf_evlist__strerror(struct perf_evlist *evlist,
 	case PERF_EVLIST__ERRNO_OPEN:
 		strerror_open(evlist, buf, size);
 		return;
+	case PERF_EVLIST__ERRNO_IOCTL_ID_GROUP:
+		scnprintf(buf, size,
+			"Cannot read event group on this kernel.\n"
+			"Please consider kernel update (v3.12+).\n");
+		return;
 	default:
 		scnprintf(buf, size, "Unknown error\n");
 		return;
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 48ac4c5..e5ce8c7 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -21,6 +21,7 @@ enum {
 	PERF_EVLIST__ERRNO_SUCCESS		= 0,
 	PERF_EVLIST__ERRNO_MMAP			= 1,
 	PERF_EVLIST__ERRNO_OPEN			= 2,
+	PERF_EVLIST__ERRNO_IOCTL_ID_GROUP	= 3,
 };
 
 struct perf_mmap {
-- 
1.8.3.1


  parent reply	other threads:[~2013-11-29 11:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-29 11:45 [RFC 0/6] perf tools: Add perf_evlist errno Jiri Olsa
2013-11-29 11:45 ` [PATCH 1/6] perf tools: Add perf_evlist error string interface Jiri Olsa
2013-11-29 11:45 ` [PATCH 2/6] perf tools: Add PERF_EVLIST__ERRNO_MMAP internal error Jiri Olsa
2013-11-29 11:45 ` [PATCH 3/6] perf tools: Add PERF_EVLIST__ERRNO_OPEN " Jiri Olsa
2013-11-29 11:45 ` Jiri Olsa [this message]
2013-11-29 11:45 ` [PATCH 5/6] perf tools: Add PERF_EVLIST__ERRNO_NEWTP " Jiri Olsa
2013-11-29 11:45 ` [PATCH 6/6] perf tools: Use perf_evlist__strerror in kvm/record/top/trace commands Jiri Olsa
2013-12-02  8:19 ` [RFC 0/6] perf tools: Add perf_evlist errno Namhyung Kim
2013-12-05  9:29   ` Jiri Olsa

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=1385725510-20118-5-git-send-email-jolsa@redhat.com \
    --to=jolsa@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=andi@firstfloor.org \
    --cc=cjashfor@linux.vnet.ibm.com \
    --cc=dsahern@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.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®