perf cs-etm: Use previous thread for branch sample source IP
authorJames Clark <james.clark@arm.com>
Mon, 12 Jun 2023 11:13:59 +0000 (12:13 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 12 Jun 2023 21:18:13 +0000 (18:18 -0300)
commitd67d8c87d0e3c808e6c716ab59f981f7d0ec2cbd
tree793a49e9e4500e1d3338b015c4fbcf56d8a42951
parent951ccccdc7153120673fdc398878d629dcb7adf6
perf cs-etm: Use previous thread for branch sample source IP

Branch samples currently use the IP of the previous packet as the from
IP, and the IP of the current packet as the to IP. But it incorrectly
uses the current thread. In some cases like a jump into a different
exception level this will attribute to the incorrect process.

Fix it by tracking the previous thread in the same way the previous
packet is tracked.

Committer notes:

Resolved conflicts with:

  perf addr_location: Add init/exit/copy functions
  perf thread: Add accessor functions for thread

Reviewed-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: James Clark <james.clark@arm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lore.kernel.org/lkml/20230612111403.100613-3-james.clark@arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/cs-etm.c