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
20902090
20912091 if (!kmod_path__parse_name(&m, filename) && m.kmod)
20922092 dso__set_module_info(dso, &m, machine);
2093− else
2094− dso->kernel = dso_space;
20952093
2094+ dso->kernel = dso_space;
20962095 free(m.name);
20972096 }
20982097
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
872872 * kallsyms and identity maps. Overwrite it to
873873 * map to the kernel dso.
874874 */
875− if (*remap_kernel && dso->kernel) {
875+ if (*remap_kernel && dso->kernel && !kmodule) {
876876 *remap_kernel = false;
877877 map->start = shdr->sh_addr + ref_reloc(kmap);
878878 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
10681068 * Initial kernel and module mappings do not map to the dso.
10691069 * Flag the fixups.
10701070 */
1071− if (dso->kernel || kmodule) {
1071+ if (dso->kernel) {
10721072 remap_kernel = true;
10731073 adjust_kernel_syms = dso->adjust_symbols;
10741074 }
@@ -1130,7 +1130,7 @@ int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss, · 55 unmodified lines
11301130 (sym.st_value & 1))
11311131 --sym.st_value;
11321132
1133− if (dso->kernel || kmodule) {
1133+ if (dso->kernel) {
11341134 if (dso__process_kernel_symbol(dso, map, &sym, &shdr, kmaps, kmap, &curr_dso, &curr_map,
11351135 section_name, adjust_kernel_syms, kmodule, &remap_kernel))
11361136 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