From: Frederic Weisbecker <fweisbec@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: LKML <linux-kernel@vger.kernel.org>,
Tom Zanussi <tzanussi@gmail.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>,
Masami Hiramatsu <mhiramat@redhat.com>,
Frederic Weisbecker <fweisbec@gmail.com>
Subject: [PATCH 09/10] perf/live-mode: Handle payload-less events
Date: Sun, 9 May 2010 22:43:37 +0200 [thread overview]
Message-ID: <1273437818-8130-10-git-send-regression-fweisbec@gmail.com> (raw)
In-Reply-To: <1273437818-8130-1-git-send-regression-fweisbec@gmail.com>
From: Tom Zanussi <tzanussi@gmail.com>
Some events, such as the PERF_RECORD_FINISHED_ROUND event consist of
only an event header and no data. In this case, a 0-length payload
will be read, and the 0 return value will be wrongly interpreted as an
'unexpected end of event stream'.
This patch allows for proper handling of data-less events by skipping
0-length reads.
Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Masami Hiramatsu <mhiramat@redhat.com>
LKML-Reference: <1273038527.6383.51.camel@tropicana>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
tools/perf/util/session.c | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 9401909..00ab298 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -696,15 +696,18 @@ more:
p = &event;
p += sizeof(struct perf_event_header);
- err = do_read(self->fd, p, size - sizeof(struct perf_event_header));
- if (err <= 0) {
- if (err == 0) {
- pr_err("unexpected end of event stream\n");
- goto done;
- }
+ if (size - sizeof(struct perf_event_header)) {
+ err = do_read(self->fd, p,
+ size - sizeof(struct perf_event_header));
+ if (err <= 0) {
+ if (err == 0) {
+ pr_err("unexpected end of event stream\n");
+ goto done;
+ }
- pr_err("failed to read event data\n");
- goto out_err;
+ pr_err("failed to read event data\n");
+ goto out_err;
+ }
}
if (size == 0 ||
--
1.6.2.3
next prev parent reply other threads:[~2010-05-09 20:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-09 20:43 [GIT PULL] perf updates Frederic Weisbecker
2010-05-09 20:43 ` [PATCH 01/10] perf lock: Add "info" subcommand for dumping misc information Frederic Weisbecker
2010-05-09 20:43 ` [PATCH 02/10] perf: Cleanup perf lock broken states Frederic Weisbecker
2010-05-09 20:43 ` [PATCH 03/10] perf: Humanize lock flags in perf lock Frederic Weisbecker
2010-05-09 20:43 ` [PATCH 04/10] perf: Fix perf lock bad rate Frederic Weisbecker
2010-05-09 20:43 ` [PATCH 05/10] perf lock: Always check min AND max wait time Frederic Weisbecker
2010-05-09 20:43 ` [PATCH 06/10] tracing: Drop lock_acquired waittime field Frederic Weisbecker
2010-05-09 20:43 ` [PATCH 07/10] tracing: Drop the nested field from lock_release event Frederic Weisbecker
2010-05-09 20:43 ` [PATCH 08/10] tracing: Factorize lock events in a lock class Frederic Weisbecker
2010-05-09 20:43 ` Frederic Weisbecker [this message]
2010-05-09 20:43 ` [PATCH 10/10] perf lock: Drop "-a" option from cmd_record() default arguments set Frederic Weisbecker
2010-05-10 5:10 ` [GIT PULL] perf updates Frederic Weisbecker
2010-05-10 6:46 ` 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=1273437818-8130-10-git-send-regression-fweisbec@gmail.com \
--to=fweisbec@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@redhat.com \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=tzanussi@gmail.com \
/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).