Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932862AbbDKGiH (ORCPT ); Sat, 11 Apr 2015 02:38:07 -0400 Received: from terminus.zytor.com ([198.137.202.10]:51113 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751941AbbDKGiD (ORCPT ); Sat, 11 Apr 2015 02:38:03 -0400 Date: Fri, 10 Apr 2015 23:37:15 -0700 From: tip-bot for David Ahern Message-ID: 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 Reply-To: tglx@linutronix.de, linux-kernel@vger.kernel.org, hpa@zytor.com, namhyung@kernel.org, acme@redhat.com, mingo@kernel.org, jolsa@kernel.org, david.ahern@oracle.com In-Reply-To: <1428610546-178789-1-git-send-email-david.ahern@oracle.com> References: <1428610546-178789-1-git-send-email-david.ahern@oracle.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf tools: Fix cross-endian analysis Git-Commit-ID: 1060ab857f64f33a9445881fd31fa91470aeb622 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1873 Lines: 49 Commit-ID: 1060ab857f64f33a9445881fd31fa91470aeb622 Gitweb: http://git.kernel.org/tip/1060ab857f64f33a9445881fd31fa91470aeb622 Author: David Ahern AuthorDate: Thu, 9 Apr 2015 16:15:46 -0400 Committer: Arnaldo Carvalho de Melo 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 Acked-by: Jiri Olsa Cc: Namhyung Kim Link: http://lkml.kernel.org/r/1428610546-178789-1-git-send-email-david.ahern@oracle.com Signed-off-by: Arnaldo Carvalho de Melo --- 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); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/