From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: David Ahern <dsahern@gmail.com>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH 3/8] perf symbol: Save vmlinux or kallsyms path loaded
Date: Fri, 22 Nov 2013 15:44:58 -0300 [thread overview]
Message-ID: <20131122184458.GE11305@ghostprotocols.net> (raw)
In-Reply-To: <1384806771-2945-4-git-send-email-dsahern@gmail.com>
Em Mon, Nov 18, 2013 at 01:32:46PM -0700, David Ahern escreveu:
> Save vmlinux or kallsyms path loaded using embedded default lookup (ie.,
> not a user specified path). Upcoming perf sched timehist command requires
> kernel symbols for properly computing idle times and prints a warning
> if the kernel symbols are not loaded.
What would happen if strdup failed here?
Why don't we undo anything done so far in this function and return an
error?
- Arnaldo
> Signed-off-by: David Ahern <dsahern@gmail.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Jiri Olsa <jolsa@redhat.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Stephane Eranian <eranian@google.com>
> ---
> tools/perf/util/symbol.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index f55c18da1e40..915eb6c4a248 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
> @@ -1437,6 +1437,8 @@ int dso__load_vmlinux(struct dso *dso, struct map *map,
> dso->data_type = DSO_BINARY_TYPE__VMLINUX;
> dso__set_long_name(dso, (char *)vmlinux);
> dso__set_loaded(dso, map->type);
> + if (symbol_conf.vmlinux_name == NULL)
> + symbol_conf.vmlinux_name = strdup(symfs_vmlinux);
> pr_debug("Using %s for symbols\n", symfs_vmlinux);
> }
>
> @@ -1629,8 +1631,11 @@ static int dso__load_kernel_sym(struct dso *dso, struct map *map,
>
> do_kallsyms:
> err = dso__load_kallsyms(dso, kallsyms_filename, map, filter);
> - if (err > 0)
> + if (err > 0) {
> + if (symbol_conf.kallsyms_name == NULL)
> + symbol_conf.kallsyms_name = strdup(kallsyms_filename);
> pr_debug("Using %s for symbols\n", kallsyms_filename);
> + }
> free(kallsyms_allocated_filename);
>
> if (err > 0 && !dso__is_kcore(dso)) {
> --
> 1.8.3.4 (Apple Git-47)
next prev parent reply other threads:[~2013-11-22 18:45 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-18 20:32 [PATCH 0/8] perf: sched timehist command David Ahern
2013-11-18 20:32 ` [PATCH 1/8] perf tool: Skip ignored symbols while printing callchain David Ahern
2013-11-30 12:52 ` [tip:perf/core] perf evsel: " tip-bot for David Ahern
2013-11-18 20:32 ` [PATCH 2/8] perf symbols: Move idle syms check from top to generic function David Ahern
2013-11-28 8:36 ` Namhyung Kim
2013-11-30 15:58 ` David Ahern
2013-11-30 12:52 ` [tip:perf/core] " tip-bot for David Ahern
2013-11-18 20:32 ` [PATCH 3/8] perf symbol: Save vmlinux or kallsyms path loaded David Ahern
2013-11-22 18:44 ` Arnaldo Carvalho de Melo [this message]
2013-11-22 19:13 ` David Ahern
2013-11-22 19:40 ` Arnaldo Carvalho de Melo
2013-11-22 20:09 ` David Ahern
2013-11-18 20:32 ` [PATCH 4/8] perf thread: Move comm_list check into function David Ahern
2013-11-30 12:52 ` [tip:perf/core] " tip-bot for David Ahern
2013-11-18 20:32 ` [PATCH 5/8] perf tool: export setup_list David Ahern
2013-11-28 8:45 ` Namhyung Kim
2013-11-30 12:52 ` [tip:perf/core] perf tools: Export setup_list tip-bot for David Ahern
2013-11-18 20:32 ` [PATCH 6/8] perf sched: Introduce timehist command David Ahern
2013-11-28 9:50 ` Namhyung Kim
2013-11-28 16:01 ` David Ahern
2013-11-28 15:38 ` Namhyung Kim
2013-11-28 16:01 ` David Ahern
2013-11-29 0:48 ` Namhyung Kim
2013-11-29 1:58 ` David Ahern
2013-12-04 4:15 ` David Ahern
2013-11-18 20:32 ` [PATCH 7/8] perf sched timehist: Add support for context-switch event David Ahern
2013-11-18 20:32 ` [PATCH 8/8] perf sched : Add documentation for timehist options David Ahern
2013-11-28 15:42 ` Namhyung Kim
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=20131122184458.GE11305@ghostprotocols.net \
--to=acme@ghostprotocols.net \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/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).