From: Ingo Molnar <mingo@kernel.org>
To: David Ahern <dsahern@gmail.com>
Cc: Stephane Eranian <eranian@google.com>,
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
LKML <linux-kernel@vger.kernel.org>,
Mike Galbraith <efault@gmx.de>,
Frederic Weisbecker <fweisbec@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>
Subject: Re: [PATCH] perf record: handle death by SIGTERM
Date: Wed, 8 May 2013 08:54:47 +0200 [thread overview]
Message-ID: <20130508065447.GB5378@gmail.com> (raw)
In-Reply-To: <51896A71.8010007@gmail.com>
* David Ahern <dsahern@gmail.com> wrote:
> On 5/7/13 12:29 AM, Ingo Molnar wrote:
> >
> >* Stephane Eranian <eranian@google.com> wrote:
> >
> >>This is a good fix. I have run into this infinite loop in perf report
> >>many times.
> >
> >Hm, perf record should really not assume much about the perf.data and
> >should avoid infinite loops ...
> >
> >So while making perf.data more consistent on SIGTERM is a nice fix, perf
> >report should be fixed as well to detect loops and such.
> >
> >Thanks,
> >
> > Ingo
> >
>
> This seems to do the trick:
>
> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> index 326068a..e82646f 100644
> --- a/tools/perf/util/header.c
> +++ b/tools/perf/util/header.c
> @@ -2802,6 +2802,17 @@ int perf_session__read_header(struct
> perf_session *session, int fd)
> if (perf_file_header__read(&f_header, header, fd) < 0)
> return -EINVAL;
>
> + /*
> + * sanity check that perf.data was written cleanly: data size
> + * is initialized to 0 and updated only if the on_exit function
> + * is run. If data size is still 0 then the file cannot be
> + * processed.
> + */
> + if (f_header.data.size == 0) {
> + pr_err("data size is 0. Was record properly terminated?\n");
> + return -1;
> + }
Hm, this detects the condition - but where does the looping come from?
Can it happen with a perf.data that 'seems' clean but is corrupted
(because not fully written, buggy kernel just crashed, etc.).
In essence it would be _very_ nice if someone reproduced the looping and
checked what to do to fix the looping itself. Or does the above
data.size == 0 check fully fix the looping under every possible state of a
perf.data?
Thanks,
Ingo
next prev parent reply other threads:[~2013-05-08 6:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-06 18:24 [PATCH] perf record: handle death by SIGTERM David Ahern
2013-05-06 18:45 ` David Ahern
2013-05-06 22:40 ` Stephane Eranian
2013-05-07 0:05 ` David Ahern
2013-05-07 6:29 ` Ingo Molnar
2013-05-07 20:56 ` David Ahern
2013-05-08 6:17 ` Namhyung Kim
2013-05-08 6:54 ` Ingo Molnar [this message]
2013-05-08 13:48 ` David Ahern
2013-05-24 9:08 ` Jiri Olsa
2013-05-24 14:11 ` David Ahern
2013-05-31 11:33 ` [tip:perf/core] " tip-bot for David Ahern
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=20130508065447.GB5378@gmail.com \
--to=mingo@kernel.org \
--cc=acme@ghostprotocols.net \
--cc=dsahern@gmail.com \
--cc=efault@gmx.de \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.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).