[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABPqkBTR3tEGh7LymuS_JJR5SuCZfjTxZP-6qNxmZtBf0Zt9bg@mail.gmail.com>
Date: Tue, 29 Nov 2011 10:35:24 -0800
From: Stephane Eranian <eranian@...gle.com>
To: Robert Richter <robert.richter@....com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"acme@...hat.com" <acme@...hat.com>,
"peterz@...radead.org" <peterz@...radead.org>,
"dsahern@...il.com" <dsahern@...il.com>,
"ak@...ux.intel.com" <ak@...ux.intel.com>,
"mingo@...e.hu" <mingo@...e.hu>
Subject: Re: [PATCH] perf: make perf.data more self-descriptive (v8)
Robert,
On Tue, Nov 29, 2011 at 10:22 AM, Robert Richter <robert.richter@....com> wrote:
> On 30.09.11 09:40:40, Stephane Eranian wrote:
>> @@ -385,36 +1433,69 @@ static int perf_header__adds_write(struct perf_header *header,
>> sec_start = header->data_offset + header->data_size;
>> lseek(fd, sec_start + sec_size, SEEK_SET);
>>
>> - if (perf_header__has_feat(header, HEADER_TRACE_INFO)) {
>> - struct perf_file_section *trace_sec;
>> -
>> - trace_sec = &feat_sec[idx++];
>> + err = do_write_feat(fd, header, HEADER_TRACE_INFO, &p, evlist);
>> + if (err)
>> + goto out_free;
>>
>> - /* Write trace info */
>> - trace_sec->offset = lseek(fd, 0, SEEK_CUR);
>> - read_tracing_data(fd, &evlist->entries);
>> - trace_sec->size = lseek(fd, 0, SEEK_CUR) - trace_sec->offset;
>> + err = do_write_feat(fd, header, HEADER_BUILD_ID, &p, evlist);
>> + if (err) {
>> + perf_header__clear_feat(header, HEADER_BUILD_ID);
>> + goto out_free;
>> }
>
> Stephane,
>
> I am just looking at the code and got a question:
>
> Is there a reason for the different error handling for
> HEADER_TRACE_INFO and HEADER_BUILD_ID? All other types simply disable
> the feature and go on without returning an error (goto out_free).
>
You're looking at an old version of that code. I fixed that later on.
If you look in tip
you'll see that TRACE_INFO follows the same logic.
sec_start = header->data_offset + header->data_size;
lseek(fd, sec_start + sec_size, SEEK_SET);
err = do_write_feat(fd, header, HEADER_TRACE_INFO, &p, evlist);
if (err)
goto out_free;
err = do_write_feat(fd, header, HEADER_BUILD_ID, &p, evlist);
if (err) {
perf_header__clear_feat(header, HEADER_BUILD_ID);
goto out_free;
}
The 'clear_feat' is missing for TRACE_INFO, that's all. The question is:
is case do_write_feat(trace_info) fails, is there still a way to parse the file
correctly? If not, then perf should bail out, if yes, then we need to add the
clear_feat(TRACE_INFO) in case of error.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists