diff options
author | Jovi Zhang <bookjovi@gmail.com> | 2010-09-09 12:30:59 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-09-09 16:43:35 -0400 |
commit | 85e00b55517a5696282b80836655e6b6f5702df0 (patch) | |
tree | ce9e06bed532b0cd473266ccbf86d2f7dd22ee86 | |
parent | da34634fd39958725310d2c30c9b4543945f968b (diff) |
perf symbols: Fix multiple initialization of symbol system
By returning immediately if it was already initialized, do it as well at
symbol__exit, refusing multiple deinitializations.
This fixes problems in the kmem, sched and timechart commands.
Reported-by: Davidlohr Bueso <dave@gnu.org>
Cc: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Jovi Zhang <bookjovi@gmail.com>
LKML-Reference: AANLkTi=9Cn=R8SPMCRp5z+gEjXbaBHeb-AaOtRbuwwcn@mail.gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/util/symbol.c | 7 | ||||
-rw-r--r-- | tools/perf/util/symbol.h | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 1a367734e016..b2f5ae97f33d 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -2268,6 +2268,9 @@ static int setup_list(struct strlist **list, const char *list_str, | |||
2268 | 2268 | ||
2269 | int symbol__init(void) | 2269 | int symbol__init(void) |
2270 | { | 2270 | { |
2271 | if (symbol_conf.initialized) | ||
2272 | return 0; | ||
2273 | |||
2271 | elf_version(EV_CURRENT); | 2274 | elf_version(EV_CURRENT); |
2272 | if (symbol_conf.sort_by_name) | 2275 | if (symbol_conf.sort_by_name) |
2273 | symbol_conf.priv_size += (sizeof(struct symbol_name_rb_node) - | 2276 | symbol_conf.priv_size += (sizeof(struct symbol_name_rb_node) - |
@@ -2293,6 +2296,7 @@ int symbol__init(void) | |||
2293 | symbol_conf.sym_list_str, "symbol") < 0) | 2296 | symbol_conf.sym_list_str, "symbol") < 0) |
2294 | goto out_free_comm_list; | 2297 | goto out_free_comm_list; |
2295 | 2298 | ||
2299 | symbol_conf.initialized = true; | ||
2296 | return 0; | 2300 | return 0; |
2297 | 2301 | ||
2298 | out_free_dso_list: | 2302 | out_free_dso_list: |
@@ -2304,11 +2308,14 @@ out_free_comm_list: | |||
2304 | 2308 | ||
2305 | void symbol__exit(void) | 2309 | void symbol__exit(void) |
2306 | { | 2310 | { |
2311 | if (!symbol_conf.initialized) | ||
2312 | return; | ||
2307 | strlist__delete(symbol_conf.sym_list); | 2313 | strlist__delete(symbol_conf.sym_list); |
2308 | strlist__delete(symbol_conf.dso_list); | 2314 | strlist__delete(symbol_conf.dso_list); |
2309 | strlist__delete(symbol_conf.comm_list); | 2315 | strlist__delete(symbol_conf.comm_list); |
2310 | vmlinux_path__exit(); | 2316 | vmlinux_path__exit(); |
2311 | symbol_conf.sym_list = symbol_conf.dso_list = symbol_conf.comm_list = NULL; | 2317 | symbol_conf.sym_list = symbol_conf.dso_list = symbol_conf.comm_list = NULL; |
2318 | symbol_conf.initialized = false; | ||
2312 | } | 2319 | } |
2313 | 2320 | ||
2314 | int machines__create_kernel_maps(struct rb_root *self, pid_t pid) | 2321 | int machines__create_kernel_maps(struct rb_root *self, pid_t pid) |
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index b7a8da4af5a0..ea95c2756f05 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h | |||
@@ -69,7 +69,8 @@ struct symbol_conf { | |||
69 | show_nr_samples, | 69 | show_nr_samples, |
70 | use_callchain, | 70 | use_callchain, |
71 | exclude_other, | 71 | exclude_other, |
72 | show_cpu_utilization; | 72 | show_cpu_utilization, |
73 | initialized; | ||
73 | const char *vmlinux_name, | 74 | const char *vmlinux_name, |
74 | *source_prefix, | 75 | *source_prefix, |
75 | *field_sep; | 76 | *field_sep; |