OSDN Git Service

perf evlist: Fix id index for heterogeneous systems
authorAdrian Hunter <adrian.hunter@intel.com>
Thu, 21 Jan 2021 12:54:46 +0000 (14:54 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 21 Jan 2021 20:25:33 +0000 (17:25 -0300)
commitfc705fecf3a0c9128933cc6db59159c050aaca33
tree5790047008dbd4fbf844dcbadfcd4e6c67a6707d
parent9f29bd8b2e7132b409178d1367dae1813017bd0e
perf evlist: Fix id index for heterogeneous systems

perf_evlist__set_sid_idx() updates perf_sample_id with the evlist map
index, CPU number and TID. It is passed indexes to the evsel's cpu and
thread maps, but references the evlist's maps instead. That results in
using incorrect CPU numbers on heterogeneous systems. Fix it by using
evsel maps.

The id index (PERF_RECORD_ID_INDEX) is used by AUX area tracing when in
sampling mode. Having an incorrect CPU number causes the trace data to
be attributed to the wrong CPU, and can result in decoder errors because
the trace data is then associated with the wrong process.

Committer notes:

Keep the class prefix convention in the function name, switching from
perf_evlist__set_sid_idx() to perf_evsel__set_sid_idx().

Fixes: 3c659eedada2fbf9 ("perf tools: Add id index")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lore.kernel.org/lkml/20210121125446.11287-1-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/lib/perf/evlist.c