mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-15 14:32:06 +00: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
@@ -393,10 +393,10 @@ static const char *get_dsoname(struct map *map)
|
||||
struct dso *dso = map ? map__dso(map) : NULL;
|
||||
|
||||
if (dso) {
|
||||
if (symbol_conf.show_kernel_path && dso->long_name)
|
||||
dsoname = dso->long_name;
|
||||
if (symbol_conf.show_kernel_path && dso__long_name(dso))
|
||||
dsoname = dso__long_name(dso);
|
||||
else
|
||||
dsoname = dso->name;
|
||||
dsoname = dso__name(dso);
|
||||
}
|
||||
|
||||
return dsoname;
|
||||
@@ -799,8 +799,9 @@ static void set_sym_in_dict(PyObject *dict, struct addr_location *al,
|
||||
if (al->map) {
|
||||
struct dso *dso = map__dso(al->map);
|
||||
|
||||
pydict_set_item_string_decref(dict, dso_field, _PyUnicode_FromString(dso->name));
|
||||
build_id__sprintf(&dso->bid, sbuild_id);
|
||||
pydict_set_item_string_decref(dict, dso_field,
|
||||
_PyUnicode_FromString(dso__name(dso)));
|
||||
build_id__sprintf(dso__bid(dso), sbuild_id);
|
||||
pydict_set_item_string_decref(dict, dso_bid_field,
|
||||
_PyUnicode_FromString(sbuild_id));
|
||||
pydict_set_item_string_decref(dict, dso_map_start,
|
||||
@@ -1246,14 +1247,14 @@ static int python_export_dso(struct db_export *dbe, struct dso *dso,
|
||||
char sbuild_id[SBUILD_ID_SIZE];
|
||||
PyObject *t;
|
||||
|
||||
build_id__sprintf(&dso->bid, sbuild_id);
|
||||
build_id__sprintf(dso__bid(dso), sbuild_id);
|
||||
|
||||
t = tuple_new(5);
|
||||
|
||||
tuple_set_d64(t, 0, dso->db_id);
|
||||
tuple_set_d64(t, 0, dso__db_id(dso));
|
||||
tuple_set_d64(t, 1, machine->db_id);
|
||||
tuple_set_string(t, 2, dso->short_name);
|
||||
tuple_set_string(t, 3, dso->long_name);
|
||||
tuple_set_string(t, 2, dso__short_name(dso));
|
||||
tuple_set_string(t, 3, dso__long_name(dso));
|
||||
tuple_set_string(t, 4, sbuild_id);
|
||||
|
||||
call_object(tables->dso_handler, t, "dso_table");
|
||||
@@ -1273,7 +1274,7 @@ static int python_export_symbol(struct db_export *dbe, struct symbol *sym,
|
||||
t = tuple_new(6);
|
||||
|
||||
tuple_set_d64(t, 0, *sym_db_id);
|
||||
tuple_set_d64(t, 1, dso->db_id);
|
||||
tuple_set_d64(t, 1, dso__db_id(dso));
|
||||
tuple_set_d64(t, 2, sym->start);
|
||||
tuple_set_d64(t, 3, sym->end);
|
||||
tuple_set_s32(t, 4, sym->binding);
|
||||
|
||||
Reference in New Issue
Block a user