mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
perf map: Add accessor for dso
Later changes will add reference count checking for struct map, with dso being the most frequently accessed variable. Add an accessor so that the reference count check is only necessary in one place. Additional changes: - add a dso variable to avoid repeated map__dso calls. - in builtin-mem.c dump_raw_samples, code only partially tested for dso == NULL. Make the possibility of NULL consistent. - in thread.c thread__memcpy fix use of spaces and use tabs. Committer notes: Did missing conversions on these files: tools/perf/arch/powerpc/util/skip-callchain-idx.c tools/perf/arch/powerpc/util/sym-handling.c tools/perf/ui/browsers/hists.c tools/perf/ui/gtk/annotate.c tools/perf/util/cs-etm.c tools/perf/util/thread.c tools/perf/util/unwind-libunwind-local.c tools/perf/util/unwind-libunwind.c Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Darren Hart <dvhart@infradead.org> Cc: Davidlohr Bueso <dave@stgolabs.net> Cc: Dmitriy Vyukov <dvyukov@google.com> Cc: Eric Dumazet <edumazet@google.com> Cc: German Gomez <german.gomez@arm.com> Cc: Hao Luo <haoluo@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@arm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Garry <john.g.garry@oracle.com> Cc: Kajol Jain <kjain@linux.ibm.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Leo Yan <leo.yan@linaro.org> Cc: Madhavan Srinivasan <maddy@linux.ibm.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Miaoqian Lin <linmq006@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Riccardo Mancini <rickyman7@gmail.com> Cc: Shunsuke Nakamura <nakamura.shun@fujitsu.com> Cc: Song Liu <song@kernel.org> Cc: Stephane Eranian <eranian@google.com> Cc: Stephen Brennan <stephen.s.brennan@oracle.com> Cc: Steven Rostedt (VMware) <rostedt@goodmis.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Thomas Richter <tmricht@linux.ibm.com> Cc: Yury Norov <yury.norov@gmail.com> Link: https://lore.kernel.org/r/20230320212248.1175731-2-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
5ab6d715c3
commit
63df0e4bc3
@@ -255,7 +255,7 @@ int arch_skip_callchain_idx(struct thread *thread, struct ip_callchain *chain)
|
||||
thread__find_symbol(thread, PERF_RECORD_MISC_USER, ip, &al);
|
||||
|
||||
if (al.map)
|
||||
dso = al.map->dso;
|
||||
dso = map__dso(al.map);
|
||||
|
||||
if (!dso) {
|
||||
pr_debug("%" PRIx64 " dso is NULL\n", ip);
|
||||
|
||||
@@ -104,7 +104,7 @@ void arch__fix_tev_from_maps(struct perf_probe_event *pev,
|
||||
|
||||
lep_offset = PPC64_LOCAL_ENTRY_OFFSET(sym->arch_sym);
|
||||
|
||||
if (map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS)
|
||||
if (map__dso(map)->symtab_type == DSO_BINARY_TYPE__KALLSYMS)
|
||||
tev->point.offset += PPC64LE_LEP_OFFSET;
|
||||
else if (lep_offset) {
|
||||
if (pev->uprobes)
|
||||
|
||||
@@ -205,7 +205,7 @@ static int process_branch_callback(struct evsel *evsel,
|
||||
return 0;
|
||||
|
||||
if (a.map != NULL)
|
||||
a.map->dso->hit = 1;
|
||||
map__dso(a.map)->hit = 1;
|
||||
|
||||
hist__account_cycles(sample->branch_stack, al, sample, false, NULL);
|
||||
|
||||
@@ -235,10 +235,11 @@ static int evsel__add_sample(struct evsel *evsel, struct perf_sample *sample,
|
||||
* the DSO?
|
||||
*/
|
||||
if (al->sym != NULL) {
|
||||
rb_erase_cached(&al->sym->rb_node,
|
||||
&al->map->dso->symbols);
|
||||
struct dso *dso = map__dso(al->map);
|
||||
|
||||
rb_erase_cached(&al->sym->rb_node, &dso->symbols);
|
||||
symbol__delete(al->sym);
|
||||
dso__reset_find_symbol_cache(al->map->dso);
|
||||
dso__reset_find_symbol_cache(dso);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -320,7 +321,7 @@ static void hists__find_annotations(struct hists *hists,
|
||||
struct hist_entry *he = rb_entry(nd, struct hist_entry, rb_node);
|
||||
struct annotation *notes;
|
||||
|
||||
if (he->ms.sym == NULL || he->ms.map->dso->annotate_warned)
|
||||
if (he->ms.sym == NULL || map__dso(he->ms.map)->annotate_warned)
|
||||
goto find_next;
|
||||
|
||||
if (ann->sym_hist_filter &&
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
static int buildid__map_cb(struct map *map, void *arg __maybe_unused)
|
||||
{
|
||||
const struct dso *dso = map->dso;
|
||||
const struct dso *dso = map__dso(map);
|
||||
char bid_buf[SBUILD_ID_SIZE];
|
||||
|
||||
memset(bid_buf, 0, sizeof(bid_buf));
|
||||
|
||||
@@ -753,9 +753,11 @@ int perf_event__inject_buildid(struct perf_tool *tool, union perf_event *event,
|
||||
}
|
||||
|
||||
if (thread__find_map(thread, sample->cpumode, sample->ip, &al)) {
|
||||
if (!al.map->dso->hit) {
|
||||
al.map->dso->hit = 1;
|
||||
dso__inject_build_id(al.map->dso, tool, machine,
|
||||
struct dso *dso = map__dso(al.map);
|
||||
|
||||
if (!dso->hit) {
|
||||
dso->hit = 1;
|
||||
dso__inject_build_id(dso, tool, machine,
|
||||
sample->cpumode, al.map->flags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ static int __cmd_kallsyms(int argc, const char **argv)
|
||||
|
||||
for (i = 0; i < argc; ++i) {
|
||||
struct map *map;
|
||||
const struct dso *dso;
|
||||
struct symbol *symbol = machine__find_kernel_symbol_by_name(machine, argv[i], &map);
|
||||
|
||||
if (symbol == NULL) {
|
||||
@@ -35,8 +36,9 @@ static int __cmd_kallsyms(int argc, const char **argv)
|
||||
continue;
|
||||
}
|
||||
|
||||
dso = map__dso(map);
|
||||
printf("%s: %s %s %#" PRIx64 "-%#" PRIx64 " (%#" PRIx64 "-%#" PRIx64")\n",
|
||||
symbol->name, map->dso->short_name, map->dso->long_name,
|
||||
symbol->name, dso->short_name, dso->long_name,
|
||||
map->unmap_ip(map, symbol->start), map->unmap_ip(map, symbol->end),
|
||||
symbol->start, symbol->end);
|
||||
}
|
||||
|
||||
@@ -200,6 +200,7 @@ dump_raw_samples(struct perf_tool *tool,
|
||||
struct addr_location al;
|
||||
const char *fmt, *field_sep;
|
||||
char str[PAGE_SIZE_NAME_LEN];
|
||||
struct dso *dso = NULL;
|
||||
|
||||
if (machine__resolve(machine, &al, sample) < 0) {
|
||||
fprintf(stderr, "problem processing %d event, skipping it.\n",
|
||||
@@ -210,8 +211,11 @@ dump_raw_samples(struct perf_tool *tool,
|
||||
if (al.filtered || (mem->hide_unresolved && al.sym == NULL))
|
||||
goto out_put;
|
||||
|
||||
if (al.map != NULL)
|
||||
al.map->dso->hit = 1;
|
||||
if (al.map != NULL) {
|
||||
dso = map__dso(al.map);
|
||||
if (dso)
|
||||
dso->hit = 1;
|
||||
}
|
||||
|
||||
field_sep = symbol_conf.field_sep;
|
||||
if (field_sep) {
|
||||
@@ -252,7 +256,7 @@ dump_raw_samples(struct perf_tool *tool,
|
||||
symbol_conf.field_sep,
|
||||
sample->data_src,
|
||||
symbol_conf.field_sep,
|
||||
al.map ? (al.map->dso ? al.map->dso->long_name : "???") : "???",
|
||||
dso ? dso->long_name : "???",
|
||||
al.sym ? al.sym->name : "???");
|
||||
out_put:
|
||||
addr_location__put(&al);
|
||||
|
||||
@@ -319,7 +319,7 @@ static int process_sample_event(struct perf_tool *tool,
|
||||
}
|
||||
|
||||
if (al.map != NULL)
|
||||
al.map->dso->hit = 1;
|
||||
map__dso(al.map)->hit = 1;
|
||||
|
||||
if (ui__has_annotation() || rep->symbol_ipc || rep->total_cycles_mode) {
|
||||
hist__account_cycles(sample->branch_stack, &al, sample,
|
||||
@@ -608,7 +608,7 @@ static void report__warn_kptr_restrict(const struct report *rep)
|
||||
return;
|
||||
|
||||
if (kernel_map == NULL ||
|
||||
(kernel_map->dso->hit &&
|
||||
(map__dso(kernel_map)->hit &&
|
||||
(kernel_kmap->ref_reloc_sym == NULL ||
|
||||
kernel_kmap->ref_reloc_sym->addr == 0))) {
|
||||
const char *desc =
|
||||
@@ -848,6 +848,7 @@ static size_t maps__fprintf_task(struct maps *maps, int indent, FILE *fp)
|
||||
|
||||
maps__for_each_entry(maps, rb_node) {
|
||||
struct map *map = rb_node->map;
|
||||
const struct dso *dso = map__dso(map);
|
||||
|
||||
printed += fprintf(fp, "%*s %" PRIx64 "-%" PRIx64 " %c%c%c%c %08" PRIx64 " %" PRIu64 " %s\n",
|
||||
indent, "", map->start, map->end,
|
||||
@@ -856,7 +857,7 @@ static size_t maps__fprintf_task(struct maps *maps, int indent, FILE *fp)
|
||||
map->prot & PROT_EXEC ? 'x' : '-',
|
||||
map->flags & MAP_SHARED ? 's' : 'p',
|
||||
map->pgoff,
|
||||
map->dso->id.ino, map->dso->name);
|
||||
dso->id.ino, dso->name);
|
||||
}
|
||||
|
||||
return printed;
|
||||
|
||||
@@ -1011,11 +1011,11 @@ static int perf_sample__fprintf_brstackoff(struct perf_sample *sample,
|
||||
to = entries[i].to;
|
||||
|
||||
if (thread__find_map_fb(thread, sample->cpumode, from, &alf) &&
|
||||
!alf.map->dso->adjust_symbols)
|
||||
!map__dso(alf.map)->adjust_symbols)
|
||||
from = map__map_ip(alf.map, from);
|
||||
|
||||
if (thread__find_map_fb(thread, sample->cpumode, to, &alt) &&
|
||||
!alt.map->dso->adjust_symbols)
|
||||
!map__dso(alt.map)->adjust_symbols)
|
||||
to = map__map_ip(alt.map, to);
|
||||
|
||||
printed += fprintf(fp, " 0x%"PRIx64, from);
|
||||
@@ -1044,6 +1044,7 @@ static int grab_bb(u8 *buffer, u64 start, u64 end,
|
||||
long offset, len;
|
||||
struct addr_location al;
|
||||
bool kernel;
|
||||
struct dso *dso;
|
||||
|
||||
if (!start || !end)
|
||||
return 0;
|
||||
@@ -1074,11 +1075,12 @@ static int grab_bb(u8 *buffer, u64 start, u64 end,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!thread__find_map(thread, *cpumode, start, &al) || !al.map->dso) {
|
||||
dso = map__dso(al.map);
|
||||
if (!thread__find_map(thread, *cpumode, start, &al) || !dso) {
|
||||
pr_debug("\tcannot resolve %" PRIx64 "-%" PRIx64 "\n", start, end);
|
||||
return 0;
|
||||
}
|
||||
if (al.map->dso->data.status == DSO_DATA_STATUS_ERROR) {
|
||||
if (dso->data.status == DSO_DATA_STATUS_ERROR) {
|
||||
pr_debug("\tcannot resolve %" PRIx64 "-%" PRIx64 "\n", start, end);
|
||||
return 0;
|
||||
}
|
||||
@@ -1087,10 +1089,10 @@ static int grab_bb(u8 *buffer, u64 start, u64 end,
|
||||
map__load(al.map);
|
||||
|
||||
offset = al.map->map_ip(al.map, start);
|
||||
len = dso__data_read_offset(al.map->dso, machine, offset, (u8 *)buffer,
|
||||
len = dso__data_read_offset(dso, machine, offset, (u8 *)buffer,
|
||||
end - start + MAXINSN);
|
||||
|
||||
*is64bit = al.map->dso->is_64_bit;
|
||||
*is64bit = dso->is_64_bit;
|
||||
if (len <= 0)
|
||||
pr_debug("\tcannot fetch code for block at %" PRIx64 "-%" PRIx64 "\n",
|
||||
start, end);
|
||||
@@ -1104,10 +1106,11 @@ static int map__fprintf_srccode(struct map *map, u64 addr, FILE *fp, struct srcc
|
||||
unsigned line;
|
||||
int len;
|
||||
char *srccode;
|
||||
struct dso *dso = map__dso(map);
|
||||
|
||||
if (!map || !map->dso)
|
||||
if (!map || !dso)
|
||||
return 0;
|
||||
srcfile = get_srcline_split(map->dso,
|
||||
srcfile = get_srcline_split(dso,
|
||||
map__rip_2objdump(map, addr),
|
||||
&line);
|
||||
if (!srcfile)
|
||||
|
||||
@@ -114,6 +114,7 @@ static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he)
|
||||
struct symbol *sym;
|
||||
struct annotation *notes;
|
||||
struct map *map;
|
||||
struct dso *dso;
|
||||
int err = -1;
|
||||
|
||||
if (!he || !he->ms.sym)
|
||||
@@ -123,12 +124,12 @@ static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he)
|
||||
|
||||
sym = he->ms.sym;
|
||||
map = he->ms.map;
|
||||
dso = map__dso(map);
|
||||
|
||||
/*
|
||||
* We can't annotate with just /proc/kallsyms
|
||||
*/
|
||||
if (map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS &&
|
||||
!dso__is_kcore(map->dso)) {
|
||||
if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS && !dso__is_kcore(dso)) {
|
||||
pr_err("Can't annotate %s: No vmlinux file was found in the "
|
||||
"path\n", sym->name);
|
||||
sleep(1);
|
||||
@@ -169,6 +170,7 @@ static void ui__warn_map_erange(struct map *map, struct symbol *sym, u64 ip)
|
||||
{
|
||||
struct utsname uts;
|
||||
int err = uname(&uts);
|
||||
struct dso *dso = map__dso(map);
|
||||
|
||||
ui__warning("Out of bounds address found:\n\n"
|
||||
"Addr: %" PRIx64 "\n"
|
||||
@@ -180,7 +182,7 @@ static void ui__warn_map_erange(struct map *map, struct symbol *sym, u64 ip)
|
||||
"Tools: %s\n\n"
|
||||
"Not all samples will be on the annotation output.\n\n"
|
||||
"Please report to linux-kernel@vger.kernel.org\n",
|
||||
ip, map->dso->long_name, dso__symtab_origin(map->dso),
|
||||
ip, dso->long_name, dso__symtab_origin(dso),
|
||||
map->start, map->end, sym->start, sym->end,
|
||||
sym->binding == STB_GLOBAL ? 'g' :
|
||||
sym->binding == STB_LOCAL ? 'l' : 'w', sym->name,
|
||||
@@ -810,7 +812,8 @@ static void perf_event__process_sample(struct perf_tool *tool,
|
||||
__map__is_kernel(al.map) && map__has_symbols(al.map)) {
|
||||
if (symbol_conf.vmlinux_name) {
|
||||
char serr[256];
|
||||
dso__strerror_load(al.map->dso, serr, sizeof(serr));
|
||||
|
||||
dso__strerror_load(map__dso(al.map), serr, sizeof(serr));
|
||||
ui__warning("The %s file can't be used: %s\n%s",
|
||||
symbol_conf.vmlinux_name, serr, msg);
|
||||
} else {
|
||||
|
||||
@@ -2863,7 +2863,7 @@ static void print_location(FILE *f, struct perf_sample *sample,
|
||||
{
|
||||
|
||||
if ((verbose > 0 || print_dso) && al->map)
|
||||
fprintf(f, "%s@", al->map->dso->long_name);
|
||||
fprintf(f, "%s@", map__dso(al->map)->long_name);
|
||||
|
||||
if ((verbose > 0 || print_sym) && al->sym)
|
||||
fprintf(f, "%s+0x%" PRIx64, al->sym->name,
|
||||
|
||||
@@ -145,6 +145,7 @@ static PyObject *perf_sample_src(PyObject *obj, PyObject *args, bool get_srccode
|
||||
char *srccode = NULL;
|
||||
PyObject *result;
|
||||
struct map *map;
|
||||
struct dso *dso;
|
||||
int len = 0;
|
||||
u64 addr;
|
||||
|
||||
@@ -153,9 +154,10 @@ static PyObject *perf_sample_src(PyObject *obj, PyObject *args, bool get_srccode
|
||||
|
||||
map = c->al->map;
|
||||
addr = c->al->addr;
|
||||
dso = map ? map__dso(map) : NULL;
|
||||
|
||||
if (map && map->dso)
|
||||
srcfile = get_srcline_split(map->dso, map__rip_2objdump(map, addr), &line);
|
||||
if (dso)
|
||||
srcfile = get_srcline_split(dso, map__rip_2objdump(map, addr), &line);
|
||||
|
||||
if (get_srccode) {
|
||||
if (srcfile)
|
||||
|
||||
@@ -237,10 +237,11 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode,
|
||||
char decomp_name[KMOD_DECOMP_LEN];
|
||||
bool decomp = false;
|
||||
int ret, err = 0;
|
||||
struct dso *dso;
|
||||
|
||||
pr_debug("Reading object code for memory address: %#"PRIx64"\n", addr);
|
||||
|
||||
if (!thread__find_map(thread, cpumode, addr, &al) || !al.map->dso) {
|
||||
if (!thread__find_map(thread, cpumode, addr, &al) || !map__dso(al.map)) {
|
||||
if (cpumode == PERF_RECORD_MISC_HYPERVISOR) {
|
||||
pr_debug("Hypervisor address can not be resolved - skipping\n");
|
||||
goto out;
|
||||
@@ -250,11 +251,10 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode,
|
||||
err = -1;
|
||||
goto out;
|
||||
}
|
||||
dso = map__dso(al.map);
|
||||
pr_debug("File is: %s\n", dso->long_name);
|
||||
|
||||
pr_debug("File is: %s\n", al.map->dso->long_name);
|
||||
|
||||
if (al.map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS &&
|
||||
!dso__is_kcore(al.map->dso)) {
|
||||
if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS && !dso__is_kcore(dso)) {
|
||||
pr_debug("Unexpected kernel address - skipping\n");
|
||||
goto out;
|
||||
}
|
||||
@@ -269,7 +269,7 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode,
|
||||
len = al.map->end - addr;
|
||||
|
||||
/* Read the object code using perf */
|
||||
ret_len = dso__data_read_offset(al.map->dso, maps__machine(thread->maps),
|
||||
ret_len = dso__data_read_offset(dso, maps__machine(thread->maps),
|
||||
al.addr, buf1, len);
|
||||
if (ret_len != len) {
|
||||
pr_debug("dso__data_read_offset failed\n");
|
||||
@@ -287,7 +287,7 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode,
|
||||
}
|
||||
|
||||
/* objdump struggles with kcore - try each map only once */
|
||||
if (dso__is_kcore(al.map->dso)) {
|
||||
if (dso__is_kcore(dso)) {
|
||||
size_t d;
|
||||
|
||||
for (d = 0; d < state->done_cnt; d++) {
|
||||
@@ -304,9 +304,9 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode,
|
||||
state->done[state->done_cnt++] = al.map->start;
|
||||
}
|
||||
|
||||
objdump_name = al.map->dso->long_name;
|
||||
if (dso__needs_decompress(al.map->dso)) {
|
||||
if (dso__decompress_kmodule_path(al.map->dso, objdump_name,
|
||||
objdump_name = dso->long_name;
|
||||
if (dso__needs_decompress(dso)) {
|
||||
if (dso__decompress_kmodule_path(dso, objdump_name,
|
||||
decomp_name,
|
||||
sizeof(decomp_name)) < 0) {
|
||||
pr_debug("decompression failed\n");
|
||||
@@ -335,7 +335,7 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode,
|
||||
len -= ret;
|
||||
if (len) {
|
||||
pr_debug("Reducing len to %zu\n", len);
|
||||
} else if (dso__is_kcore(al.map->dso)) {
|
||||
} else if (dso__is_kcore(dso)) {
|
||||
/*
|
||||
* objdump cannot handle very large segments
|
||||
* that may be found in kcore.
|
||||
@@ -572,6 +572,7 @@ static int do_test_code_reading(bool try_kcore)
|
||||
pid_t pid;
|
||||
struct map *map;
|
||||
bool have_vmlinux, have_kcore, excl_kernel = false;
|
||||
struct dso *dso;
|
||||
|
||||
pid = getpid();
|
||||
|
||||
@@ -595,8 +596,9 @@ static int do_test_code_reading(bool try_kcore)
|
||||
pr_debug("map__load failed\n");
|
||||
goto out_err;
|
||||
}
|
||||
have_vmlinux = dso__is_vmlinux(map->dso);
|
||||
have_kcore = dso__is_kcore(map->dso);
|
||||
dso = map__dso(map);
|
||||
have_vmlinux = dso__is_vmlinux(dso);
|
||||
have_kcore = dso__is_kcore(dso);
|
||||
|
||||
/* 2nd time through we just try kcore */
|
||||
if (try_kcore && !have_kcore)
|
||||
|
||||
@@ -179,9 +179,11 @@ void print_hists_in(struct hists *hists)
|
||||
he = rb_entry(node, struct hist_entry, rb_node_in);
|
||||
|
||||
if (!he->filtered) {
|
||||
struct dso *dso = map__dso(he->ms.map);
|
||||
|
||||
pr_info("%2d: entry: %-8s [%-8s] %20s: period = %"PRIu64"\n",
|
||||
i, thread__comm_str(he->thread),
|
||||
he->ms.map->dso->short_name,
|
||||
dso->short_name,
|
||||
he->ms.sym->name, he->stat.period);
|
||||
}
|
||||
|
||||
@@ -206,9 +208,11 @@ void print_hists_out(struct hists *hists)
|
||||
he = rb_entry(node, struct hist_entry, rb_node);
|
||||
|
||||
if (!he->filtered) {
|
||||
struct dso *dso = map__dso(he->ms.map);
|
||||
|
||||
pr_info("%2d: entry: %8s:%5d [%-8s] %20s: period = %"PRIu64"/%"PRIu64"\n",
|
||||
i, thread__comm_str(he->thread), he->thread->tid,
|
||||
he->ms.map->dso->short_name,
|
||||
dso->short_name,
|
||||
he->ms.sym->name, he->stat.period,
|
||||
he->stat_acc ? he->stat_acc->period : 0);
|
||||
}
|
||||
|
||||
@@ -150,12 +150,12 @@ static void del_hist_entries(struct hists *hists)
|
||||
typedef int (*test_fn_t)(struct evsel *, struct machine *);
|
||||
|
||||
#define COMM(he) (thread__comm_str(he->thread))
|
||||
#define DSO(he) (he->ms.map->dso->short_name)
|
||||
#define DSO(he) (map__dso(he->ms.map)->short_name)
|
||||
#define SYM(he) (he->ms.sym->name)
|
||||
#define CPU(he) (he->cpu)
|
||||
#define PID(he) (he->thread->tid)
|
||||
#define DEPTH(he) (he->callchain->max_depth)
|
||||
#define CDSO(cl) (cl->ms.map->dso->short_name)
|
||||
#define CDSO(cl) (map__dso(cl->ms.map)->short_name)
|
||||
#define CSYM(cl) (cl->ms.sym->name)
|
||||
|
||||
struct result {
|
||||
|
||||
@@ -194,7 +194,7 @@ static int test__hists_filter(struct test_suite *test __maybe_unused, int subtes
|
||||
hists__filter_by_thread(hists);
|
||||
|
||||
/* now applying dso filter for 'kernel' */
|
||||
hists->dso_filter = fake_samples[0].map->dso;
|
||||
hists->dso_filter = map__dso(fake_samples[0].map);
|
||||
hists__filter_by_dso(hists);
|
||||
|
||||
if (verbose > 2) {
|
||||
@@ -288,7 +288,7 @@ static int test__hists_filter(struct test_suite *test __maybe_unused, int subtes
|
||||
|
||||
/* now applying all filters at once. */
|
||||
hists->thread_filter = fake_samples[1].thread;
|
||||
hists->dso_filter = fake_samples[1].map->dso;
|
||||
hists->dso_filter = map__dso(fake_samples[1].map);
|
||||
hists__filter_by_thread(hists);
|
||||
hists__filter_by_dso(hists);
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ static void del_hist_entries(struct hists *hists)
|
||||
typedef int (*test_fn_t)(struct evsel *, struct machine *);
|
||||
|
||||
#define COMM(he) (thread__comm_str(he->thread))
|
||||
#define DSO(he) (he->ms.map->dso->short_name)
|
||||
#define DSO(he) (map__dso(he->ms.map)->short_name)
|
||||
#define SYM(he) (he->ms.sym->name)
|
||||
#define CPU(he) (he->cpu)
|
||||
#define PID(he) (he->thread->tid)
|
||||
|
||||
@@ -26,7 +26,7 @@ static int check_maps(struct map_def *merged, unsigned int size, struct maps *ma
|
||||
|
||||
TEST_ASSERT_VAL("wrong map start", map->start == merged[i].start);
|
||||
TEST_ASSERT_VAL("wrong map end", map->end == merged[i].end);
|
||||
TEST_ASSERT_VAL("wrong map name", !strcmp(map->dso->name, merged[i].name));
|
||||
TEST_ASSERT_VAL("wrong map name", !strcmp(map__dso(map)->name, merged[i].name));
|
||||
TEST_ASSERT_VAL("wrong map refcnt", refcount_read(&map->refcnt) == 1);
|
||||
|
||||
i++;
|
||||
|
||||
@@ -102,6 +102,7 @@ static int test_file(struct test_info *ti, char *filename)
|
||||
{
|
||||
struct map *map = NULL;
|
||||
int ret, nr;
|
||||
struct dso *dso;
|
||||
|
||||
pr_debug("Testing %s\n", filename);
|
||||
|
||||
@@ -109,7 +110,8 @@ static int test_file(struct test_info *ti, char *filename)
|
||||
if (ret != TEST_OK)
|
||||
return ret;
|
||||
|
||||
nr = dso__load(map->dso, map);
|
||||
dso = map__dso(map);
|
||||
nr = dso__load(dso, map);
|
||||
if (nr < 0) {
|
||||
pr_debug("dso__load() failed!\n");
|
||||
ret = TEST_FAIL;
|
||||
@@ -122,7 +124,7 @@ static int test_file(struct test_info *ti, char *filename)
|
||||
goto out_put;
|
||||
}
|
||||
|
||||
ret = test_dso(map->dso);
|
||||
ret = test_dso(dso);
|
||||
out_put:
|
||||
map__put(map);
|
||||
|
||||
|
||||
@@ -293,15 +293,16 @@ next_pair:
|
||||
|
||||
maps__for_each_entry(maps, rb_node) {
|
||||
struct map *map = rb_node->map;
|
||||
struct dso *dso = map__dso(map);
|
||||
/*
|
||||
* If it is the kernel, kallsyms is always "[kernel.kallsyms]", while
|
||||
* the kernel will have the path for the vmlinux file being used,
|
||||
* so use the short name, less descriptive but the same ("[kernel]" in
|
||||
* both cases.
|
||||
*/
|
||||
struct map *pair = maps__find_by_name(kallsyms.kmaps, (map->dso->kernel ?
|
||||
map->dso->short_name :
|
||||
map->dso->name));
|
||||
struct map *pair = maps__find_by_name(kallsyms.kmaps, (dso->kernel ?
|
||||
dso->short_name :
|
||||
dso->name));
|
||||
if (pair) {
|
||||
pair->priv = 1;
|
||||
} else {
|
||||
@@ -326,17 +327,19 @@ next_pair:
|
||||
continue;
|
||||
|
||||
if (pair->start == mem_start) {
|
||||
struct dso *dso = map__dso(map);
|
||||
|
||||
if (!header_printed) {
|
||||
pr_info("WARN: Maps in vmlinux with a different name in kallsyms:\n");
|
||||
header_printed = true;
|
||||
}
|
||||
|
||||
pr_info("WARN: %" PRIx64 "-%" PRIx64 " %" PRIx64 " %s in kallsyms as",
|
||||
map->start, map->end, map->pgoff, map->dso->name);
|
||||
map->start, map->end, map->pgoff, dso->name);
|
||||
if (mem_end != pair->end)
|
||||
pr_info(":\nWARN: *%" PRIx64 "-%" PRIx64 " %" PRIx64,
|
||||
pair->start, pair->end, pair->pgoff);
|
||||
pr_info(" %s\n", pair->dso->name);
|
||||
pr_info(" %s\n", dso->name);
|
||||
pair->priv = 1;
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user