mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for David Ahern <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: mingo@kernel.org, david.ahern@oracle.com, jolsa@kernel.org,
	linux-kernel@vger.kernel.org, tglx@linutronix.de,
	namhyung@kernel.org, acme@redhat.com, hpa@zytor.com
Subject: [tip:perf/core] perf tools: Fix cross-endian analysis
Date: Fri, 10 Apr 2015 23:37:15 -0700	[thread overview]
Message-ID: <tip-1060ab857f64f33a9445881fd31fa91470aeb622@git.kernel.org> (raw)
In-Reply-To: <1428610546-178789-1-git-send-email-david.ahern@oracle.com>

Commit-ID:  1060ab857f64f33a9445881fd31fa91470aeb622
Gitweb:     http://git.kernel.org/tip/1060ab857f64f33a9445881fd31fa91470aeb622
Author:     David Ahern <david.ahern@oracle.com>
AuthorDate: Thu, 9 Apr 2015 16:15:46 -0400
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 10 Apr 2015 10:13:58 -0300

perf tools: Fix cross-endian analysis

Trying to analyze a big endian data file on little endian system fails
with the error:

  0xa9b40 [0x70]: failed to process type: 9

The problem is that header parsing is not done correctly because the
file attributes are not swapped. Make it so. With this patch able to
analyze a sparc64 data file on x86_64.

Signed-off-by: David Ahern <david.ahern@oracle.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1428610546-178789-1-git-send-email-david.ahern@oracle.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/header.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index fff3b2a..918fd8a 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -2504,8 +2504,11 @@ int perf_session__read_header(struct perf_session *session)
 		if (read_attr(fd, header, &f_attr) < 0)
 			goto out_errno;
 
-		if (header->needs_swap)
+		if (header->needs_swap) {
+			f_attr.ids.size   = bswap_64(f_attr.ids.size);
+			f_attr.ids.offset = bswap_64(f_attr.ids.offset);
 			perf_event__attr_swap(&f_attr.attr);
+		}
 
 		tmp = lseek(fd, 0, SEEK_CUR);
 		evsel = perf_evsel__new(&f_attr.attr);

      parent reply	other threads:[~2015-04-11  6:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-09 20:15 [PATCH] perf tool: " David Ahern
2015-04-10  8:27 ` Jiri Olsa
2015-04-10 12:49   ` Arnaldo Carvalho de Melo
2015-04-10 13:52   ` David Ahern
2015-04-11  6:37 ` tip-bot for David Ahern [this message]

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=tip-1060ab857f64f33a9445881fd31fa91470aeb622@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=david.ahern@oracle.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=tglx@linutronix.de \
    /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