From: Jiri Olsa <jolsa@redhat.com>
To: acme@redhat.com, a.p.zijlstra@chello.nl, mingo@elte.hu,
paulus@samba.org, cjashfor@linux.vnet.ibm.com,
fweisbec@gmail.com
Cc: linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@redhat.com>
Subject: [PATCH 3/3] perf, tool: Fail on processing event with unknown size
Date: Thu, 12 Apr 2012 14:21:02 +0200 [thread overview]
Message-ID: <1334233262-5679-4-git-send-email-jolsa@redhat.com> (raw)
In-Reply-To: <1334233262-5679-1-git-send-email-jolsa@redhat.com>
Currently if we cannot decide the size of the event, we guess next
event possition by:
"... check alignment, and increment a single u64 in the hope
to catch on again 'soon'"
This usually ends up with segfault or endless loop. It's better
to admit the failure right away, then pretend nothing happened.
It makes the life easier.. ;)
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
tools/perf/util/session.c | 28 +++++++---------------------
1 files changed, 7 insertions(+), 21 deletions(-)
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 9189751..fa0528b 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1100,16 +1100,9 @@ more:
}
if ((skip = perf_session__process_event(self, &event, tool, head)) < 0) {
- dump_printf("%#" PRIx64 " [%#x]: skipping unknown header type: %d\n",
- head, event.header.size, event.header.type);
- /*
- * assume we lost track of the stream, check alignment, and
- * increment a single u64 in the hope to catch on again 'soon'.
- */
- if (unlikely(head & 7))
- head &= ~7ULL;
-
- size = 8;
+ pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n",
+ head, event.header.size, event.header.type);
+ goto out_err;
}
head += size;
@@ -1218,17 +1211,10 @@ more:
if (size == 0 ||
perf_session__process_event(session, event, tool, file_pos) < 0) {
- dump_printf("%#" PRIx64 " [%#x]: skipping unknown header type: %d\n",
- file_offset + head, event->header.size,
- event->header.type);
- /*
- * assume we lost track of the stream, check alignment, and
- * increment a single u64 in the hope to catch on again 'soon'.
- */
- if (unlikely(head & 7))
- head &= ~7ULL;
-
- size = 8;
+ pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n",
+ file_offset + head, event->header.size,
+ event->header.type);
+ goto out_err;
}
head += size;
--
1.7.1
next prev parent reply other threads:[~2012-04-12 12:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-12 12:20 [PATCH 0/3] perf, tool: kvm record & event processing fixies Jiri Olsa
2012-04-12 12:21 ` [PATCH 1/3] perf, tool: Force guest machine definition option Jiri Olsa
2012-04-12 14:40 ` David Ahern
2012-04-13 11:32 ` Jiri Olsa
2012-04-13 12:21 ` David Ahern
2012-04-13 12:41 ` Jiri Olsa
2012-04-13 14:15 ` David Ahern
2012-04-15 14:05 ` Jiri Olsa
2012-04-15 21:32 ` David Ahern
2012-04-12 12:21 ` [PATCH 2/3] perf, tool: Skip event correctly for unknown id/machine Jiri Olsa
2012-04-15 8:34 ` [tip:perf/urgent] perf session: " tip-bot for Jiri Olsa
2012-04-12 12:21 ` Jiri Olsa [this message]
2012-04-16 18:42 ` [PATCHv2 3/3] perf, tool: Fail on processing event with unknown size Jiri Olsa
2012-05-11 6:37 ` [tip:perf/core] perf session: " tip-bot for 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=1334233262-5679-4-git-send-email-jolsa@redhat.com \
--to=jolsa@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=cjashfor@linux.vnet.ibm.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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
Powered by JetHome