public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>,
	Stephane Eranian <eranian@google.com>
Cc: linux-kernel@vger.kernel.org, acme@redhat.com, mingo@elte.hu
Subject: Re: [PATCH] perf: make perf.data more self-descriptive (v4)
Date: Fri, 16 Sep 2011 09:33:46 -0600	[thread overview]
Message-ID: <4E736C5A.1040502@gmail.com> (raw)
In-Reply-To: <1316186353.10174.29.camel@twins>



On 09/16/2011 09:19 AM, Peter Zijlstra wrote:
> On Fri, 2011-09-16 at 08:50 -0600, David Ahern wrote:
>>
>> ppc data file: header->magic 454c494646524550
>> x86 data file: header->magic 454c494646524550
>>
> Ok then we need to fix that magic thing..

Right, but it breaks backwards/forwards compatibility. e.g.,

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 73fa59e..603a8bb9 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -65,9 +65,7 @@ char *perf_header__find_event(u64 id)
    return NULL;
 }

-static const char *__perf_magic = "PERFFILE";
-
-#define PERF_MAGIC (*(u64 *)__perf_magic)
+#define PERF_MAGIC 0x5045524646494c45ULL  // "PERFFILE"

 struct perf_file_attr {
    struct perf_event_attr  attr;

That puts the magic in the file based on endianness of the recording
system. e.g., on x86:

$ od -c perf-magic.data | head -1
0000000   E   L   I   F   F   R   E   P   h  \0  \0  \0  \0  \0  \0  \0

Which means older perf binaries can't analyze new files (created with
new magic order) and newer perf binaries can't analyze older perf files
-- the new command will incorrectly want to do endian swapping on the
old file.

David

  reply	other threads:[~2011-09-16 15:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-07 19:10 [PATCH] perf: make perf.data more self-descriptive (v4) Stephane Eranian
2011-09-08 15:27 ` David Ahern
     [not found]   ` <CABPqkBRKcxeTDMyVYPXU6AQEY-Hp2bnE03ebEtvjYWde2JKqoQ@mail.gmail.com>
2011-09-08 15:37     ` David Ahern
2011-09-08 15:42   ` Stephane Eranian
2011-09-12 13:45 ` David Ahern
2011-09-12 13:54   ` Stephane Eranian
2011-09-12 14:33     ` David Ahern
2011-09-12 14:40       ` Stephane Eranian
2011-09-12 14:43         ` Peter Zijlstra
2011-09-12 14:47           ` Stephane Eranian
2011-09-13 14:40             ` Arnaldo Carvalho de Melo
2011-09-16 14:35           ` Stephane Eranian
2011-09-16 14:37             ` Peter Zijlstra
2011-09-16 14:44               ` Stephane Eranian
2011-09-16 14:52                 ` David Ahern
2011-09-16 14:56                   ` Stephane Eranian
2011-09-16 14:50             ` David Ahern
2011-09-16 15:19               ` Peter Zijlstra
2011-09-16 15:33                 ` David Ahern [this message]
2011-09-16 15:42                   ` Peter Zijlstra
2011-09-16 16:34                   ` Stephane Eranian

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=4E736C5A.1040502@gmail.com \
    --to=dsahern@gmail.com \
    --cc=acme@redhat.com \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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