linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephane Eranian <eranian@google.com>
To: Robert Richter <robert.richter@amd.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"acme@redhat.com" <acme@redhat.com>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"dsahern@gmail.com" <dsahern@gmail.com>,
	"ak@linux.intel.com" <ak@linux.intel.com>,
	"mingo@elte.hu" <mingo@elte.hu>
Subject: Re: [PATCH] perf: make perf.data more self-descriptive (v8)
Date: Tue, 29 Nov 2011 10:35:24 -0800	[thread overview]
Message-ID: <CABPqkBTR3tEGh7LymuS_JJR5SuCZfjTxZP-6qNxmZtBf0Zt9bg@mail.gmail.com> (raw)
In-Reply-To: <20111129182231.GZ15738@erda.amd.com>

Robert,

On Tue, Nov 29, 2011 at 10:22 AM, Robert Richter <robert.richter@amd.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.

  reply	other threads:[~2011-11-29 18:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-30 13:40 [PATCH] perf: make perf.data more self-descriptive (v8) Stephane Eranian
2011-10-04  4:50 ` David Ahern
2011-11-29 18:22 ` Robert Richter
2011-11-29 18:35   ` Stephane Eranian [this message]
2011-11-30 15:08     ` Robert Richter
2011-11-30 16:49       ` acme
2011-12-01 15:01         ` Frederic Weisbecker
2011-12-01 15:15           ` Robert Richter
2011-12-01 17:53             ` Stephane Eranian
2011-12-05 13:23               ` Robert Richter
2011-12-05 19:24                 ` Stephane Eranian
2011-12-06  9:29                   ` Robert Richter
     [not found]                     ` <CABPqkBRbdJ0tG2+V-CvEdPnwm5YqQuv7FKrUHoTM8=wa8V=kHQ@mail.gmail.com>
2011-12-19  9:26                       ` Robert Richter

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=CABPqkBTR3tEGh7LymuS_JJR5SuCZfjTxZP-6qNxmZtBf0Zt9bg@mail.gmail.com \
    --to=eranian@google.com \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=dsahern@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=robert.richter@amd.com \
    /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;
as well as URLs for NNTP newsgroup(s).