diff options
author | Ian Rogers <irogers@google.com> | 2024-05-05 00:38:01 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2024-05-06 21:28:49 +0300 |
commit | ee756ef7491eafd70f390343a1d90930af125a51 (patch) | |
tree | ac5e5aa5fed83cbc7db80a77e67b2045b14122de /tools/perf/util/annotate-data.c | |
parent | 7a9418cf7f05a74cbc9d4c750ee1bfddaa11f121 (diff) | |
download | linux-ee756ef7491eafd70f390343a1d90930af125a51.tar.xz |
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>
Diffstat (limited to 'tools/perf/util/annotate-data.c')
-rw-r--r-- | tools/perf/util/annotate-data.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/perf/util/annotate-data.c b/tools/perf/util/annotate-data.c index 2c98813f95cd..faefa444af1e 100644 --- a/tools/perf/util/annotate-data.c +++ b/tools/perf/util/annotate-data.c @@ -336,7 +336,7 @@ static struct annotated_data_type *dso__findnew_data_type(struct dso *dso, /* Check existing nodes in dso->data_types tree */ key.self.type_name = type_name; key.self.size = size; - node = rb_find(&key, &dso->data_types, data_type_cmp); + node = rb_find(&key, dso__data_types(dso), data_type_cmp); if (node) { result = rb_entry(node, struct annotated_data_type, node); free(type_name); @@ -357,7 +357,7 @@ static struct annotated_data_type *dso__findnew_data_type(struct dso *dso, if (symbol_conf.annotate_data_member) add_member_types(result, type_die); - rb_add(&result->node, &dso->data_types, data_type_less); + rb_add(&result->node, dso__data_types(dso), data_type_less); return result; } @@ -538,7 +538,7 @@ static struct global_var_entry *global_var__find(struct data_loc_info *dloc, u64 struct dso *dso = map__dso(dloc->ms->map); struct rb_node *node; - node = rb_find((void *)(uintptr_t)addr, &dso->global_vars, global_var_cmp); + node = rb_find((void *)(uintptr_t)addr, dso__global_vars(dso), global_var_cmp); if (node == NULL) return NULL; @@ -569,7 +569,7 @@ static bool global_var__add(struct data_loc_info *dloc, u64 addr, gvar->end = addr + size; gvar->die_offset = dwarf_dieoffset(type_die); - rb_add(&gvar->node, &dso->global_vars, global_var_less); + rb_add(&gvar->node, dso__global_vars(dso), global_var_less); return true; } @@ -672,7 +672,7 @@ static bool get_global_var_type(Dwarf_Die *cu_die, struct data_loc_info *dloc, struct dso *dso = map__dso(dloc->ms->map); Dwarf_Die var_die; - if (RB_EMPTY_ROOT(&dso->global_vars)) + if (RB_EMPTY_ROOT(dso__global_vars(dso))) global_var__collect(dloc); gvar = global_var__find(dloc, var_addr); @@ -889,7 +889,7 @@ static void update_insn_state_x86(struct type_state *state, return; tsr = &state->regs[dst->reg1]; - if (map__dso(dloc->ms->map)->kernel && + if (dso__kernel(map__dso(dloc->ms->map)) && src->segment == INSN_SEG_X86_GS && src->imm) { u64 ip = dloc->ms->sym->start + dl->al.offset; u64 var_addr; @@ -1415,7 +1415,7 @@ static int check_matching_type(struct type_state *state, } check_kernel: - if (map__dso(dloc->ms->map)->kernel) { + if (dso__kernel(map__dso(dloc->ms->map))) { u64 addr; int offset; @@ -1767,7 +1767,7 @@ struct annotated_data_type *find_data_type(struct data_loc_info *dloc) struct dso *dso = map__dso(dloc->ms->map); Dwarf_Die type_die; - dloc->di = debuginfo__new(dso->long_name); + dloc->di = debuginfo__new(dso__long_name(dso)); if (dloc->di == NULL) { pr_debug_dtp("cannot get the debug info\n"); return NULL; @@ -1901,7 +1901,7 @@ static void print_annotated_data_header(struct hist_entry *he, struct evsel *evs } printf("Annotate type: '%s' in %s (%d samples):\n", - he->mem_type->self.type_name, dso->name, nr_samples); + he->mem_type->self.type_name, dso__name(dso), nr_samples); if (evsel__is_group_event(evsel)) { struct evsel *pos; |