• Namhyung Kim's avatar
    perf annotate-data: Handle RSP if it's not the FB register · a5a00497
    Namhyung Kim authored
    In some cases, the stack pointer on x86 (rsp = reg7) is used to point
    variables on stack but it's not the frame base register.  Then it
    should handle the register like normal registers (IOW not to access
    the other stack variables using offset calculation) but it should not
    assume it would have a pointer.
    
    Before:
      -----------------------------------------------------------
      find data type for 0x7c(reg7) at tcp_getsockopt+0xb62
      CU for net/ipv4/tcp.c (die:0x7b5f516)
      frame base: cfa=0 fbreg=6
      no pointer or no type
      check variable "zc" failed (die: 0x7b9580a)
       variable location: base=reg7, offset=0x40
       type='struct tcp_zerocopy_receive' size=0x40 (die:0x7b947f4)
    
    After:
      -----------------------------------------------------------
      find data type for 0x7c(reg7) at tcp_getsockopt+0xb62
      CU for net/ipv4/tcp.c (die:0x7b5f516)
      frame base: cfa=0 fbreg=6
      found "zc" in scope=3/3 (die: 0x7b957fc) type_offset=0x3c
       variable location: base=reg7, offset=0x40
       type='struct tcp_zerocopy_receive' size=0x40 (die:0x7b947f4)
    
    Note that the type-offset was properly calculated to 0x3c as the
    variable starts at 0x40.
    Signed-off-by: default avatarNamhyung 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/20240412183310.2518474-5-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    a5a00497
annotate-data.c 48.7 KB