From: Arnaldo Carvalho de Melo <acme@redhat.com>
To: jovi zhang <bookjovi@gmail.com>
Cc: a.p.zijlstra@chello.nl, paulus@samba.org, mingo@elte.hu,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf: fix core dump
Date: Tue, 24 Aug 2010 09:25:25 -0300 [thread overview]
Message-ID: <20100824122525.GM2973@ghostprotocols.net> (raw)
In-Reply-To: <AANLkTi=9Cn=R8SPMCRp5z+gEjXbaBHeb-AaOtRbuwwcn@mail.gmail.com>
Em Tue, Aug 24, 2010 at 03:07:33PM +0800, jovi zhang escreveu:
> Perf invoke symbol__init function twice when we input command "perf
> kmem/sched record ls", then it will core dump when symbol__exit
> invoked.
> So give a flag to make symbol__init can be invoked once.
Yeah, this fixes the problem, and I'll apply this patch, but I think
that the elegant solution is to adopt one more kernel construct, i.e.
__init markings :)
Thanks!
- Arnaldo
> Signed-off-by: Jovi Zhang <bookjovi@gmail.com>
> tools/perf/util/symbol.c | 9 +++++++++
> 1 files changed, 9 insertions(+), 0 deletions(-)
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index 1a36773..aded121 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
> @@ -43,6 +43,8 @@ struct symbol_conf symbol_conf = {
> .try_vmlinux_path = true,
> };
>
> +static bool symbol_initizated;
> +
> int dso__name_len(const struct dso *self)
> {
> if (verbose)
> @@ -2268,6 +2270,11 @@ static int setup_list(struct strlist **list,
> const char *list_str,
>
> int symbol__init(void)
> {
> + if (symbol_initizated == true)
> + return 0;
> + else
> + symbol_initizated = true;
> +
> elf_version(EV_CURRENT);
> if (symbol_conf.sort_by_name)
> symbol_conf.priv_size += (sizeof(struct symbol_name_rb_node) -
> @@ -2304,6 +2311,8 @@ out_free_comm_list:
>
> void symbol__exit(void)
> {
> + if (symbol_initizated == false)
> + return;
> strlist__delete(symbol_conf.sym_list);
> strlist__delete(symbol_conf.dso_list);
> strlist__delete(symbol_conf.comm_list);
prev parent reply other threads:[~2010-08-24 12:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-24 7:07 [PATCH] perf: fix core dump jovi zhang
2010-08-24 12:25 ` Arnaldo Carvalho de Melo [this message]
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=20100824122525.GM2973@ghostprotocols.net \
--to=acme@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=bookjovi@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.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