diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-26 14:25:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-26 14:25:21 -0400 |
commit | d207ea8e74ff45be0838afa12bdd2492fa9dc8bc (patch) | |
tree | 97cfb3ed5c1bb42790e98e62b823526f61000b9f /kernel | |
parent | 2a8a2b7c49d6eb5f3348892c4676267376cfd40b (diff) | |
parent | 66e5db4a1ccc64f278653bc69dc406d184dc750a (diff) |
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf updates from Thomas Gleixner:
"Kernel:
- Improve kallsyms coverage
- Add x86 entry trampolines to kcore
- Fix ARM SPE handling
- Correct PPC event post processing
Tools:
- Make the build system more robust
- Small fixes and enhancements all over the place
- Update kernel ABI header copies
- Preparatory work for converting libtraceevnt to a shared library
- License cleanups"
* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (100 commits)
tools arch: Update arch/x86/lib/memcpy_64.S copy used in 'perf bench mem memcpy'
tools arch x86: Update tools's copy of cpufeatures.h
perf python: Fix pyrf_evlist__read_on_cpu() interface
perf mmap: Store real cpu number in 'struct perf_mmap'
perf tools: Remove ext from struct kmod_path
perf tools: Add gzip_is_compressed function
perf tools: Add lzma_is_compressed function
perf tools: Add is_compressed callback to compressions array
perf tools: Move the temp file processing into decompress_kmodule
perf tools: Use compression id in decompress_kmodule()
perf tools: Store compression id into struct dso
perf tools: Add compression id into 'struct kmod_path'
perf tools: Make is_supported_compression() static
perf tools: Make decompress_to_file() function static
perf tools: Get rid of dso__needs_decompress() call in __open_dso()
perf tools: Get rid of dso__needs_decompress() call in symbol__disassemble()
perf tools: Get rid of dso__needs_decompress() call in read_object_code()
tools lib traceevent: Change to SPDX License format
perf llvm: Allow passing options to llc in addition to clang
perf parser: Improve error message for PMU address filters
...
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/kallsyms.c | 51 |
1 files changed, 37 insertions, 14 deletions
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index a23e21ada81b..02a0b01380d8 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c | |||
@@ -432,6 +432,7 @@ int sprint_backtrace(char *buffer, unsigned long address) | |||
432 | /* To avoid using get_symbol_offset for every symbol, we carry prefix along. */ | 432 | /* To avoid using get_symbol_offset for every symbol, we carry prefix along. */ |
433 | struct kallsym_iter { | 433 | struct kallsym_iter { |
434 | loff_t pos; | 434 | loff_t pos; |
435 | loff_t pos_arch_end; | ||
435 | loff_t pos_mod_end; | 436 | loff_t pos_mod_end; |
436 | loff_t pos_ftrace_mod_end; | 437 | loff_t pos_ftrace_mod_end; |
437 | unsigned long value; | 438 | unsigned long value; |
@@ -443,9 +444,29 @@ struct kallsym_iter { | |||
443 | int show_value; | 444 | int show_value; |
444 | }; | 445 | }; |
445 | 446 | ||
447 | int __weak arch_get_kallsym(unsigned int symnum, unsigned long *value, | ||
448 | char *type, char *name) | ||
449 | { | ||
450 | return -EINVAL; | ||
451 | } | ||
452 | |||
453 | static int get_ksymbol_arch(struct kallsym_iter *iter) | ||
454 | { | ||
455 | int ret = arch_get_kallsym(iter->pos - kallsyms_num_syms, | ||
456 | &iter->value, &iter->type, | ||
457 | iter->name); | ||
458 | |||
459 | if (ret < 0) { | ||
460 | iter->pos_arch_end = iter->pos; | ||
461 | return 0; | ||
462 | } | ||
463 | |||
464 | return 1; | ||
465 | } | ||
466 | |||
446 | static int get_ksymbol_mod(struct kallsym_iter *iter) | 467 | static int get_ksymbol_mod(struct kallsym_iter *iter) |
447 | { | 468 | { |
448 | int ret = module_get_kallsym(iter->pos - kallsyms_num_syms, | 469 | int ret = module_get_kallsym(iter->pos - iter->pos_arch_end, |
449 | &iter->value, &iter->type, | 470 | &iter->value, &iter->type, |
450 | iter->name, iter->module_name, | 471 | iter->name, iter->module_name, |
451 | &iter->exported); | 472 | &iter->exported); |
@@ -501,32 +522,34 @@ static void reset_iter(struct kallsym_iter *iter, loff_t new_pos) | |||
501 | iter->nameoff = get_symbol_offset(new_pos); | 522 | iter->nameoff = get_symbol_offset(new_pos); |
502 | iter->pos = new_pos; | 523 | iter->pos = new_pos; |
503 | if (new_pos == 0) { | 524 | if (new_pos == 0) { |
525 | iter->pos_arch_end = 0; | ||
504 | iter->pos_mod_end = 0; | 526 | iter->pos_mod_end = 0; |
505 | iter->pos_ftrace_mod_end = 0; | 527 | iter->pos_ftrace_mod_end = 0; |
506 | } | 528 | } |
507 | } | 529 | } |
508 | 530 | ||
531 | /* | ||
532 | * The end position (last + 1) of each additional kallsyms section is recorded | ||
533 | * in iter->pos_..._end as each section is added, and so can be used to | ||
534 | * determine which get_ksymbol_...() function to call next. | ||
535 | */ | ||
509 | static int update_iter_mod(struct kallsym_iter *iter, loff_t pos) | 536 | static int update_iter_mod(struct kallsym_iter *iter, loff_t pos) |
510 | { | 537 | { |
511 | iter->pos = pos; | 538 | iter->pos = pos; |
512 | 539 | ||
513 | if (iter->pos_ftrace_mod_end > 0 && | 540 | if ((!iter->pos_arch_end || iter->pos_arch_end > pos) && |
514 | iter->pos_ftrace_mod_end < iter->pos) | 541 | get_ksymbol_arch(iter)) |
515 | return get_ksymbol_bpf(iter); | 542 | return 1; |
516 | 543 | ||
517 | if (iter->pos_mod_end > 0 && | 544 | if ((!iter->pos_mod_end || iter->pos_mod_end > pos) && |
518 | iter->pos_mod_end < iter->pos) { | 545 | get_ksymbol_mod(iter)) |
519 | if (!get_ksymbol_ftrace_mod(iter)) | ||
520 | return get_ksymbol_bpf(iter); | ||
521 | return 1; | 546 | return 1; |
522 | } | ||
523 | 547 | ||
524 | if (!get_ksymbol_mod(iter)) { | 548 | if ((!iter->pos_ftrace_mod_end || iter->pos_ftrace_mod_end > pos) && |
525 | if (!get_ksymbol_ftrace_mod(iter)) | 549 | get_ksymbol_ftrace_mod(iter)) |
526 | return get_ksymbol_bpf(iter); | 550 | return 1; |
527 | } | ||
528 | 551 | ||
529 | return 1; | 552 | return get_ksymbol_bpf(iter); |
530 | } | 553 | } |
531 | 554 | ||
532 | /* Returns false if pos at or past end of file. */ | 555 | /* Returns false if pos at or past end of file. */ |