Re: [PATCH] perf: make perf.data more self-descriptive (v8)

From: Stephane Eranian
Date: Thu Dec 01 2011 - 12:53:12 EST


On Thu, Dec 1, 2011 at 7:15 AM, Robert Richter <robert.richter@xxxxxxx> wrote:
> On 01.12.11 16:01:55, Frederic Weisbecker wrote:
>> On Wed, Nov 30, 2011 at 02:49:46PM -0200, acme@xxxxxxxxxx wrote:
>> > Em Wed, Nov 30, 2011 at 04:08:29PM +0100, Robert Richter escreveu:
>> > > On 29.11.11 10:35:24, Stephane Eranian wrote:
>> > > > Â Â Â Â 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.
>> >
>> > > The question is, if do_write_feat() fails for HEADER_TRACE_INFO or
>> > > HEADER_BUILD_ID then perf_header__adds_write() fails. A failure of any
>> > > other feature simple disables it by calling clear_feat(). I noticed
>> > > this asymmetry and wonder why?
>>
>> Not sure either. I must confess I didn't write that fixup part...
>
> I am asking this because I want to change code in a way that treats
> all features the same, that is just to disable the feature bit on
> failure and then continue anyway.
>
You need to make sure that disabling the bit is enough to still get a consistent
file, i.e., want to undo the effect of writing the feature to the
file. In the case
of the meta-data features I added that was easy simply lseek() back to
the position
before the call. Would that be the case with TRACE_INFO?

>>
>> > >
>> > > Also, is there a reason why HEADER_TRACE_INFO starts with bit 1 instead
>> > > of bit 0. Is bit 0 reserved for some reason?
>>
>> Looks like a mistake I made from the beginning. And we can't really fix that
>> without breaking all perf.data :)
>
> Ok, wasn't sure if the bit was used for other purposes, but seems to
> be always zero then.
>
> Thanks,
>
> -Robert
>
> --
> Advanced Micro Devices, Inc.
> Operating System Research Center
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/