[PATCH v4 03/28] perf cs-etm: Fix address sanitizer dso build failure

From: Ian Rogers
Date: Thu Jul 11 2024 - 14:01:07 EST


cs-etm.c had been missed from having accessor functions added for the
sake of reference count checking. Add the function calls and missing
dso accessor functions.

Fixes: ee756ef7491e ("perf dso: Add reference count checking and accessor functions")
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/perf/util/cs-etm.c | 10 +++++-----
tools/perf/util/dso.h | 10 ++++++++++
2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index c53812f343e9..7fd976ea954b 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -1013,7 +1013,7 @@ static u32 cs_etm__mem_access(struct cs_etm_queue *etmq, u8 trace_chan_id,
if (!dso)
goto out;

- if (dso->data.status == DSO_DATA_STATUS_ERROR &&
+ if (dso__data(dso)->status == DSO_DATA_STATUS_ERROR &&
dso__data_status_seen(dso, DSO_DATA_STATUS_SEEN_ITRACE))
goto out;

@@ -1027,11 +1027,11 @@ static u32 cs_etm__mem_access(struct cs_etm_queue *etmq, u8 trace_chan_id,
if (len <= 0) {
ui__warning_once("CS ETM Trace: Missing DSO. Use 'perf archive' or debuginfod to export data from the traced system.\n"
" Enable CONFIG_PROC_KCORE or use option '-k /path/to/vmlinux' for kernel symbols.\n");
- if (!dso->auxtrace_warned) {
+ if (!dso__auxtrace_warned(dso)) {
pr_err("CS ETM Trace: Debug data not found for address %#"PRIx64" in %s\n",
- address,
- dso->long_name ? dso->long_name : "Unknown");
- dso->auxtrace_warned = true;
+ address,
+ dso__long_name(dso) ? dso__long_name(dso) : "Unknown");
+ dso__set_auxtrace_warned(dso);
}
goto out;
}
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
index d72f3b8c37f6..878c1f441868 100644
--- a/tools/perf/util/dso.h
+++ b/tools/perf/util/dso.h
@@ -280,6 +280,16 @@ static inline void dso__set_annotate_warned(struct dso *dso)
RC_CHK_ACCESS(dso)->annotate_warned = 1;
}

+static inline bool dso__auxtrace_warned(const struct dso *dso)
+{
+ return RC_CHK_ACCESS(dso)->auxtrace_warned;
+}
+
+static inline void dso__set_auxtrace_warned(struct dso *dso)
+{
+ RC_CHK_ACCESS(dso)->auxtrace_warned = 1;
+}
+
static inline struct auxtrace_cache *dso__auxtrace_cache(struct dso *dso)
{
return RC_CHK_ACCESS(dso)->auxtrace_cache;
--
2.45.2.993.g49e7a77208-goog