diff options
Diffstat (limited to 'tools/perf/util/symbol.c')
-rw-r--r-- | tools/perf/util/symbol.c | 179 |
1 files changed, 110 insertions, 69 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 37e8d20ae03e..aecff69a510d 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <fcntl.h> | 9 | #include <fcntl.h> |
10 | #include <unistd.h> | 10 | #include <unistd.h> |
11 | #include <inttypes.h> | 11 | #include <inttypes.h> |
12 | #include "annotate.h" | ||
12 | #include "build-id.h" | 13 | #include "build-id.h" |
13 | #include "util.h" | 14 | #include "util.h" |
14 | #include "debug.h" | 15 | #include "debug.h" |
@@ -23,10 +24,10 @@ | |||
23 | #include <symbol/kallsyms.h> | 24 | #include <symbol/kallsyms.h> |
24 | #include <sys/utsname.h> | 25 | #include <sys/utsname.h> |
25 | 26 | ||
26 | static int dso__load_kernel_sym(struct dso *dso, struct map *map, | 27 | static int dso__load_kernel_sym(struct dso *dso, struct map *map); |
27 | symbol_filter_t filter); | 28 | static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map); |
28 | static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map, | 29 | static bool symbol__is_idle(const char *name); |
29 | symbol_filter_t filter); | 30 | |
30 | int vmlinux_path__nr_entries; | 31 | int vmlinux_path__nr_entries; |
31 | char **vmlinux_path; | 32 | char **vmlinux_path; |
32 | 33 | ||
@@ -152,6 +153,9 @@ void symbols__fixup_duplicate(struct rb_root *symbols) | |||
152 | struct rb_node *nd; | 153 | struct rb_node *nd; |
153 | struct symbol *curr, *next; | 154 | struct symbol *curr, *next; |
154 | 155 | ||
156 | if (symbol_conf.allow_aliases) | ||
157 | return; | ||
158 | |||
155 | nd = rb_first(symbols); | 159 | nd = rb_first(symbols); |
156 | 160 | ||
157 | while (nd) { | 161 | while (nd) { |
@@ -235,8 +239,13 @@ struct symbol *symbol__new(u64 start, u64 len, u8 binding, const char *name) | |||
235 | if (sym == NULL) | 239 | if (sym == NULL) |
236 | return NULL; | 240 | return NULL; |
237 | 241 | ||
238 | if (symbol_conf.priv_size) | 242 | if (symbol_conf.priv_size) { |
243 | if (symbol_conf.init_annotation) { | ||
244 | struct annotation *notes = (void *)sym; | ||
245 | pthread_mutex_init(¬es->lock, NULL); | ||
246 | } | ||
239 | sym = ((void *)sym) + symbol_conf.priv_size; | 247 | sym = ((void *)sym) + symbol_conf.priv_size; |
248 | } | ||
240 | 249 | ||
241 | sym->start = start; | 250 | sym->start = start; |
242 | sym->end = len ? start + len : start; | 251 | sym->end = len ? start + len : start; |
@@ -268,13 +277,24 @@ void symbols__delete(struct rb_root *symbols) | |||
268 | } | 277 | } |
269 | } | 278 | } |
270 | 279 | ||
271 | void symbols__insert(struct rb_root *symbols, struct symbol *sym) | 280 | void __symbols__insert(struct rb_root *symbols, struct symbol *sym, bool kernel) |
272 | { | 281 | { |
273 | struct rb_node **p = &symbols->rb_node; | 282 | struct rb_node **p = &symbols->rb_node; |
274 | struct rb_node *parent = NULL; | 283 | struct rb_node *parent = NULL; |
275 | const u64 ip = sym->start; | 284 | const u64 ip = sym->start; |
276 | struct symbol *s; | 285 | struct symbol *s; |
277 | 286 | ||
287 | if (kernel) { | ||
288 | const char *name = sym->name; | ||
289 | /* | ||
290 | * ppc64 uses function descriptors and appends a '.' to the | ||
291 | * start of every instruction address. Remove it. | ||
292 | */ | ||
293 | if (name[0] == '.') | ||
294 | name++; | ||
295 | sym->idle = symbol__is_idle(name); | ||
296 | } | ||
297 | |||
278 | while (*p != NULL) { | 298 | while (*p != NULL) { |
279 | parent = *p; | 299 | parent = *p; |
280 | s = rb_entry(parent, struct symbol, rb_node); | 300 | s = rb_entry(parent, struct symbol, rb_node); |
@@ -287,6 +307,11 @@ void symbols__insert(struct rb_root *symbols, struct symbol *sym) | |||
287 | rb_insert_color(&sym->rb_node, symbols); | 307 | rb_insert_color(&sym->rb_node, symbols); |
288 | } | 308 | } |
289 | 309 | ||
310 | void symbols__insert(struct rb_root *symbols, struct symbol *sym) | ||
311 | { | ||
312 | __symbols__insert(symbols, sym, false); | ||
313 | } | ||
314 | |||
290 | static struct symbol *symbols__find(struct rb_root *symbols, u64 ip) | 315 | static struct symbol *symbols__find(struct rb_root *symbols, u64 ip) |
291 | { | 316 | { |
292 | struct rb_node *n; | 317 | struct rb_node *n; |
@@ -320,6 +345,16 @@ static struct symbol *symbols__first(struct rb_root *symbols) | |||
320 | return NULL; | 345 | return NULL; |
321 | } | 346 | } |
322 | 347 | ||
348 | static struct symbol *symbols__last(struct rb_root *symbols) | ||
349 | { | ||
350 | struct rb_node *n = rb_last(symbols); | ||
351 | |||
352 | if (n) | ||
353 | return rb_entry(n, struct symbol, rb_node); | ||
354 | |||
355 | return NULL; | ||
356 | } | ||
357 | |||
323 | static struct symbol *symbols__next(struct symbol *sym) | 358 | static struct symbol *symbols__next(struct symbol *sym) |
324 | { | 359 | { |
325 | struct rb_node *n = rb_next(&sym->rb_node); | 360 | struct rb_node *n = rb_next(&sym->rb_node); |
@@ -415,7 +450,7 @@ void dso__reset_find_symbol_cache(struct dso *dso) | |||
415 | 450 | ||
416 | void dso__insert_symbol(struct dso *dso, enum map_type type, struct symbol *sym) | 451 | void dso__insert_symbol(struct dso *dso, enum map_type type, struct symbol *sym) |
417 | { | 452 | { |
418 | symbols__insert(&dso->symbols[type], sym); | 453 | __symbols__insert(&dso->symbols[type], sym, dso->kernel); |
419 | 454 | ||
420 | /* update the symbol cache if necessary */ | 455 | /* update the symbol cache if necessary */ |
421 | if (dso->last_find_result[type].addr >= sym->start && | 456 | if (dso->last_find_result[type].addr >= sym->start && |
@@ -441,6 +476,11 @@ struct symbol *dso__first_symbol(struct dso *dso, enum map_type type) | |||
441 | return symbols__first(&dso->symbols[type]); | 476 | return symbols__first(&dso->symbols[type]); |
442 | } | 477 | } |
443 | 478 | ||
479 | struct symbol *dso__last_symbol(struct dso *dso, enum map_type type) | ||
480 | { | ||
481 | return symbols__last(&dso->symbols[type]); | ||
482 | } | ||
483 | |||
444 | struct symbol *dso__next_symbol(struct symbol *sym) | 484 | struct symbol *dso__next_symbol(struct symbol *sym) |
445 | { | 485 | { |
446 | return symbols__next(sym); | 486 | return symbols__next(sym); |
@@ -537,7 +577,7 @@ struct process_kallsyms_args { | |||
537 | * These are symbols in the kernel image, so make sure that | 577 | * These are symbols in the kernel image, so make sure that |
538 | * sym is from a kernel DSO. | 578 | * sym is from a kernel DSO. |
539 | */ | 579 | */ |
540 | bool symbol__is_idle(struct symbol *sym) | 580 | static bool symbol__is_idle(const char *name) |
541 | { | 581 | { |
542 | const char * const idle_symbols[] = { | 582 | const char * const idle_symbols[] = { |
543 | "cpu_idle", | 583 | "cpu_idle", |
@@ -554,14 +594,10 @@ bool symbol__is_idle(struct symbol *sym) | |||
554 | "pseries_dedicated_idle_sleep", | 594 | "pseries_dedicated_idle_sleep", |
555 | NULL | 595 | NULL |
556 | }; | 596 | }; |
557 | |||
558 | int i; | 597 | int i; |
559 | 598 | ||
560 | if (!sym) | ||
561 | return false; | ||
562 | |||
563 | for (i = 0; idle_symbols[i]; i++) { | 599 | for (i = 0; idle_symbols[i]; i++) { |
564 | if (!strcmp(idle_symbols[i], sym->name)) | 600 | if (!strcmp(idle_symbols[i], name)) |
565 | return true; | 601 | return true; |
566 | } | 602 | } |
567 | 603 | ||
@@ -590,7 +626,7 @@ static int map__process_kallsym_symbol(void *arg, const char *name, | |||
590 | * We will pass the symbols to the filter later, in | 626 | * We will pass the symbols to the filter later, in |
591 | * map__split_kallsyms, when we have split the maps per module | 627 | * map__split_kallsyms, when we have split the maps per module |
592 | */ | 628 | */ |
593 | symbols__insert(root, sym); | 629 | __symbols__insert(root, sym, !strchr(name, '[')); |
594 | 630 | ||
595 | return 0; | 631 | return 0; |
596 | } | 632 | } |
@@ -607,8 +643,7 @@ static int dso__load_all_kallsyms(struct dso *dso, const char *filename, | |||
607 | return kallsyms__parse(filename, &args, map__process_kallsym_symbol); | 643 | return kallsyms__parse(filename, &args, map__process_kallsym_symbol); |
608 | } | 644 | } |
609 | 645 | ||
610 | static int dso__split_kallsyms_for_kcore(struct dso *dso, struct map *map, | 646 | static int dso__split_kallsyms_for_kcore(struct dso *dso, struct map *map) |
611 | symbol_filter_t filter) | ||
612 | { | 647 | { |
613 | struct map_groups *kmaps = map__kmaps(map); | 648 | struct map_groups *kmaps = map__kmaps(map); |
614 | struct map *curr_map; | 649 | struct map *curr_map; |
@@ -637,7 +672,7 @@ static int dso__split_kallsyms_for_kcore(struct dso *dso, struct map *map, | |||
637 | 672 | ||
638 | curr_map = map_groups__find(kmaps, map->type, pos->start); | 673 | curr_map = map_groups__find(kmaps, map->type, pos->start); |
639 | 674 | ||
640 | if (!curr_map || (filter && filter(curr_map, pos))) { | 675 | if (!curr_map) { |
641 | symbol__delete(pos); | 676 | symbol__delete(pos); |
642 | continue; | 677 | continue; |
643 | } | 678 | } |
@@ -660,8 +695,7 @@ static int dso__split_kallsyms_for_kcore(struct dso *dso, struct map *map, | |||
660 | * kernel range is broken in several maps, named [kernel].N, as we don't have | 695 | * kernel range is broken in several maps, named [kernel].N, as we don't have |
661 | * the original ELF section names vmlinux have. | 696 | * the original ELF section names vmlinux have. |
662 | */ | 697 | */ |
663 | static int dso__split_kallsyms(struct dso *dso, struct map *map, u64 delta, | 698 | static int dso__split_kallsyms(struct dso *dso, struct map *map, u64 delta) |
664 | symbol_filter_t filter) | ||
665 | { | 699 | { |
666 | struct map_groups *kmaps = map__kmaps(map); | 700 | struct map_groups *kmaps = map__kmaps(map); |
667 | struct machine *machine; | 701 | struct machine *machine; |
@@ -738,7 +772,7 @@ static int dso__split_kallsyms(struct dso *dso, struct map *map, u64 delta, | |||
738 | 772 | ||
739 | if (count == 0) { | 773 | if (count == 0) { |
740 | curr_map = map; | 774 | curr_map = map; |
741 | goto filter_symbol; | 775 | goto add_symbol; |
742 | } | 776 | } |
743 | 777 | ||
744 | if (dso->kernel == DSO_TYPE_GUEST_KERNEL) | 778 | if (dso->kernel == DSO_TYPE_GUEST_KERNEL) |
@@ -770,18 +804,18 @@ static int dso__split_kallsyms(struct dso *dso, struct map *map, u64 delta, | |||
770 | pos->start -= delta; | 804 | pos->start -= delta; |
771 | pos->end -= delta; | 805 | pos->end -= delta; |
772 | } | 806 | } |
773 | filter_symbol: | 807 | add_symbol: |
774 | if (filter && filter(curr_map, pos)) { | 808 | if (curr_map != map) { |
775 | discard_symbol: rb_erase(&pos->rb_node, root); | 809 | rb_erase(&pos->rb_node, root); |
776 | symbol__delete(pos); | 810 | symbols__insert(&curr_map->dso->symbols[curr_map->type], pos); |
777 | } else { | 811 | ++moved; |
778 | if (curr_map != map) { | 812 | } else |
779 | rb_erase(&pos->rb_node, root); | 813 | ++count; |
780 | symbols__insert(&curr_map->dso->symbols[curr_map->type], pos); | 814 | |
781 | ++moved; | 815 | continue; |
782 | } else | 816 | discard_symbol: |
783 | ++count; | 817 | rb_erase(&pos->rb_node, root); |
784 | } | 818 | symbol__delete(pos); |
785 | } | 819 | } |
786 | 820 | ||
787 | if (curr_map != map && | 821 | if (curr_map != map && |
@@ -1221,7 +1255,7 @@ static int kallsyms__delta(struct map *map, const char *filename, u64 *delta) | |||
1221 | } | 1255 | } |
1222 | 1256 | ||
1223 | int __dso__load_kallsyms(struct dso *dso, const char *filename, | 1257 | int __dso__load_kallsyms(struct dso *dso, const char *filename, |
1224 | struct map *map, bool no_kcore, symbol_filter_t filter) | 1258 | struct map *map, bool no_kcore) |
1225 | { | 1259 | { |
1226 | u64 delta = 0; | 1260 | u64 delta = 0; |
1227 | 1261 | ||
@@ -1234,8 +1268,8 @@ int __dso__load_kallsyms(struct dso *dso, const char *filename, | |||
1234 | if (kallsyms__delta(map, filename, &delta)) | 1268 | if (kallsyms__delta(map, filename, &delta)) |
1235 | return -1; | 1269 | return -1; |
1236 | 1270 | ||
1237 | symbols__fixup_duplicate(&dso->symbols[map->type]); | ||
1238 | symbols__fixup_end(&dso->symbols[map->type]); | 1271 | symbols__fixup_end(&dso->symbols[map->type]); |
1272 | symbols__fixup_duplicate(&dso->symbols[map->type]); | ||
1239 | 1273 | ||
1240 | if (dso->kernel == DSO_TYPE_GUEST_KERNEL) | 1274 | if (dso->kernel == DSO_TYPE_GUEST_KERNEL) |
1241 | dso->symtab_type = DSO_BINARY_TYPE__GUEST_KALLSYMS; | 1275 | dso->symtab_type = DSO_BINARY_TYPE__GUEST_KALLSYMS; |
@@ -1243,19 +1277,18 @@ int __dso__load_kallsyms(struct dso *dso, const char *filename, | |||
1243 | dso->symtab_type = DSO_BINARY_TYPE__KALLSYMS; | 1277 | dso->symtab_type = DSO_BINARY_TYPE__KALLSYMS; |
1244 | 1278 | ||
1245 | if (!no_kcore && !dso__load_kcore(dso, map, filename)) | 1279 | if (!no_kcore && !dso__load_kcore(dso, map, filename)) |
1246 | return dso__split_kallsyms_for_kcore(dso, map, filter); | 1280 | return dso__split_kallsyms_for_kcore(dso, map); |
1247 | else | 1281 | else |
1248 | return dso__split_kallsyms(dso, map, delta, filter); | 1282 | return dso__split_kallsyms(dso, map, delta); |
1249 | } | 1283 | } |
1250 | 1284 | ||
1251 | int dso__load_kallsyms(struct dso *dso, const char *filename, | 1285 | int dso__load_kallsyms(struct dso *dso, const char *filename, |
1252 | struct map *map, symbol_filter_t filter) | 1286 | struct map *map) |
1253 | { | 1287 | { |
1254 | return __dso__load_kallsyms(dso, filename, map, false, filter); | 1288 | return __dso__load_kallsyms(dso, filename, map, false); |
1255 | } | 1289 | } |
1256 | 1290 | ||
1257 | static int dso__load_perf_map(struct dso *dso, struct map *map, | 1291 | static int dso__load_perf_map(struct dso *dso, struct map *map) |
1258 | symbol_filter_t filter) | ||
1259 | { | 1292 | { |
1260 | char *line = NULL; | 1293 | char *line = NULL; |
1261 | size_t n; | 1294 | size_t n; |
@@ -1297,12 +1330,8 @@ static int dso__load_perf_map(struct dso *dso, struct map *map, | |||
1297 | if (sym == NULL) | 1330 | if (sym == NULL) |
1298 | goto out_delete_line; | 1331 | goto out_delete_line; |
1299 | 1332 | ||
1300 | if (filter && filter(map, sym)) | 1333 | symbols__insert(&dso->symbols[map->type], sym); |
1301 | symbol__delete(sym); | 1334 | nr_syms++; |
1302 | else { | ||
1303 | symbols__insert(&dso->symbols[map->type], sym); | ||
1304 | nr_syms++; | ||
1305 | } | ||
1306 | } | 1335 | } |
1307 | 1336 | ||
1308 | free(line); | 1337 | free(line); |
@@ -1358,7 +1387,7 @@ static bool dso__is_compatible_symtab_type(struct dso *dso, bool kmod, | |||
1358 | } | 1387 | } |
1359 | } | 1388 | } |
1360 | 1389 | ||
1361 | int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter) | 1390 | int dso__load(struct dso *dso, struct map *map) |
1362 | { | 1391 | { |
1363 | char *name; | 1392 | char *name; |
1364 | int ret = -1; | 1393 | int ret = -1; |
@@ -1381,9 +1410,9 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter) | |||
1381 | 1410 | ||
1382 | if (dso->kernel) { | 1411 | if (dso->kernel) { |
1383 | if (dso->kernel == DSO_TYPE_KERNEL) | 1412 | if (dso->kernel == DSO_TYPE_KERNEL) |
1384 | ret = dso__load_kernel_sym(dso, map, filter); | 1413 | ret = dso__load_kernel_sym(dso, map); |
1385 | else if (dso->kernel == DSO_TYPE_GUEST_KERNEL) | 1414 | else if (dso->kernel == DSO_TYPE_GUEST_KERNEL) |
1386 | ret = dso__load_guest_kernel_sym(dso, map, filter); | 1415 | ret = dso__load_guest_kernel_sym(dso, map); |
1387 | 1416 | ||
1388 | goto out; | 1417 | goto out; |
1389 | } | 1418 | } |
@@ -1407,7 +1436,7 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter) | |||
1407 | goto out; | 1436 | goto out; |
1408 | } | 1437 | } |
1409 | 1438 | ||
1410 | ret = dso__load_perf_map(dso, map, filter); | 1439 | ret = dso__load_perf_map(dso, map); |
1411 | dso->symtab_type = ret > 0 ? DSO_BINARY_TYPE__JAVA_JIT : | 1440 | dso->symtab_type = ret > 0 ? DSO_BINARY_TYPE__JAVA_JIT : |
1412 | DSO_BINARY_TYPE__NOT_FOUND; | 1441 | DSO_BINARY_TYPE__NOT_FOUND; |
1413 | goto out; | 1442 | goto out; |
@@ -1498,14 +1527,14 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter) | |||
1498 | kmod = true; | 1527 | kmod = true; |
1499 | 1528 | ||
1500 | if (syms_ss) | 1529 | if (syms_ss) |
1501 | ret = dso__load_sym(dso, map, syms_ss, runtime_ss, filter, kmod); | 1530 | ret = dso__load_sym(dso, map, syms_ss, runtime_ss, kmod); |
1502 | else | 1531 | else |
1503 | ret = -1; | 1532 | ret = -1; |
1504 | 1533 | ||
1505 | if (ret > 0) { | 1534 | if (ret > 0) { |
1506 | int nr_plt; | 1535 | int nr_plt; |
1507 | 1536 | ||
1508 | nr_plt = dso__synthesize_plt_symbols(dso, runtime_ss, map, filter); | 1537 | nr_plt = dso__synthesize_plt_symbols(dso, runtime_ss, map); |
1509 | if (nr_plt > 0) | 1538 | if (nr_plt > 0) |
1510 | ret += nr_plt; | 1539 | ret += nr_plt; |
1511 | } | 1540 | } |
@@ -1544,8 +1573,7 @@ out_unlock: | |||
1544 | } | 1573 | } |
1545 | 1574 | ||
1546 | int dso__load_vmlinux(struct dso *dso, struct map *map, | 1575 | int dso__load_vmlinux(struct dso *dso, struct map *map, |
1547 | const char *vmlinux, bool vmlinux_allocated, | 1576 | const char *vmlinux, bool vmlinux_allocated) |
1548 | symbol_filter_t filter) | ||
1549 | { | 1577 | { |
1550 | int err = -1; | 1578 | int err = -1; |
1551 | struct symsrc ss; | 1579 | struct symsrc ss; |
@@ -1565,7 +1593,7 @@ int dso__load_vmlinux(struct dso *dso, struct map *map, | |||
1565 | if (symsrc__init(&ss, dso, symfs_vmlinux, symtab_type)) | 1593 | if (symsrc__init(&ss, dso, symfs_vmlinux, symtab_type)) |
1566 | return -1; | 1594 | return -1; |
1567 | 1595 | ||
1568 | err = dso__load_sym(dso, map, &ss, &ss, filter, 0); | 1596 | err = dso__load_sym(dso, map, &ss, &ss, 0); |
1569 | symsrc__destroy(&ss); | 1597 | symsrc__destroy(&ss); |
1570 | 1598 | ||
1571 | if (err > 0) { | 1599 | if (err > 0) { |
@@ -1581,8 +1609,7 @@ int dso__load_vmlinux(struct dso *dso, struct map *map, | |||
1581 | return err; | 1609 | return err; |
1582 | } | 1610 | } |
1583 | 1611 | ||
1584 | int dso__load_vmlinux_path(struct dso *dso, struct map *map, | 1612 | int dso__load_vmlinux_path(struct dso *dso, struct map *map) |
1585 | symbol_filter_t filter) | ||
1586 | { | 1613 | { |
1587 | int i, err = 0; | 1614 | int i, err = 0; |
1588 | char *filename = NULL; | 1615 | char *filename = NULL; |
@@ -1591,7 +1618,7 @@ int dso__load_vmlinux_path(struct dso *dso, struct map *map, | |||
1591 | vmlinux_path__nr_entries + 1); | 1618 | vmlinux_path__nr_entries + 1); |
1592 | 1619 | ||
1593 | for (i = 0; i < vmlinux_path__nr_entries; ++i) { | 1620 | for (i = 0; i < vmlinux_path__nr_entries; ++i) { |
1594 | err = dso__load_vmlinux(dso, map, vmlinux_path[i], false, filter); | 1621 | err = dso__load_vmlinux(dso, map, vmlinux_path[i], false); |
1595 | if (err > 0) | 1622 | if (err > 0) |
1596 | goto out; | 1623 | goto out; |
1597 | } | 1624 | } |
@@ -1599,7 +1626,7 @@ int dso__load_vmlinux_path(struct dso *dso, struct map *map, | |||
1599 | if (!symbol_conf.ignore_vmlinux_buildid) | 1626 | if (!symbol_conf.ignore_vmlinux_buildid) |
1600 | filename = dso__build_id_filename(dso, NULL, 0); | 1627 | filename = dso__build_id_filename(dso, NULL, 0); |
1601 | if (filename != NULL) { | 1628 | if (filename != NULL) { |
1602 | err = dso__load_vmlinux(dso, map, filename, true, filter); | 1629 | err = dso__load_vmlinux(dso, map, filename, true); |
1603 | if (err > 0) | 1630 | if (err > 0) |
1604 | goto out; | 1631 | goto out; |
1605 | free(filename); | 1632 | free(filename); |
@@ -1713,8 +1740,7 @@ proc_kallsyms: | |||
1713 | return strdup(path); | 1740 | return strdup(path); |
1714 | } | 1741 | } |
1715 | 1742 | ||
1716 | static int dso__load_kernel_sym(struct dso *dso, struct map *map, | 1743 | static int dso__load_kernel_sym(struct dso *dso, struct map *map) |
1717 | symbol_filter_t filter) | ||
1718 | { | 1744 | { |
1719 | int err; | 1745 | int err; |
1720 | const char *kallsyms_filename = NULL; | 1746 | const char *kallsyms_filename = NULL; |
@@ -1740,12 +1766,11 @@ static int dso__load_kernel_sym(struct dso *dso, struct map *map, | |||
1740 | } | 1766 | } |
1741 | 1767 | ||
1742 | if (!symbol_conf.ignore_vmlinux && symbol_conf.vmlinux_name != NULL) { | 1768 | if (!symbol_conf.ignore_vmlinux && symbol_conf.vmlinux_name != NULL) { |
1743 | return dso__load_vmlinux(dso, map, symbol_conf.vmlinux_name, | 1769 | return dso__load_vmlinux(dso, map, symbol_conf.vmlinux_name, false); |
1744 | false, filter); | ||
1745 | } | 1770 | } |
1746 | 1771 | ||
1747 | if (!symbol_conf.ignore_vmlinux && vmlinux_path != NULL) { | 1772 | if (!symbol_conf.ignore_vmlinux && vmlinux_path != NULL) { |
1748 | err = dso__load_vmlinux_path(dso, map, filter); | 1773 | err = dso__load_vmlinux_path(dso, map); |
1749 | if (err > 0) | 1774 | if (err > 0) |
1750 | return err; | 1775 | return err; |
1751 | } | 1776 | } |
@@ -1761,7 +1786,7 @@ static int dso__load_kernel_sym(struct dso *dso, struct map *map, | |||
1761 | kallsyms_filename = kallsyms_allocated_filename; | 1786 | kallsyms_filename = kallsyms_allocated_filename; |
1762 | 1787 | ||
1763 | do_kallsyms: | 1788 | do_kallsyms: |
1764 | err = dso__load_kallsyms(dso, kallsyms_filename, map, filter); | 1789 | err = dso__load_kallsyms(dso, kallsyms_filename, map); |
1765 | if (err > 0) | 1790 | if (err > 0) |
1766 | pr_debug("Using %s for symbols\n", kallsyms_filename); | 1791 | pr_debug("Using %s for symbols\n", kallsyms_filename); |
1767 | free(kallsyms_allocated_filename); | 1792 | free(kallsyms_allocated_filename); |
@@ -1776,8 +1801,7 @@ do_kallsyms: | |||
1776 | return err; | 1801 | return err; |
1777 | } | 1802 | } |
1778 | 1803 | ||
1779 | static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map, | 1804 | static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map) |
1780 | symbol_filter_t filter) | ||
1781 | { | 1805 | { |
1782 | int err; | 1806 | int err; |
1783 | const char *kallsyms_filename = NULL; | 1807 | const char *kallsyms_filename = NULL; |
@@ -1799,7 +1823,7 @@ static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map, | |||
1799 | if (symbol_conf.default_guest_vmlinux_name != NULL) { | 1823 | if (symbol_conf.default_guest_vmlinux_name != NULL) { |
1800 | err = dso__load_vmlinux(dso, map, | 1824 | err = dso__load_vmlinux(dso, map, |
1801 | symbol_conf.default_guest_vmlinux_name, | 1825 | symbol_conf.default_guest_vmlinux_name, |
1802 | false, filter); | 1826 | false); |
1803 | return err; | 1827 | return err; |
1804 | } | 1828 | } |
1805 | 1829 | ||
@@ -1811,7 +1835,7 @@ static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map, | |||
1811 | kallsyms_filename = path; | 1835 | kallsyms_filename = path; |
1812 | } | 1836 | } |
1813 | 1837 | ||
1814 | err = dso__load_kallsyms(dso, kallsyms_filename, map, filter); | 1838 | err = dso__load_kallsyms(dso, kallsyms_filename, map); |
1815 | if (err > 0) | 1839 | if (err > 0) |
1816 | pr_debug("Using %s for symbols\n", kallsyms_filename); | 1840 | pr_debug("Using %s for symbols\n", kallsyms_filename); |
1817 | if (err > 0 && !dso__is_kcore(dso)) { | 1841 | if (err > 0 && !dso__is_kcore(dso)) { |
@@ -1948,6 +1972,23 @@ static bool symbol__read_kptr_restrict(void) | |||
1948 | return value; | 1972 | return value; |
1949 | } | 1973 | } |
1950 | 1974 | ||
1975 | int symbol__annotation_init(void) | ||
1976 | { | ||
1977 | if (symbol_conf.initialized) { | ||
1978 | pr_err("Annotation needs to be init before symbol__init()\n"); | ||
1979 | return -1; | ||
1980 | } | ||
1981 | |||
1982 | if (symbol_conf.init_annotation) { | ||
1983 | pr_warning("Annotation being initialized multiple times\n"); | ||
1984 | return 0; | ||
1985 | } | ||
1986 | |||
1987 | symbol_conf.priv_size += sizeof(struct annotation); | ||
1988 | symbol_conf.init_annotation = true; | ||
1989 | return 0; | ||
1990 | } | ||
1991 | |||
1951 | int symbol__init(struct perf_env *env) | 1992 | int symbol__init(struct perf_env *env) |
1952 | { | 1993 | { |
1953 | const char *symfs; | 1994 | const char *symfs; |