From: tip-bot for Tom Zanussi <tzanussi@gmail.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, paulus@samba.org, acme@redhat.com,
hpa@zytor.com, mingo@redhat.com, tzanussi@gmail.com,
a.p.zijlstra@chello.nl, fweisbec@gmail.com, tglx@linutronix.de,
mhiramat@redhat.com, mingo@elte.hu
Subject: [tip:perf/core] perf/live-mode: Handle payload-less events
Date: Mon, 10 May 2010 07:21:33 GMT [thread overview]
Message-ID: <tip-794e43b56c18b95fc9776c914a2659e7d558a352@git.kernel.org> (raw)
In-Reply-To: <1273038527.6383.51.camel@tropicana>
Commit-ID: 794e43b56c18b95fc9776c914a2659e7d558a352
Gitweb: http://git.kernel.org/tip/794e43b56c18b95fc9776c914a2659e7d558a352
Author: Tom Zanussi <tzanussi@gmail.com>
AuthorDate: Wed, 5 May 2010 00:27:40 -0500
Committer: Frederic Weisbecker <fweisbec@gmail.com>
CommitDate: Sun, 9 May 2010 13:49:52 +0200
perf/live-mode: Handle payload-less events
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 ||
prev parent reply other threads:[~2010-05-10 7:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-05 0:03 [PATCH 0/2] perf: Redesign trace events reordering Frederic Weisbecker
2010-05-05 0:03 ` [PATCH 1/2] perf: Introduce a new "round of buffers read" pseudo event Frederic Weisbecker
2010-05-05 0:03 ` [PATCH 2/2] perf: Provide a new deterministic events reordering algorithm Frederic Weisbecker
2010-05-05 5:48 ` [PATCH 0/2] perf: Redesign trace events reordering Tom Zanussi
2010-05-08 15:54 ` Frederic Weisbecker
2010-05-10 7:21 ` tip-bot for Tom Zanussi [this message]
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=tip-794e43b56c18b95fc9776c914a2659e7d558a352@git.kernel.org \
--to=tzanussi@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mhiramat@redhat.com \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=paulus@samba.org \
--cc=tglx@linutronix.de \
/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
Powered by JetHome