All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To: Robert Richter <robert.richter@amd.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>,
	Stephane Eranian <eranian@google.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 08/10] perf tool: Unify handling of features when writing feature section
Date: Tue, 6 Dec 2011 11:36:30 -0200	[thread overview]
Message-ID: <20111206133630.GI7059@infradead.org> (raw)
In-Reply-To: <1323167560-2282-9-git-send-email-robert.richter@amd.com>

Em Tue, Dec 06, 2011 at 11:32:38AM +0100, Robert Richter escreveu:
> The features HEADER_TRACE_INFO and HEADER_BUILD_ID are handled
> different when writing the feature section. All other features are
> simply disabled on failure and writing the section goes on without
> returning an error. There is no reason for these special cases. This
> patch unifies handling of the features.
> 
> This should be ok since all features can be parsed independently.
> Offset and size of a feature's block is stored in struct perf_file_
> section right after the data block of perf.data (see perf_session__
> write_header()). Thus, if a feature does not exist then other features
> can be processed anyway.
> 
> Also moving special code for HEADER_BUILD_ID out to write_build_id().

For this one I just would add a big fat warning that if there are
build-ids on the system but the table can't be written, then extreme
care has to be taken when doing a perf report.

I.e. one has to be completely sure that the binaries hasn't changed if
not validating the build-ids.

If you fix that please add this warning as well when no build-ids are
found, which hopefully is the odd case these days as all distros I'm
aware of have build-ids in all DSOs.

- Arnaldo

> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Stephane Eranian <eranian@google.com>
> Signed-off-by: Robert Richter <robert.richter@amd.com>
> ---
>  tools/perf/util/header.c |   14 +++++---------
>  1 files changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> index dda3c5f..5cfe06a 100644
> --- a/tools/perf/util/header.c
> +++ b/tools/perf/util/header.c
> @@ -445,6 +445,9 @@ static int write_build_id(int fd, struct perf_header *h,
>  
>  	session = container_of(h, struct perf_session, header);
>  
> +	if (!perf_session__read_build_ids(session, true))
> +		return -1;
> +
>  	err = dsos__write_buildid_table(h, fd);
>  	if (err < 0) {
>  		pr_debug("failed to write buildid table\n");
> @@ -1413,10 +1416,6 @@ static int perf_header__adds_write(struct perf_header *header,
>  
>  	session = container_of(header, struct perf_session, header);
>  
> -	if (perf_header__has_feat(header, HEADER_BUILD_ID &&
> -	    !perf_session__read_build_ids(session, true)))
> -		perf_header__clear_feat(header, HEADER_BUILD_ID);
> -
>  	nr_sections = bitmap_weight(header->adds_features, HEADER_FEAT_BITS);
>  	if (!nr_sections)
>  		return 0;
> @@ -1432,13 +1431,11 @@ static int perf_header__adds_write(struct perf_header *header,
>  
>  	err = do_write_feat(fd, header, HEADER_TRACE_INFO, &p, evlist);
>  	if (err)
> -		goto out_free;
> +		perf_header__clear_feat(header, HEADER_TRACE_INFO);
>  
>  	err = do_write_feat(fd, header, HEADER_BUILD_ID, &p, evlist);
> -	if (err) {
> +	if (err)
>  		perf_header__clear_feat(header, HEADER_BUILD_ID);
> -		goto out_free;
> -	}
>  
>  	err = do_write_feat(fd, header, HEADER_HOSTNAME, &p, evlist);
>  	if (err)
> @@ -1496,7 +1493,6 @@ static int perf_header__adds_write(struct perf_header *header,
>  	err = do_write(fd, feat_sec, sec_size);
>  	if (err < 0)
>  		pr_debug("failed to write feature section\n");
> -out_free:
>  	free(feat_sec);
>  	return err;
>  }
> -- 
> 1.7.7
> 

  reply	other threads:[~2011-12-06 13:36 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-06 10:32 [PATCH 00/10] perf tools: cleanups, fixes, updates Robert Richter
2011-12-06 10:32 ` [PATCH 01/10] perf script: Fix mem leaks and NULL pointer checks around strdup()s Robert Richter
2011-12-06 10:32 ` [PATCH 02/10] perf script: Implement option for system-wide profiling Robert Richter
2011-12-06 10:32 ` [PATCH 03/10] perf tools: Continue processing header on unknown features Robert Richter
2011-12-06 13:29   ` Arnaldo Carvalho de Melo
2011-12-06 10:32 ` [PATCH 04/10] perf tools: Fix out-of-bound access to struct perf_session Robert Richter
2011-12-06 13:20   ` Arnaldo Carvalho de Melo
2011-12-06 10:32 ` [PATCH 05/10] perf tool: Moving code in some files Robert Richter
2011-12-06 10:32 ` [PATCH 06/10] perf report: Setup browser if stdout is a pipe Robert Richter
2011-12-06 13:29   ` Arnaldo Carvalho de Melo
2011-12-06 15:04     ` Tom Zanussi
2011-12-06 17:15     ` Robert Richter
2011-12-06 10:32 ` [PATCH 07/10] perf report: Accept fifos as input file Robert Richter
2011-12-06 13:22   ` Arnaldo Carvalho de Melo
2011-12-06 10:32 ` [PATCH 08/10] perf tool: Unify handling of features when writing feature section Robert Richter
2011-12-06 13:36   ` Arnaldo Carvalho de Melo [this message]
2011-12-06 16:33     ` Robert Richter
2011-12-07 14:14       ` Arnaldo Carvalho de Melo
2011-12-07 14:35         ` Robert Richter
2011-12-06 10:32 ` [PATCH 09/10] perf tools: Improve macros for struct feature_ops Robert Richter
2011-12-06 13:23   ` Arnaldo Carvalho de Melo
2011-12-06 10:32 ` [PATCH 10/10] perf tools: Use for_each_set_bit() to iterate over feature flags Robert Richter
2011-12-06 13:40   ` Arnaldo Carvalho de Melo
2011-12-07  8:30     ` Robert Richter
2011-12-06 11:04 ` [PATCH 00/10] perf tools: cleanups, fixes, updates Robert Richter
2011-12-06 13:16   ` Arnaldo Carvalho de Melo

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=20111206133630.GI7059@infradead.org \
    --to=acme@redhat.com \
    --cc=eranian@google.com \
    --cc=fweisbec@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.