linux/tools
Namhyung Kim b7d4aacfc8 perf annotate-data: Check kind of stack variables
I sometimes see ("unknown type") in the result and it was because it
didn't check the type of stack variables properly during the instruction
tracking.  The stack can carry constant values (without type info) and
if the target instruction is accessing the stack location, it resulted
in the "unknown type".

Maybe we could pick one of integer types for the constant, but it
doesn't really mean anything useful.  Let's just drop the stack slot if
it doesn't have a valid type info.

Here's an example how it got the unknown type.
Note that 0xffffff48 = -0xb8.
  -----------------------------------------------------------
  find data type for 0xffffff48(reg6) at ...
  CU for ...
  frame base: cfa=0 fbreg=6
  scope: [2/2] (die:11cb97f)
  bb: [37 - 3a]
  var [37] reg15 type='int' size=0x4 (die:0x1180633)
  bb: [40 - 4b]
  mov [40] imm=0x1 -> reg13
  var [45] reg8 type='sigset_t*' size=0x8 (die:0x11a39ee)
  mov [45] imm=0x1 -> reg2                     <---  here reg2 has a constant
  bb: [215 - 237]
  mov [218] reg2 -> -0xb8(stack) constant      <---  and save it to the stack
  mov [225] reg13 -> -0xc4(stack) constant
  call [22f] find_task_by_vgpid
  call [22f] return -> reg0 type='struct task_struct*' size=0x8 (die:0x11881e8)
  bb: [5c8 - 5cf]
  bb: [2fb - 302]
  mov [2fb] -0xc4(stack) -> reg13 constant
  bb: [13b - 14d]
  mov [143] 0xd50(reg3) -> reg5 type='struct task_struct*' size=0x8 (die:0xa31f3c)
  bb: [153 - 153]
  chk [153] reg6 offset=0xffffff48 ok=0 kind=0 fbreg    <--- access here
  found by insn track: 0xffffff48(reg6) type-offset=0
   type='G<EF>^K<F6><AF>U' size=0 (die:0xffffffffffffffff)

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-7-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2024-05-02 11:06:23 -03:00
..
accounting
arch tools headers x86 cpufeatures: Sync with the kernel sources to pick BHI mitigation changes 2024-04-26 22:13:10 -03:00
bootconfig
bpf libbpf, selftests/bpf: Adjust libbpf, bpftool, selftests to match LLVM 2024-03-15 14:24:00 -07:00
build perf: build: introduce the libcapstone 2024-02-20 18:06:25 -08:00
certs
cgroup
counter
crypto crypto: ccp - Update return values for some unit tests 2024-02-24 08:41:20 +08:00
debugging
firewire
firmware
gpio
hv hv/hv_kvp_daemon: Handle IPv4 and Ipv6 combination for keyfile format 2024-04-10 21:25:40 +00:00
iio
include tools headers: Synchronize linux/bits.h with the kernel sources 2024-04-26 22:13:10 -03:00
kvm/kvm_stat
laptop
leds
lib perf record: Fix comment misspellings 2024-04-26 22:13:10 -03:00
memory-model
mm tools/mm: add thpmaps script to dump THP usage info 2024-02-22 10:24:38 -08:00
net/ynl tools: ynl: fix setting presence bits in simple nests 2024-03-22 17:54:38 -07:00
objtool objtool: Fix compile failure when using the x32 compiler 2024-03-30 22:12:37 +01:00
pci
pcmcia
perf perf annotate-data: Check kind of stack variables 2024-05-02 11:06:23 -03:00
power Turbostat version 2024.04.10 2024-04-10 13:13:27 -07:00
rcu
scripts treewide: remove meaningless assignments in Makefiles 2024-02-23 14:19:07 -08:00
spi
testing * Clean up SVM's enter/exit assembly code so that it can be compiled 2024-04-20 11:10:51 -07:00
thermal
time
tracing tools/rtla: Add -U/--user-load option to timerlat 2024-03-20 05:39:06 +01:00
usb
verification tools/verification: Use tools/build makefiles on rv 2024-03-20 05:39:06 +01:00
virtio tools: virtio: introduce vhost_net_test 2024-03-05 11:38:14 +01:00
wmi
workqueue workqueue: Implement BH workqueues to eventually replace tasklets 2024-02-04 11:28:06 -10:00
Makefile tools/Makefile: remove cgroup target 2024-03-26 11:07:21 -07:00