linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@redhat.com>,
	Corey Ashford <cjashfor@linux.vnet.ibm.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Paul Mackerras <paulus@samba.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 05/47] perf evlist: Fix event ID retrieval for group format read case
Date: Wed,  7 Aug 2013 18:10:32 -0300	[thread overview]
Message-ID: <1375909874-22073-6-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1375909874-22073-1-git-send-email-acme@infradead.org>

From: Jiri Olsa <jolsa@redhat.com>

We need to fail the event ID retrieval in case both following conditions
are true:

  - we are on kernel with no PERF_EVENT_IOC_ID support
  - PERF_FORMAT_GROUP read format is set

The PERF_FORMAT_GROUP read format bit is the killer for retrieving event
ID out of the read syscall, because we have no guarantee of the event
placement within leader kernel sibling list.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-e93pgyj20rqx48qzw10vj4r4@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evlist.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index df77a44..10fcc03 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -314,6 +314,13 @@ static int perf_evlist__id_add_fd(struct perf_evlist *evlist,
 
 	/* Legacy way to get event id.. All hail to old kernels! */
 
+	/*
+	 * This way does not work with group format read, so bail
+	 * out in that case.
+	 */
+	if (perf_evlist__read_format(evlist) & PERF_FORMAT_GROUP)
+		return -1;
+
 	if (!(evsel->attr.read_format & PERF_FORMAT_ID) ||
 	    read(fd, &read_data, sizeof(read_data)) == -1)
 		return -1;
-- 
1.8.1.4


  parent reply	other threads:[~2013-08-07 21:22 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-07 21:10 [GIT PULL 00/47] perf/core improvements and fixes Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 01/47] perf: Add PERF_EVENT_IOC_ID ioctl to return event ID Arnaldo Carvalho de Melo
2013-08-09 14:50   ` Vince Weaver
2013-08-10 12:11     ` Jiri Olsa
2013-08-07 21:10 ` [PATCH 02/47] perf: Do not get values from disabled counters in group format read Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 03/47] perf evlist: Use PERF_EVENT_IOC_ID perf ioctl to read event id Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 04/47] perf tools: Add support for parsing PERF_SAMPLE_READ sample type Arnaldo Carvalho de Melo
2013-08-07 21:10 ` Arnaldo Carvalho de Melo [this message]
2013-08-07 21:10 ` [PATCH 06/47] perf evlist: Add perf_evlist__id2sid method to get event ID related data Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 07/47] perf evsel: Add PERF_SAMPLE_READ sample related processing Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 08/47] perf tools: Add 'S' event/group modifier to read sample value Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 09/47] perf tests: Add attr record group sampling test Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 10/47] perf tests: Add parse events tests for leader sampling Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 11/47] perf evsel: Actually show symbol offset in stack trace when requested Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 12/47] perf tools: Fix compile of util/tsc.c Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 13/47] perf trace: Beautify 'connect' result Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 14/47] perf python: Remove duplicate TID bit from mask Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 15/47] perf util: Add parse_nsec_time() function Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 16/47] perf top: move CONSOLE_CLEAR to header file Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 17/47] perf stats: Add max and min stats Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 18/47] perf session: Export a few functions for event processing Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 19/47] perf kvm: Split out tracepoints from record args Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 20/47] perf evlist: Remove obsolete dummy execve Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 21/47] perf evsel: Add support for enabling counters Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 22/47] perf stat: Add support for --initial-delay option Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 23/47] perf stat: Flush output after each line in interval mode Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 24/47] perf symbols: avoid SyS kernel syscall aliases Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 25/47] perf tests: Add test for reading object code Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 26/47] perf symbols: Load kernel maps before using Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 27/47] perf tools: Make it possible to read object code from vmlinux Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 28/47] perf tests: Adjust the vmlinux symtab matches kallsyms test Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 29/47] perf tools: Make it possible to read object code from kernel modules Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 30/47] perf symbols: Add support for reading from /proc/kcore Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 31/47] perf tests: Adjust the vmlinux symtab matches kallsyms test again Arnaldo Carvalho de Melo
2013-08-07 21:10 ` [PATCH 32/47] perf tests: Add kcore to the object code reading test Arnaldo Carvalho de Melo
2013-08-07 21:11 ` [PATCH 33/47] perf annotate: Allow disassembly using /proc/kcore Arnaldo Carvalho de Melo
2013-08-07 21:11 ` [PATCH 34/47] perf annotate: Put dso name in symbol annotation title Arnaldo Carvalho de Melo
2013-08-07 21:11 ` [PATCH 35/47] perf annotate: Remove nop at end of annotation Arnaldo Carvalho de Melo
2013-08-07 21:11 ` [PATCH 36/47] perf annotate: Add call target name if it is missing Arnaldo Carvalho de Melo
2013-08-07 21:11 ` [PATCH 37/47] perf annotate browser: Improve description of '?' hotkey Arnaldo Carvalho de Melo
2013-08-07 21:11 ` [PATCH 38/47] perf annotate browser: Fix typo Arnaldo Carvalho de Melo
2013-08-07 21:11 ` [PATCH 39/47] perf session: Export queue_event function Arnaldo Carvalho de Melo
2013-08-07 21:11 ` [PATCH 40/47] perf kvm: Add live mode Arnaldo Carvalho de Melo
2013-08-07 21:11 ` [PATCH 41/47] perf kvm: Add min and max stats to display Arnaldo Carvalho de Melo
2013-08-07 21:11 ` [PATCH 42/47] perf kvm stat report: Add option to analyze specific VM Arnaldo Carvalho de Melo
2013-08-07 21:11 ` [PATCH 43/47] perf ui/gtk: Fix segmentation fault on perf_hpp__for_each_format loop Arnaldo Carvalho de Melo
2013-08-07 21:11 ` [PATCH 44/47] perf tools: Add support for pinned modifier Arnaldo Carvalho de Melo
2013-08-07 21:11 ` [PATCH 45/47] perf tests: Add tests of new " Arnaldo Carvalho de Melo
2013-08-07 21:11 ` [PATCH 46/47] perf machine: Do not require /lib/modules/* on a guest Arnaldo Carvalho de Melo
2013-08-07 21:11 ` [PATCH 47/47] Revert "tools lib lk: Fix for cross build" Arnaldo Carvalho de Melo
2013-08-12  8:17 ` [GIT PULL 00/47] perf/core improvements and fixes Ingo Molnar

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=1375909874-22073-6-git-send-email-acme@infradead.org \
    --to=acme@infradead.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=cjashfor@linux.vnet.ibm.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).