From: David Ahern <dsahern@gmail.com>
To: Stephane Eranian <eranian@google.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
LKML <linux-kernel@vger.kernel.org>,
Mike Galbraith <efault@gmx.de>, Ingo Molnar <mingo@kernel.org>,
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: Mon, 06 May 2013 18:05:30 -0600 [thread overview]
Message-ID: <5188454A.4070700@gmail.com> (raw)
In-Reply-To: <CABPqkBTj6Jt82mvVJKJxXaGnbD5GbW5mo4L71StOZuA=8MwDdw@mail.gmail.com>
On 5/6/13 4:40 PM, Stephane Eranian wrote:
> This is a good fix. I have run into this infinite loop in perf report
> many times.
The perf_file_header could use an 'I am sane' bit which is only set when
the file is closed properly. Perhaps we could overload the magic field
like this:
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 326068a..cd9fad6 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -2364,7 +2364,6 @@ out_err_write:
}
f_header = (struct perf_file_header){
- .magic = PERF_MAGIC,
.size = sizeof(f_header),
.attr_size = sizeof(f_attr),
.attrs = {
@@ -2382,6 +2381,8 @@ out_err_write:
};
memcpy(&f_header.adds_features, &header->adds_features,
sizeof(header->adds_features));
+ if (at_exit)
+ f_header.magic = PERF_MAGIC,
lseek(fd, 0, SEEK_SET);
err = do_write(fd, &f_header, sizeof(f_header));
The perf magic is only written when the file is closed properly. In
Mike's case you end up with the message (which can be enhanced)
magic/endian check failed
incompatible file format (rerun with -v to learn more)
which is better than an infinite loop.
David
next prev parent reply other threads:[~2013-05-07 0:05 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 [this message]
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
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=5188454A.4070700@gmail.com \
--to=dsahern@gmail.com \
--cc=acme@ghostprotocols.net \
--cc=efault@gmx.de \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.