[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210122161854.5289-2-alexandre.truong@arm.com>
Date: Fri, 22 Jan 2021 16:18:52 +0000
From: Alexandre Truong <alexandre.truong@....com>
To: linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org
Cc: Alexandre Truong <alexandre.truong@....com>,
John Garry <john.garry@...wei.com>,
Will Deacon <will@...nel.org>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Leo Yan <leo.yan@...aro.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Kemeng Shi <shikemeng@...wei.com>,
Ian Rogers <irogers@...gle.com>,
Andi Kleen <ak@...ux.intel.com>,
Kan Liang <kan.liang@...ux.intel.com>,
Jin Yao <yao.jin@...ux.intel.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Suzuki K Poulose <suzuki.poulose@....com>,
Al Grant <al.grant@....com>, James Clark <james.clark@....com>,
Wilco Dijkstra <wilco.dijkstra@....com>
Subject: [PATCH 2/4] perf tools: add a mechanism to inject stack frames
Add a mechanism for platforms to inject stack frames for the leaf
frame caller if there is enough information to determine a frame
is missing from dwarf or other post processing mechanisms.
Signed-off-by: Alexandre Truong <alexandre.truong@....com>
Cc: John Garry <john.garry@...wei.com>
Cc: Will Deacon <will@...nel.org>
Cc: Mathieu Poirier <mathieu.poirier@...aro.org>
Cc: Leo Yan <leo.yan@...aro.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Mark Rutland <mark.rutland@....com>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Kemeng Shi <shikemeng@...wei.com>
Cc: Ian Rogers <irogers@...gle.com>
Cc: Andi Kleen <ak@...ux.intel.com>
Cc: Kan Liang <kan.liang@...ux.intel.com>
Cc: Jin Yao <yao.jin@...ux.intel.com>
Cc: Adrian Hunter <adrian.hunter@...el.com>
Cc: Suzuki K Poulose <suzuki.poulose@....com>
Cc: Al Grant <al.grant@....com>
Cc: James Clark <james.clark@....com>
Cc: Wilco Dijkstra <wilco.dijkstra@....com>
---
tools/perf/util/machine.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 522ea3236bcc..40082d70eec1 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -2671,6 +2671,12 @@ static int find_prev_cpumode(struct ip_callchain *chain, struct thread *thread,
return err;
}
+static u64 get_leaf_frame_caller(struct perf_sample *sample __maybe_unused,
+ struct thread *thread __maybe_unused)
+{
+ return 0;
+}
+
static int thread__resolve_callchain_sample(struct thread *thread,
struct callchain_cursor *cursor,
struct evsel *evsel,
@@ -2687,6 +2693,8 @@ static int thread__resolve_callchain_sample(struct thread *thread,
int i, j, err, nr_entries;
int skip_idx = -1;
int first_call = 0;
+ u64 leaf_frame_caller;
+ int pos;
if (chain)
chain_nr = chain->nr;
@@ -2811,6 +2819,21 @@ static int thread__resolve_callchain_sample(struct thread *thread,
continue;
}
+ pos = callchain_param.order == ORDER_CALLEE ? 2 : chain_nr - 2;
+
+ if (i == pos) {
+ leaf_frame_caller = get_leaf_frame_caller(sample, thread);
+
+ if (leaf_frame_caller && leaf_frame_caller != ip) {
+
+ err = add_callchain_ip(thread, cursor, parent,
+ root_al, &cpumode, leaf_frame_caller,
+ false, NULL, NULL, 0);
+ if (err)
+ return (err < 0) ? err : 0;
+ }
+ }
+
err = add_callchain_ip(thread, cursor, parent,
root_al, &cpumode, ip,
false, NULL, NULL, 0);
--
2.23.0
Powered by blists - more mailing lists