From: David Ahern <dsahern@gmail.com>
To: Stephane Eranian <eranian@google.com>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
mingo@elte.hu, acme@redhat.com, robert.richter@amd.com,
ming.m.lin@intel.com, andi@firstfloor.org, asharma@fb.com,
ravitillo@lbl.gov, vweaver1@eecs.utk.edu,
khandual@linux.vnet.ibm.com
Subject: Re: [PATCH v6 16/18] perf: enable reading of perf.data files from different ABI rev
Date: Thu, 09 Feb 2012 15:46:55 -0700 [thread overview]
Message-ID: <4F344CDF.8060206@gmail.com> (raw)
In-Reply-To: <CABPqkBQZFT=GHNg8nNagrAtf+dy4vFzCzp1t1nmpv6HWBEEoLg@mail.gmail.com>
On 02/09/2012 03:41 PM, Stephane Eranian wrote:
>>> + /* read perf_file_section, ids are read in caller */
>>> + ret = readn(fd, &f_attr->ids, sizeof(f_attr->ids));
>>
>> I thought the above 2 lines were to be removed.
>>
>
> No, They are needed to get the offsets of the ids[] table.
> The field name are confusing. This is not reading the ids[],
> but just the offset of where the table is. Without that you
> get bogus offsets. I ran into that bug during testing...
Hmm.... ok, so the perf_file_attr is now read in back to back reads --
attr then ids -- versus today where it gets both in one readn.
>
>
>> David
>>
>>
>>> +
>>> + return ret <= 0 ? -1 : 0;
>>> +}
>>> +
>>> int perf_session__read_header(struct perf_session *session, int fd)
>>> {
>>> struct perf_header *header = &session->header;
>>> @@ -1974,19 +2019,17 @@ int perf_session__read_header(struct perf_session *session, int fd)
>>> if (session->fd_pipe)
>>> return perf_header__read_pipe(session, fd);
>>>
>>> - if (perf_file_header__read(&f_header, header, fd) < 0) {
>>> - pr_debug("incompatible file format\n");
>>> + if (perf_file_header__read(&f_header, header, fd) < 0)
>>> return -EINVAL;
>>> - }
>>>
>>> - nr_attrs = f_header.attrs.size / sizeof(f_attr);
>>> + nr_attrs = f_header.attrs.size / f_header.attr_size;
>>> lseek(fd, f_header.attrs.offset, SEEK_SET);
>>>
>>> for (i = 0; i < nr_attrs; i++) {
>>> struct perf_evsel *evsel;
>>> off_t tmp;
>>>
>>> - if (readn(fd, &f_attr, sizeof(f_attr)) <= 0)
>>> + if (read_attr(fd, header, &f_attr) < 0)
>>> goto out_errno;
>>>
>>> if (header->needs_swap)
>>> diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
>>> index 3f3afed..5476320 100644
>>> --- a/tools/perf/util/session.c
>>> +++ b/tools/perf/util/session.c
>>> @@ -24,7 +24,7 @@ static int perf_session__open(struct perf_session *self, bool force)
>>> self->fd = STDIN_FILENO;
>>>
>>> if (perf_session__read_header(self, self->fd) < 0)
>>> - pr_err("incompatible file format");
>>> + pr_err("incompatible file format (rerun with -v to learn more)");
>>>
>>> return 0;
>>> }
>>> @@ -56,7 +56,7 @@ static int perf_session__open(struct perf_session *self, bool force)
>>> }
>>>
>>> if (perf_session__read_header(self, self->fd) < 0) {
>>> - pr_err("incompatible file format");
>>> + pr_err("incompatible file format (rerun with -v to learn more)");
>>> goto out_close;
>>> }
>>>
next prev parent reply other threads:[~2012-02-09 22:47 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-09 22:20 [PATCH v6 00/18] perf: add support for sampling taken branches Stephane Eranian
2012-02-09 22:20 ` [PATCH v6 01/18] perf: add generic taken branch sampling support Stephane Eranian
2012-03-09 13:19 ` [tip:perf/hw-branch-sampling] perf: Add " tip-bot for Stephane Eranian
2012-02-09 22:20 ` [PATCH v6 02/18] perf: add Intel LBR MSR definitions Stephane Eranian
2012-03-09 13:20 ` [tip:perf/hw-branch-sampling] perf/x86: Add " tip-bot for Stephane Eranian
2012-02-09 22:20 ` [PATCH v6 03/18] perf: add Intel X86 LBR sharing logic Stephane Eranian
2012-03-09 13:21 ` [tip:perf/hw-branch-sampling] perf/x86: Add Intel " tip-bot for Stephane Eranian
2012-02-09 22:20 ` [PATCH v6 04/18] perf: sync branch stack sampling with X86 precise_sampling Stephane Eranian
2012-03-09 13:21 ` [tip:perf/hw-branch-sampling] perf/x86: Sync branch stack sampling with precise_sampling tip-bot for Stephane Eranian
2012-02-09 22:20 ` [PATCH v6 05/18] perf: add Intel X86 LBR mappings for PERF_SAMPLE_BRANCH filters Stephane Eranian
2012-03-09 13:22 ` [tip:perf/hw-branch-sampling] perf/x86: Add Intel " tip-bot for Stephane Eranian
2012-02-09 22:20 ` [PATCH v6 06/18] perf: disable LBR support for older Intel Atom processors Stephane Eranian
2012-03-09 13:23 ` [tip:perf/hw-branch-sampling] perf/x86: Disable " tip-bot for Stephane Eranian
2012-02-09 22:20 ` [PATCH v6 07/18] perf: implement PERF_SAMPLE_BRANCH for Intel X86 Stephane Eranian
2012-03-09 13:24 ` [tip:perf/hw-branch-sampling] perf/x86: Implement PERF_SAMPLE_BRANCH for Intel CPUs tip-bot for Stephane Eranian
2012-02-09 22:20 ` [PATCH v6 08/18] perf: add LBR software filter support for Intel X86 Stephane Eranian
2012-03-09 13:25 ` [tip:perf/hw-branch-sampling] perf/x86: Add LBR software filter support for Intel CPUs tip-bot for Stephane Eranian
2012-02-09 22:20 ` [PATCH v6 09/18] perf: disable PERF_SAMPLE_BRANCH_* when not supported Stephane Eranian
2012-03-09 13:26 ` [tip:perf/hw-branch-sampling] perf: Disable " tip-bot for Stephane Eranian
2012-02-09 22:21 ` [PATCH v6 10/18] perf: add hook to flush branch_stack on context switch Stephane Eranian
2012-03-09 13:26 ` [tip:perf/hw-branch-sampling] perf: Add callback " tip-bot for Stephane Eranian
2012-02-09 22:21 ` [PATCH v6 11/18] perf: add code to support PERF_SAMPLE_BRANCH_STACK Stephane Eranian
2012-03-09 13:27 ` [tip:perf/hw-branch-sampling] perf tools: Add " tip-bot for Roberto Agostino Vitillo
2012-02-09 22:21 ` [PATCH v6 12/18] perf: add support for sampling taken branch to perf record Stephane Eranian
2012-03-09 13:28 ` [tip:perf/hw-branch-sampling] perf record: Add support for sampling taken branch tip-bot for Roberto Agostino Vitillo
2012-02-09 22:21 ` [PATCH v6 13/18] perf: add support for taken branch sampling to perf report Stephane Eranian
2012-02-14 21:47 ` Arnaldo Carvalho de Melo
2012-02-22 11:15 ` Ingo Molnar
2012-02-22 16:18 ` Stephane Eranian
2012-02-23 9:59 ` Ingo Molnar
2012-02-23 16:53 ` Stephane Eranian
2012-02-23 18:11 ` Arnaldo Carvalho de Melo
2012-02-23 20:48 ` Stephane Eranian
2012-03-09 13:29 ` [tip:perf/hw-branch-sampling] perf report: Add support for taken branch sampling tip-bot for Roberto Agostino Vitillo
2012-02-09 22:21 ` [PATCH v6 14/18] perf: fix endianness detection in perf.data Stephane Eranian
2012-02-09 22:32 ` David Ahern
2012-02-09 22:21 ` [PATCH v6 15/18] perf: add ABI reference sizes Stephane Eranian
2012-03-09 13:30 ` [tip:perf/hw-branch-sampling] perf: Add " tip-bot for Stephane Eranian
2012-02-09 22:21 ` [PATCH v6 16/18] perf: enable reading of perf.data files from different ABI rev Stephane Eranian
2012-02-09 22:39 ` David Ahern
2012-02-09 22:41 ` Stephane Eranian
2012-02-09 22:46 ` David Ahern [this message]
2012-02-09 22:49 ` Stephane Eranian
2012-02-10 0:37 ` David Ahern
2012-03-09 13:30 ` [tip:perf/hw-branch-sampling] perf tools: Enable reading of perf. data " tip-bot for Stephane Eranian
2012-02-09 22:21 ` [PATCH v6 17/18] perf: fix bug print_event_desc() Stephane Eranian
2012-03-09 13:31 ` [tip:perf/hw-branch-sampling] perf tools: Fix ABI compatibility bug in print_event_desc() tip-bot for Stephane Eranian
2012-02-09 22:21 ` [PATCH v6 18/18] perf: make perf able to read file from older ABIs Stephane Eranian
2012-03-09 13:32 ` [tip:perf/hw-branch-sampling] perf tools: Make perf able to read files " tip-bot for Stephane Eranian
2012-02-27 7:50 ` [PATCH v6 00/18] perf: add support for sampling taken branches Anshuman Khandual
2012-02-27 8:45 ` 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=4F344CDF.8060206@gmail.com \
--to=dsahern@gmail.com \
--cc=acme@redhat.com \
--cc=andi@firstfloor.org \
--cc=asharma@fb.com \
--cc=eranian@google.com \
--cc=khandual@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.m.lin@intel.com \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=ravitillo@lbl.gov \
--cc=robert.richter@amd.com \
--cc=vweaver1@eecs.utk.edu \
/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