History

perf tools: Fix module symbol processing

The 'dso->kernel' condition is true also for kernel modules now, and there are several places that were omited by the initial change: - we need to identify modules separately in dso__process_kernel_symbol - we need to set 'dso->kernel' for module from buildid table - there's no need to use 'dso->kernel || kmodule' in one condition Committer testing: Before: # perf test -v object <SNIP> Objdump command is: objdump -z -d --start-address=0xffffffff813e682f --stop-address=0xffffffff813e68af /usr/lib/debug/lib/modules/5.7.14-200.fc32.x86_64/vmlinux Bytes read match those read by objdump Reading object code for memory address: 0xffffffffc02dc257 File is: /lib/modules/5.7.14-200.fc32.x86_64/kernel/arch/x86/crypto/crc32c-intel.ko.xz On file address is: 0xffffffffc02dc2e7 dso__data_read_offset failed test child finished with -1 ---- end ---- Object code reading: FAILED! # After: # perf test object 26: Object code reading : Ok # perf test object 26: Object code reading : Ok # perf test object 26: Object code reading : Ok # perf test object 26: Object code reading : Ok # perf test object 26: Object code reading : Ok #

Jiri Olsa committed 6 years ago

Commit b2fe96a1 parent 1c695c82 files · +4 −5Browse files

Unified · Split

2 files
  1. tools/perf/util/header.c +1 −2
  2. tools/perf/util/symbol-elf.c +3 −3
tools/perf/util/header.c+1−2
@@ -2090,9 +2090,8 @@ static int __event_process_build_id(struct perf_record_header_build_id *bev, · 2089 unmodified lines
2090 2090
2091 if (!kmod_path__parse_name(&m, filename) && m.kmod)2091 if (!kmod_path__parse_name(&m, filename) && m.kmod)
2092 dso__set_module_info(dso, &m, machine);2092 dso__set_module_info(dso, &m, machine);
2093 else
2094 dso->kernel = dso_space;
2095 2093
2094 dso->kernel = dso_space;
2096 free(m.name);2095 free(m.name);
2097 }2096 }
2098 2097
tools/perf/util/symbol-elf.c+3−3
@@ -872,7 +872,7 @@ static int dso__process_kernel_symbol(struct dso *dso, struct map *map, · 871 unmodified lines
872 * kallsyms and identity maps. Overwrite it to872 * kallsyms and identity maps. Overwrite it to
873 * map to the kernel dso.873 * map to the kernel dso.
874 */874 */
875 if (*remap_kernel && dso->kernel) {875 if (*remap_kernel && dso->kernel && !kmodule) {
876 *remap_kernel = false;876 *remap_kernel = false;
877 map->start = shdr->sh_addr + ref_reloc(kmap);877 map->start = shdr->sh_addr + ref_reloc(kmap);
878 map->end = map->start + shdr->sh_size;878 map->end = map->start + shdr->sh_size;
@@ -1068,7 +1068,7 @@ int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss, · 189 unmodified lines
1068 * Initial kernel and module mappings do not map to the dso.1068 * Initial kernel and module mappings do not map to the dso.
1069 * Flag the fixups.1069 * Flag the fixups.
1070 */1070 */
1071 if (dso->kernel || kmodule) {1071 if (dso->kernel) {
1072 remap_kernel = true;1072 remap_kernel = true;
1073 adjust_kernel_syms = dso->adjust_symbols;1073 adjust_kernel_syms = dso->adjust_symbols;
1074 }1074 }
@@ -1130,7 +1130,7 @@ int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss, · 55 unmodified lines
1130 (sym.st_value & 1))1130 (sym.st_value & 1))
1131 --sym.st_value;1131 --sym.st_value;
1132 1132
1133 if (dso->kernel || kmodule) {1133 if (dso->kernel) {
1134 if (dso__process_kernel_symbol(dso, map, &sym, &shdr, kmaps, kmap, &curr_dso, &curr_map,1134 if (dso__process_kernel_symbol(dso, map, &sym, &shdr, kmaps, kmap, &curr_dso, &curr_map,
1135 section_name, adjust_kernel_syms, kmodule, &remap_kernel))1135 section_name, adjust_kernel_syms, kmodule, &remap_kernel))
1136 goto out_elf_end;1136 goto out_elf_end;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t