perf annotate-data: Handle direct global variable access
authorNamhyung Kim <namhyung@kernel.org>
Thu, 2 May 2024 06:00:08 +0000 (23:00 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 2 May 2024 13:51:23 +0000 (10:51 -0300)
commit4449c9047dc6f9f68333a720958cd7b58225910d
treeef14c53e565143208e3cd0ffe56b36fe57dbb47e
parentc1da8411e4be2a96a448979baede9a0e86c5baf8
perf annotate-data: Handle direct global variable access

Like per-cpu base offset array, sometimes it accesses the global
variable directly using the offset.  Allow this type of instructions as
long as it finds a global variable for the address.

  movslq  %edi, %rcx
  mov     -0x7dc94ae0(,%rcx,8), %rcx   <<<--- here

As %rcx has a valid type (i.e. array index) from the first instruction,
it will be checked by the first case in check_matching_type().  But as
it's not a pointer type, the match will fail.  But in this case, it
should check if it accesses the kernel global array variable.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240502060011.1838090-4-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/annotate-data.c