mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
perf dso: Add reference count checking and accessor functions
Add reference count checking to struct dso, this can help with
implementing correct reference counting discipline. To avoid
RC_CHK_ACCESS everywhere, add accessor functions for the variables in
struct dso.
The majority of the change is mechanical in nature and not easy to
split up.
Committer testing:
'perf test' up to this patch shows no regressions.
But:
util/symbol.c: In function ‘dso__load_bfd_symbols’:
util/symbol.c:1683:9: error: too few arguments to function ‘dso__set_adjust_symbols’
1683 | dso__set_adjust_symbols(dso);
| ^~~~~~~~~~~~~~~~~~~~~~~
In file included from util/symbol.c:21:
util/dso.h:268:20: note: declared here
268 | static inline void dso__set_adjust_symbols(struct dso *dso, bool val)
| ^~~~~~~~~~~~~~~~~~~~~~~
make[6]: *** [/home/acme/git/perf-tools-next/tools/build/Makefile.build:106: /tmp/tmp.ZWHbQftdN6/util/symbol.o] Error 1
MKDIR /tmp/tmp.ZWHbQftdN6/tests/workloads/
make[6]: *** Waiting for unfinished jobs....
This was updated:
- symbols__fixup_end(&dso->symbols, false);
- symbols__fixup_duplicate(&dso->symbols);
- dso->adjust_symbols = 1;
+ symbols__fixup_end(dso__symbols(dso), false);
+ symbols__fixup_duplicate(dso__symbols(dso));
+ dso__set_adjust_symbols(dso);
But not build tested with BUILD_NONDISTRO and libbfd devel files installed
(binutils-devel on fedora).
Add the missing argument:
symbols__fixup_end(dso__symbols(dso), false);
symbols__fixup_duplicate(dso__symbols(dso));
- dso__set_adjust_symbols(dso);
+ dso__set_adjust_symbols(dso, true);
Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Ben Gainey <ben.gainey@arm.com>
Cc: Changbin Du <changbin.du@huawei.com>
Cc: Chengen Du <chengen.du@canonical.com>
Cc: Colin Ian King <colin.i.king@gmail.com>
Cc: Dima Kogan <dima@secretsauce.net>
Cc: Ilkka Koskinen <ilkka@os.amperecomputing.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: K Prateek Nayak <kprateek.nayak@amd.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: Li Dong <lidong@vivo.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paran Lee <p4ranlee@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <song@kernel.org>
Cc: Sun Haiyong <sunhaiyong@loongson.cn>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: Yanteng Si <siyanteng@loongson.cn>
Cc: zhaimingbing <zhaimingbing@cmss.chinamobile.com>
Link: https://lore.kernel.org/r/20240504213803.218974-6-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
7a9418cf7f
commit
ee756ef749
@@ -219,7 +219,7 @@ static int process_branch_callback(struct evsel *evsel,
|
||||
}
|
||||
|
||||
if (a.map != NULL)
|
||||
map__dso(a.map)->hit = 1;
|
||||
dso__set_hit(map__dso(a.map));
|
||||
|
||||
hist__account_cycles(sample->branch_stack, al, sample, false, NULL);
|
||||
|
||||
@@ -254,7 +254,7 @@ static int evsel__add_sample(struct evsel *evsel, struct perf_sample *sample,
|
||||
if (al->sym != NULL) {
|
||||
struct dso *dso = map__dso(al->map);
|
||||
|
||||
rb_erase_cached(&al->sym->rb_node, &dso->symbols);
|
||||
rb_erase_cached(&al->sym->rb_node, dso__symbols(dso));
|
||||
symbol__delete(al->sym);
|
||||
dso__reset_find_symbol_cache(dso);
|
||||
}
|
||||
@@ -419,7 +419,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 || map__dso(he->ms.map)->annotate_warned)
|
||||
if (he->ms.sym == NULL || dso__annotate_warned(map__dso(he->ms.map)))
|
||||
goto find_next;
|
||||
|
||||
if (ann->sym_hist_filter &&
|
||||
|
||||
@@ -286,7 +286,7 @@ static bool dso__missing_buildid_cache(struct dso *dso, int parm __maybe_unused)
|
||||
|
||||
pr_warning("Problems with %s file, consider removing it from the cache\n",
|
||||
filename);
|
||||
} else if (memcmp(dso->bid.data, bid.data, bid.size)) {
|
||||
} else if (memcmp(dso__bid(dso)->data, bid.data, bid.size)) {
|
||||
pr_warning("Problems with %s file, consider removing it from the cache\n",
|
||||
filename);
|
||||
}
|
||||
|
||||
@@ -26,16 +26,18 @@ static int buildid__map_cb(struct map *map, void *arg __maybe_unused)
|
||||
{
|
||||
const struct dso *dso = map__dso(map);
|
||||
char bid_buf[SBUILD_ID_SIZE];
|
||||
const char *dso_long_name = dso__long_name(dso);
|
||||
const char *dso_short_name = dso__short_name(dso);
|
||||
|
||||
memset(bid_buf, 0, sizeof(bid_buf));
|
||||
if (dso->has_build_id)
|
||||
build_id__sprintf(&dso->bid, bid_buf);
|
||||
if (dso__has_build_id(dso))
|
||||
build_id__sprintf(dso__bid_const(dso), bid_buf);
|
||||
printf("%s %16" PRIx64 " %16" PRIx64, bid_buf, map__start(map), map__end(map));
|
||||
if (dso->long_name != NULL) {
|
||||
printf(" %s", dso->long_name);
|
||||
} else if (dso->short_name != NULL) {
|
||||
printf(" %s", dso->short_name);
|
||||
}
|
||||
if (dso_long_name != NULL)
|
||||
printf(" %s", dso_long_name);
|
||||
else if (dso_short_name != NULL)
|
||||
printf(" %s", dso_short_name);
|
||||
|
||||
printf("\n");
|
||||
|
||||
return 0;
|
||||
@@ -76,7 +78,7 @@ static int filename__fprintf_build_id(const char *name, FILE *fp)
|
||||
|
||||
static bool dso__skip_buildid(struct dso *dso, int with_hits)
|
||||
{
|
||||
return with_hits && !dso->hit;
|
||||
return with_hits && !dso__hit(dso);
|
||||
}
|
||||
|
||||
static int perf_session__list_build_ids(bool force, bool with_hits)
|
||||
|
||||
@@ -445,10 +445,9 @@ static struct dso *findnew_dso(int pid, int tid, const char *filename,
|
||||
}
|
||||
|
||||
if (dso) {
|
||||
mutex_lock(&dso->lock);
|
||||
nsinfo__put(dso->nsinfo);
|
||||
dso->nsinfo = nsi;
|
||||
mutex_unlock(&dso->lock);
|
||||
mutex_lock(dso__lock(dso));
|
||||
dso__set_nsinfo(dso, nsi);
|
||||
mutex_unlock(dso__lock(dso));
|
||||
} else
|
||||
nsinfo__put(nsi);
|
||||
|
||||
@@ -466,8 +465,8 @@ static int perf_event__repipe_buildid_mmap(struct perf_tool *tool,
|
||||
dso = findnew_dso(event->mmap.pid, event->mmap.tid,
|
||||
event->mmap.filename, NULL, machine);
|
||||
|
||||
if (dso && !dso->hit) {
|
||||
dso->hit = 1;
|
||||
if (dso && !dso__hit(dso)) {
|
||||
dso__set_hit(dso);
|
||||
dso__inject_build_id(dso, tool, machine, sample->cpumode, 0);
|
||||
}
|
||||
dso__put(dso);
|
||||
@@ -492,7 +491,7 @@ static int perf_event__repipe_mmap2(struct perf_tool *tool,
|
||||
event->mmap2.filename, NULL, machine);
|
||||
if (dso) {
|
||||
/* mark it not to inject build-id */
|
||||
dso->hit = 1;
|
||||
dso__set_hit(dso);
|
||||
}
|
||||
dso__put(dso);
|
||||
}
|
||||
@@ -544,7 +543,7 @@ static int perf_event__repipe_buildid_mmap2(struct perf_tool *tool,
|
||||
event->mmap2.filename, NULL, machine);
|
||||
if (dso) {
|
||||
/* mark it not to inject build-id */
|
||||
dso->hit = 1;
|
||||
dso__set_hit(dso);
|
||||
}
|
||||
dso__put(dso);
|
||||
perf_event__repipe(tool, event, sample, machine);
|
||||
@@ -554,8 +553,8 @@ static int perf_event__repipe_buildid_mmap2(struct perf_tool *tool,
|
||||
dso = findnew_dso(event->mmap2.pid, event->mmap2.tid,
|
||||
event->mmap2.filename, &dso_id, machine);
|
||||
|
||||
if (dso && !dso->hit) {
|
||||
dso->hit = 1;
|
||||
if (dso && !dso__hit(dso)) {
|
||||
dso__set_hit(dso);
|
||||
dso__inject_build_id(dso, tool, machine, sample->cpumode,
|
||||
event->mmap2.flags);
|
||||
}
|
||||
@@ -631,24 +630,24 @@ static int dso__read_build_id(struct dso *dso)
|
||||
{
|
||||
struct nscookie nsc;
|
||||
|
||||
if (dso->has_build_id)
|
||||
if (dso__has_build_id(dso))
|
||||
return 0;
|
||||
|
||||
mutex_lock(&dso->lock);
|
||||
nsinfo__mountns_enter(dso->nsinfo, &nsc);
|
||||
if (filename__read_build_id(dso->long_name, &dso->bid) > 0)
|
||||
dso->has_build_id = true;
|
||||
else if (dso->nsinfo) {
|
||||
char *new_name = dso__filename_with_chroot(dso, dso->long_name);
|
||||
mutex_lock(dso__lock(dso));
|
||||
nsinfo__mountns_enter(dso__nsinfo(dso), &nsc);
|
||||
if (filename__read_build_id(dso__long_name(dso), dso__bid(dso)) > 0)
|
||||
dso__set_has_build_id(dso);
|
||||
else if (dso__nsinfo(dso)) {
|
||||
char *new_name = dso__filename_with_chroot(dso, dso__long_name(dso));
|
||||
|
||||
if (new_name && filename__read_build_id(new_name, &dso->bid) > 0)
|
||||
dso->has_build_id = true;
|
||||
if (new_name && filename__read_build_id(new_name, dso__bid(dso)) > 0)
|
||||
dso__set_has_build_id(dso);
|
||||
free(new_name);
|
||||
}
|
||||
nsinfo__mountns_exit(&nsc);
|
||||
mutex_unlock(&dso->lock);
|
||||
mutex_unlock(dso__lock(dso));
|
||||
|
||||
return dso->has_build_id ? 0 : -1;
|
||||
return dso__has_build_id(dso) ? 0 : -1;
|
||||
}
|
||||
|
||||
static struct strlist *perf_inject__parse_known_build_ids(
|
||||
@@ -700,14 +699,14 @@ static bool perf_inject__lookup_known_build_id(struct perf_inject *inject,
|
||||
dso_name = strchr(build_id, ' ');
|
||||
bid_len = dso_name - pos->s;
|
||||
dso_name = skip_spaces(dso_name);
|
||||
if (strcmp(dso->long_name, dso_name))
|
||||
if (strcmp(dso__long_name(dso), dso_name))
|
||||
continue;
|
||||
for (int ix = 0; 2 * ix + 1 < bid_len; ++ix) {
|
||||
dso->bid.data[ix] = (hex(build_id[2 * ix]) << 4 |
|
||||
hex(build_id[2 * ix + 1]));
|
||||
dso__bid(dso)->data[ix] = (hex(build_id[2 * ix]) << 4 |
|
||||
hex(build_id[2 * ix + 1]));
|
||||
}
|
||||
dso->bid.size = bid_len / 2;
|
||||
dso->has_build_id = 1;
|
||||
dso__bid(dso)->size = bid_len / 2;
|
||||
dso__set_has_build_id(dso);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -720,9 +719,9 @@ static int dso__inject_build_id(struct dso *dso, struct perf_tool *tool,
|
||||
tool);
|
||||
int err;
|
||||
|
||||
if (is_anon_memory(dso->long_name) || flags & MAP_HUGETLB)
|
||||
if (is_anon_memory(dso__long_name(dso)) || flags & MAP_HUGETLB)
|
||||
return 0;
|
||||
if (is_no_dso_memory(dso->long_name))
|
||||
if (is_no_dso_memory(dso__long_name(dso)))
|
||||
return 0;
|
||||
|
||||
if (inject->known_build_ids != NULL &&
|
||||
@@ -730,14 +729,14 @@ static int dso__inject_build_id(struct dso *dso, struct perf_tool *tool,
|
||||
return 1;
|
||||
|
||||
if (dso__read_build_id(dso) < 0) {
|
||||
pr_debug("no build_id found for %s\n", dso->long_name);
|
||||
pr_debug("no build_id found for %s\n", dso__long_name(dso));
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = perf_event__synthesize_build_id(tool, dso, cpumode,
|
||||
perf_event__repipe, machine);
|
||||
if (err) {
|
||||
pr_err("Can't synthesize build_id event for %s\n", dso->long_name);
|
||||
pr_err("Can't synthesize build_id event for %s\n", dso__long_name(dso));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -763,8 +762,8 @@ int perf_event__inject_buildid(struct perf_tool *tool, union perf_event *event,
|
||||
if (thread__find_map(thread, sample->cpumode, sample->ip, &al)) {
|
||||
struct dso *dso = map__dso(al.map);
|
||||
|
||||
if (!dso->hit) {
|
||||
dso->hit = 1;
|
||||
if (!dso__hit(dso)) {
|
||||
dso__set_hit(dso);
|
||||
dso__inject_build_id(dso, tool, machine,
|
||||
sample->cpumode, map__flags(al.map));
|
||||
}
|
||||
@@ -1146,8 +1145,8 @@ static bool dso__is_in_kernel_space(struct dso *dso)
|
||||
return false;
|
||||
|
||||
return dso__is_kcore(dso) ||
|
||||
dso->kernel ||
|
||||
is_kernel_module(dso->long_name, PERF_RECORD_MISC_CPUMODE_UNKNOWN);
|
||||
dso__kernel(dso) ||
|
||||
is_kernel_module(dso__long_name(dso), PERF_RECORD_MISC_CPUMODE_UNKNOWN);
|
||||
}
|
||||
|
||||
static u64 evlist__first_id(struct evlist *evlist)
|
||||
@@ -1181,7 +1180,7 @@ static int synthesize_build_id(struct perf_inject *inject, struct dso *dso, pid_
|
||||
if (!machine)
|
||||
return -ENOMEM;
|
||||
|
||||
dso->hit = 1;
|
||||
dso__set_hit(dso);
|
||||
|
||||
return perf_event__synthesize_build_id(&inject->tool, dso, cpumode,
|
||||
process_build_id, machine);
|
||||
@@ -1192,7 +1191,7 @@ static int guest_session__add_build_ids_cb(struct dso *dso, void *data)
|
||||
struct guest_session *gs = data;
|
||||
struct perf_inject *inject = container_of(gs, struct perf_inject, guest_session);
|
||||
|
||||
if (!dso->has_build_id)
|
||||
if (!dso__has_build_id(dso))
|
||||
return 0;
|
||||
|
||||
return synthesize_build_id(inject, dso, gs->machine_pid);
|
||||
|
||||
@@ -38,7 +38,7 @@ static int __cmd_kallsyms(int argc, const char **argv)
|
||||
|
||||
dso = map__dso(map);
|
||||
printf("%s: %s %s %#" PRIx64 "-%#" PRIx64 " (%#" PRIx64 "-%#" PRIx64")\n",
|
||||
symbol->name, dso->short_name, dso->long_name,
|
||||
symbol->name, dso__short_name(dso), dso__long_name(dso),
|
||||
map__unmap_ip(map, symbol->start), map__unmap_ip(map, symbol->end),
|
||||
symbol->start, symbol->end);
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ dump_raw_samples(struct perf_tool *tool,
|
||||
if (al.map != NULL) {
|
||||
dso = map__dso(al.map);
|
||||
if (dso)
|
||||
dso->hit = 1;
|
||||
dso__set_hit(dso);
|
||||
}
|
||||
|
||||
field_sep = symbol_conf.field_sep;
|
||||
@@ -255,7 +255,7 @@ dump_raw_samples(struct perf_tool *tool,
|
||||
symbol_conf.field_sep,
|
||||
sample->data_src,
|
||||
symbol_conf.field_sep,
|
||||
dso ? dso->long_name : "???",
|
||||
dso ? dso__long_name(dso) : "???",
|
||||
al.sym ? al.sym->name : "???");
|
||||
out_put:
|
||||
addr_location__exit(&al);
|
||||
|
||||
@@ -322,7 +322,7 @@ static int process_sample_event(struct perf_tool *tool,
|
||||
}
|
||||
|
||||
if (al.map != NULL)
|
||||
map__dso(al.map)->hit = 1;
|
||||
dso__set_hit(map__dso(al.map));
|
||||
|
||||
if (ui__has_annotation() || rep->symbol_ipc || rep->total_cycles_mode) {
|
||||
hist__account_cycles(sample->branch_stack, &al, sample,
|
||||
@@ -609,7 +609,7 @@ static void report__warn_kptr_restrict(const struct report *rep)
|
||||
return;
|
||||
|
||||
if (kernel_map == NULL ||
|
||||
(map__dso(kernel_map)->hit &&
|
||||
(dso__hit(map__dso(kernel_map)) &&
|
||||
(kernel_kmap->ref_reloc_sym == NULL ||
|
||||
kernel_kmap->ref_reloc_sym->addr == 0))) {
|
||||
const char *desc =
|
||||
@@ -850,7 +850,7 @@ static int maps__fprintf_task_cb(struct map *map, void *data)
|
||||
prot & PROT_EXEC ? 'x' : '-',
|
||||
map__flags(map) ? 's' : 'p',
|
||||
map__pgoff(map),
|
||||
dso->id.ino, dso->name);
|
||||
dso__id_const(dso)->ino, dso__name(dso));
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -1017,11 +1017,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) &&
|
||||
!map__dso(alf.map)->adjust_symbols)
|
||||
!dso__adjust_symbols(map__dso(alf.map)))
|
||||
from = map__dso_map_ip(alf.map, from);
|
||||
|
||||
if (thread__find_map_fb(thread, sample->cpumode, to, &alt) &&
|
||||
!map__dso(alt.map)->adjust_symbols)
|
||||
!dso__adjust_symbols(map__dso(alt.map)))
|
||||
to = map__dso_map_ip(alt.map, to);
|
||||
|
||||
printed += fprintf(fp, " 0x%"PRIx64, from);
|
||||
@@ -1082,7 +1082,7 @@ static int grab_bb(u8 *buffer, u64 start, u64 end,
|
||||
pr_debug("\tcannot resolve %" PRIx64 "-%" PRIx64 "\n", start, end);
|
||||
goto out;
|
||||
}
|
||||
if (dso->data.status == DSO_DATA_STATUS_ERROR) {
|
||||
if (dso__data(dso)->status == DSO_DATA_STATUS_ERROR) {
|
||||
pr_debug("\tcannot resolve %" PRIx64 "-%" PRIx64 "\n", start, end);
|
||||
goto out;
|
||||
}
|
||||
@@ -1094,7 +1094,7 @@ static int grab_bb(u8 *buffer, u64 start, u64 end,
|
||||
len = dso__data_read_offset(dso, machine, offset, (u8 *)buffer,
|
||||
end - start + MAXINSN);
|
||||
|
||||
*is64bit = dso->is_64_bit;
|
||||
*is64bit = dso__is_64_bit(dso);
|
||||
if (len <= 0)
|
||||
pr_debug("\tcannot fetch code for block at %" PRIx64 "-%" PRIx64 "\n",
|
||||
start, end);
|
||||
|
||||
@@ -129,7 +129,7 @@ static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he)
|
||||
/*
|
||||
* We can't annotate with just /proc/kallsyms
|
||||
*/
|
||||
if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS && !dso__is_kcore(dso)) {
|
||||
if (dso__symtab_type(dso) == 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);
|
||||
@@ -182,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, dso->long_name, dso__symtab_origin(dso),
|
||||
ip, dso__long_name(dso), dso__symtab_origin(dso),
|
||||
map__start(map), map__end(map), sym->start, sym->end,
|
||||
sym->binding == STB_GLOBAL ? 'g' :
|
||||
sym->binding == STB_LOCAL ? 'l' : 'w', sym->name,
|
||||
|
||||
@@ -2917,7 +2917,7 @@ static void print_location(FILE *f, struct perf_sample *sample,
|
||||
{
|
||||
|
||||
if ((verbose > 0 || print_dso) && al->map)
|
||||
fprintf(f, "%s@", map__dso(al->map)->long_name);
|
||||
fprintf(f, "%s@", dso__long_name(map__dso(al->map)));
|
||||
|
||||
if ((verbose > 0 || print_sym) && al->sym)
|
||||
fprintf(f, "%s+0x%" PRIx64, al->sym->name,
|
||||
|
||||
@@ -253,9 +253,9 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode,
|
||||
goto out;
|
||||
}
|
||||
dso = map__dso(al.map);
|
||||
pr_debug("File is: %s\n", dso->long_name);
|
||||
pr_debug("File is: %s\n", dso__long_name(dso));
|
||||
|
||||
if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS && !dso__is_kcore(dso)) {
|
||||
if (dso__symtab_type(dso) == DSO_BINARY_TYPE__KALLSYMS && !dso__is_kcore(dso)) {
|
||||
pr_debug("Unexpected kernel address - skipping\n");
|
||||
goto out;
|
||||
}
|
||||
@@ -274,7 +274,7 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode,
|
||||
* modules to manage long jumps. Check if the ip offset falls in stubs
|
||||
* sections for kernel modules. And skip module address after text end
|
||||
*/
|
||||
if (dso->is_kmod && al.addr > dso->text_end) {
|
||||
if (dso__is_kmod(dso) && al.addr > dso__text_end(dso)) {
|
||||
pr_debug("skipping the module address %#"PRIx64" after text end\n", al.addr);
|
||||
goto out;
|
||||
}
|
||||
@@ -315,7 +315,7 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode,
|
||||
state->done[state->done_cnt++] = map__start(al.map);
|
||||
}
|
||||
|
||||
objdump_name = dso->long_name;
|
||||
objdump_name = dso__long_name(dso);
|
||||
if (dso__needs_decompress(dso)) {
|
||||
if (dso__decompress_kmodule_path(dso, objdump_name,
|
||||
decomp_name,
|
||||
|
||||
@@ -228,7 +228,8 @@ static void dsos__delete(int cnt)
|
||||
for (i = 0; i < cnt; i++) {
|
||||
struct dso *dso = dsos[i];
|
||||
|
||||
unlink(dso->name);
|
||||
dso__data_close(dso);
|
||||
unlink(dso__name(dso));
|
||||
dso__put(dso);
|
||||
}
|
||||
|
||||
@@ -289,14 +290,14 @@ static int test__dso_data_cache(struct test_suite *test __maybe_unused, int subt
|
||||
}
|
||||
|
||||
/* verify the first one is already open */
|
||||
TEST_ASSERT_VAL("dsos[0] is not open", dsos[0]->data.fd != -1);
|
||||
TEST_ASSERT_VAL("dsos[0] is not open", dso__data(dsos[0])->fd != -1);
|
||||
|
||||
/* open +1 dso to reach the allowed limit */
|
||||
fd = dso__data_fd(dsos[i], &machine);
|
||||
TEST_ASSERT_VAL("failed to get fd", fd > 0);
|
||||
|
||||
/* should force the first one to be closed */
|
||||
TEST_ASSERT_VAL("failed to close dsos[0]", dsos[0]->data.fd == -1);
|
||||
TEST_ASSERT_VAL("failed to close dsos[0]", dso__data(dsos[0])->fd == -1);
|
||||
|
||||
/* cleanup everything */
|
||||
dsos__delete(dso_cnt);
|
||||
@@ -371,7 +372,7 @@ static int test__dso_data_reopen(struct test_suite *test __maybe_unused, int sub
|
||||
* dso_0 should get closed, because we reached
|
||||
* the file descriptor limit
|
||||
*/
|
||||
TEST_ASSERT_VAL("failed to close dso_0", dso_0->data.fd == -1);
|
||||
TEST_ASSERT_VAL("failed to close dso_0", dso__data(dso_0)->fd == -1);
|
||||
|
||||
/* open dso_0 */
|
||||
fd = dso__data_fd(dso_0, &machine);
|
||||
@@ -381,7 +382,7 @@ static int test__dso_data_reopen(struct test_suite *test __maybe_unused, int sub
|
||||
* dso_1 should get closed, because we reached
|
||||
* the file descriptor limit
|
||||
*/
|
||||
TEST_ASSERT_VAL("failed to close dso_1", dso_1->data.fd == -1);
|
||||
TEST_ASSERT_VAL("failed to close dso_1", dso__data(dso_1)->fd == -1);
|
||||
|
||||
/* cleanup everything */
|
||||
close(fd_extra);
|
||||
|
||||
@@ -146,7 +146,7 @@ struct machine *setup_fake_machine(struct machines *machines)
|
||||
goto out;
|
||||
}
|
||||
|
||||
symbols__insert(&dso->symbols, sym);
|
||||
symbols__insert(dso__symbols(dso), sym);
|
||||
}
|
||||
|
||||
dso__put(dso);
|
||||
@@ -183,7 +183,7 @@ void print_hists_in(struct hists *hists)
|
||||
|
||||
pr_info("%2d: entry: %-8s [%-8s] %20s: period = %"PRIu64"\n",
|
||||
i, thread__comm_str(he->thread),
|
||||
dso->short_name,
|
||||
dso__short_name(dso),
|
||||
he->ms.sym->name, he->stat.period);
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ void print_hists_out(struct hists *hists)
|
||||
|
||||
pr_info("%2d: entry: %8s:%5d [%-8s] %20s: period = %"PRIu64"/%"PRIu64"\n",
|
||||
i, thread__comm_str(he->thread), thread__tid(he->thread),
|
||||
dso->short_name,
|
||||
dso__short_name(dso),
|
||||
he->ms.sym->name, he->stat.period,
|
||||
he->stat_acc ? he->stat_acc->period : 0);
|
||||
}
|
||||
|
||||
@@ -164,11 +164,11 @@ static void put_fake_samples(void)
|
||||
typedef int (*test_fn_t)(struct evsel *, struct machine *);
|
||||
|
||||
#define COMM(he) (thread__comm_str(he->thread))
|
||||
#define DSO(he) (map__dso(he->ms.map)->short_name)
|
||||
#define DSO(he) (dso__short_name(map__dso(he->ms.map)))
|
||||
#define SYM(he) (he->ms.sym->name)
|
||||
#define CPU(he) (he->cpu)
|
||||
#define DEPTH(he) (he->callchain->max_depth)
|
||||
#define CDSO(cl) (map__dso(cl->ms.map)->short_name)
|
||||
#define CDSO(cl) (dso__short_name(map__dso(cl->ms.map)))
|
||||
#define CSYM(cl) (cl->ms.sym->name)
|
||||
|
||||
struct result {
|
||||
|
||||
@@ -129,7 +129,7 @@ static void put_fake_samples(void)
|
||||
typedef int (*test_fn_t)(struct evsel *, struct machine *);
|
||||
|
||||
#define COMM(he) (thread__comm_str(he->thread))
|
||||
#define DSO(he) (map__dso(he->ms.map)->short_name)
|
||||
#define DSO(he) (dso__short_name(map__dso(he->ms.map)))
|
||||
#define SYM(he) (he->ms.sym->name)
|
||||
#define CPU(he) (he->cpu)
|
||||
#define PID(he) (thread__tid(he->thread))
|
||||
|
||||
@@ -26,7 +26,7 @@ static int check_maps_cb(struct map *map, void *data)
|
||||
|
||||
if (map__start(map) != merged->start ||
|
||||
map__end(map) != merged->end ||
|
||||
strcmp(map__dso(map)->name, merged->name) ||
|
||||
strcmp(dso__name(map__dso(map)), merged->name) ||
|
||||
refcount_read(map__refcnt(map)) != 1) {
|
||||
return 1;
|
||||
}
|
||||
@@ -39,7 +39,7 @@ static int failed_cb(struct map *map, void *data __maybe_unused)
|
||||
pr_debug("\tstart: %" PRIu64 " end: %" PRIu64 " name: '%s' refcnt: %d\n",
|
||||
map__start(map),
|
||||
map__end(map),
|
||||
map__dso(map)->name,
|
||||
dso__name(map__dso(map)),
|
||||
refcount_read(map__refcnt(map)));
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -81,7 +81,7 @@ static int create_map(struct test_info *ti, char *filename, struct map **map_p)
|
||||
* If 'filename' matches a current kernel module, must use a kernel
|
||||
* map. Find the one that already exists.
|
||||
*/
|
||||
if (dso && dso->kernel) {
|
||||
if (dso && dso__kernel(dso) != DSO_SPACE__USER) {
|
||||
*map_p = find_module_map(ti->machine, dso);
|
||||
dso__put(dso);
|
||||
if (!*map_p) {
|
||||
@@ -116,7 +116,7 @@ static int test_dso(struct dso *dso)
|
||||
if (verbose > 1)
|
||||
dso__fprintf(dso, stderr);
|
||||
|
||||
for (nd = rb_first_cached(&dso->symbols); nd; nd = rb_next(nd)) {
|
||||
for (nd = rb_first_cached(dso__symbols(dso)); nd; nd = rb_next(nd)) {
|
||||
struct symbol *sym = rb_entry(nd, struct symbol, rb_node);
|
||||
|
||||
if (sym->type != STT_FUNC && sym->type != STT_GNU_IFUNC)
|
||||
@@ -145,7 +145,7 @@ static int subdivided_dso_cb(struct dso *dso, struct machine *machine __maybe_un
|
||||
{
|
||||
struct dso *text_dso = d;
|
||||
|
||||
if (dso != text_dso && strstarts(dso->short_name, text_dso->short_name))
|
||||
if (dso != text_dso && strstarts(dso__short_name(dso), dso__short_name(text_dso)))
|
||||
if (test_dso(dso) != TEST_OK)
|
||||
return -1;
|
||||
|
||||
@@ -190,7 +190,7 @@ static int test_file(struct test_info *ti, char *filename)
|
||||
ret = test_dso(dso);
|
||||
|
||||
/* Module dso is split into many dsos by section */
|
||||
if (ret == TEST_OK && dso->kernel)
|
||||
if (ret == TEST_OK && dso__kernel(dso) != DSO_SPACE__USER)
|
||||
ret = process_subdivided_dso(ti->machine, dso);
|
||||
out_put:
|
||||
map__put(map);
|
||||
|
||||
@@ -129,7 +129,7 @@ static int test__vmlinux_matches_kallsyms_cb1(struct map *map, void *data)
|
||||
* cases.
|
||||
*/
|
||||
struct map *pair = maps__find_by_name(args->kallsyms.kmaps,
|
||||
(dso->kernel ? dso->short_name : dso->name));
|
||||
(dso__kernel(dso) ? dso__short_name(dso) : dso__name(dso)));
|
||||
|
||||
if (pair) {
|
||||
map__set_priv(pair, 1);
|
||||
@@ -162,11 +162,11 @@ static int test__vmlinux_matches_kallsyms_cb2(struct map *map, void *data)
|
||||
}
|
||||
|
||||
pr_info("WARN: %" PRIx64 "-%" PRIx64 " %" PRIx64 " %s in kallsyms as",
|
||||
map__start(map), map__end(map), map__pgoff(map), dso->name);
|
||||
map__start(map), map__end(map), map__pgoff(map), dso__name(dso));
|
||||
if (mem_end != map__end(pair))
|
||||
pr_info(":\nWARN: *%" PRIx64 "-%" PRIx64 " %" PRIx64,
|
||||
map__start(pair), map__end(pair), map__pgoff(pair));
|
||||
pr_info(" %s\n", dso->name);
|
||||
pr_info(" %s\n", dso__name(dso));
|
||||
map__set_priv(pair, 1);
|
||||
}
|
||||
map__put(pair);
|
||||
|
||||
@@ -438,7 +438,7 @@ static int sym_title(struct symbol *sym, struct map *map, char *title,
|
||||
size_t sz, int percent_type)
|
||||
{
|
||||
return snprintf(title, sz, "%s %s [Percent: %s]", sym->name,
|
||||
map__dso(map)->long_name,
|
||||
dso__long_name(map__dso(map)),
|
||||
percent_type_str(percent_type));
|
||||
}
|
||||
|
||||
@@ -967,14 +967,14 @@ int symbol__tui_annotate(struct map_symbol *ms, struct evsel *evsel,
|
||||
return -1;
|
||||
|
||||
dso = map__dso(ms->map);
|
||||
if (dso->annotate_warned)
|
||||
if (dso__annotate_warned(dso))
|
||||
return -1;
|
||||
|
||||
if (not_annotated || !sym->annotate2) {
|
||||
err = symbol__annotate2(ms, evsel, &browser.arch);
|
||||
if (err) {
|
||||
char msg[BUFSIZ];
|
||||
dso->annotate_warned = true;
|
||||
dso__set_annotate_warned(dso);
|
||||
symbol__strerror_disassemble(ms, err, msg, sizeof(msg));
|
||||
ui__error("Couldn't annotate %s:\n%s", sym->name, msg);
|
||||
return -1;
|
||||
|
||||
@@ -2489,7 +2489,7 @@ add_annotate_opt(struct hist_browser *browser __maybe_unused,
|
||||
{
|
||||
struct dso *dso;
|
||||
|
||||
if (!ms->map || (dso = map__dso(ms->map)) == NULL || dso->annotate_warned)
|
||||
if (!ms->map || (dso = map__dso(ms->map)) == NULL || dso__annotate_warned(dso))
|
||||
return 0;
|
||||
|
||||
if (!ms->sym)
|
||||
@@ -2608,7 +2608,7 @@ static int hists_browser__zoom_map(struct hist_browser *browser, struct map *map
|
||||
} else {
|
||||
struct dso *dso = map__dso(map);
|
||||
ui_helpline__fpush("To zoom out press ESC or ENTER + \"Zoom out of %s DSO\"",
|
||||
__map__is_kernel(map) ? "the Kernel" : dso->short_name);
|
||||
__map__is_kernel(map) ? "the Kernel" : dso__short_name(dso));
|
||||
browser->hists->dso_filter = dso;
|
||||
perf_hpp__set_elide(HISTC_DSO, true);
|
||||
pstack__push(browser->pstack, &browser->hists->dso_filter);
|
||||
@@ -2634,7 +2634,7 @@ add_dso_opt(struct hist_browser *browser, struct popup_action *act,
|
||||
|
||||
if (asprintf(optstr, "Zoom %s %s DSO (use the 'k' hotkey to zoom directly into the kernel)",
|
||||
browser->hists->dso_filter ? "out of" : "into",
|
||||
__map__is_kernel(map) ? "the Kernel" : map__dso(map)->short_name) < 0)
|
||||
__map__is_kernel(map) ? "the Kernel" : dso__short_name(map__dso(map))) < 0)
|
||||
return 0;
|
||||
|
||||
act->ms.map = map;
|
||||
@@ -3110,7 +3110,7 @@ do_hotkey: // key came straight from options ui__popup_menu()
|
||||
if (!browser->selection ||
|
||||
!browser->selection->map ||
|
||||
!map__dso(browser->selection->map) ||
|
||||
map__dso(browser->selection->map)->annotate_warned) {
|
||||
dso__annotate_warned(map__dso(browser->selection->map))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user