forked from luck/tmp_suning_uos_patched
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>
This commit is contained in:
parent
2c193c7368
commit
794e43b56c
@ -696,7 +696,9 @@ static int __perf_session__process_pipe_events(struct perf_session *self,
|
|||||||
p = &event;
|
p = &event;
|
||||||
p += sizeof(struct perf_event_header);
|
p += sizeof(struct perf_event_header);
|
||||||
|
|
||||||
err = do_read(self->fd, p, size - sizeof(struct perf_event_header));
|
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) {
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
pr_err("unexpected end of event stream\n");
|
pr_err("unexpected end of event stream\n");
|
||||||
@ -706,6 +708,7 @@ static int __perf_session__process_pipe_events(struct perf_session *self,
|
|||||||
pr_err("failed to read event data\n");
|
pr_err("failed to read event data\n");
|
||||||
goto out_err;
|
goto out_err;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (size == 0 ||
|
if (size == 0 ||
|
||||||
(skip = perf_session__process_event(self, &event, ops,
|
(skip = perf_session__process_event(self, &event, ops,
|
||||||
|
Loading…
Reference in New Issue
Block a user