• Masami Hiramatsu's avatar
    perf probe: Fix to show inlined function callsite without entry_pc · 18e21eb6
    Masami Hiramatsu authored
    Fix 'perf probe --line' option to show inlined function callsite lines
    even if the function DIE has only ranges.
    
    Without this:
    
      # perf probe -L amd_put_event_constraints
      ...
          2  {
          3         if (amd_has_nb(cpuc) && amd_is_nb_event(&event->hw))
                            __amd_put_nb_event_constraints(cpuc, event);
          5  }
    
    With this patch:
    
      # perf probe -L amd_put_event_constraints
      ...
          2  {
          3         if (amd_has_nb(cpuc) && amd_is_nb_event(&event->hw))
          4                 __amd_put_nb_event_constraints(cpuc, event);
          5  }
    
    Committer testing:
    
    Before:
    
      [root@quaco ~]# perf probe -L amd_put_event_constraints
      <amd_put_event_constraints@/usr/src/debug/kernel-5.2.fc30/linux-5.2.18-200.fc30.x86_64/arch/x86/events/amd/core.c:0>
            0  static void amd_put_event_constraints(struct cpu_hw_events *cpuc,
                                                    struct perf_event *event)
            2  {
            3         if (amd_has_nb(cpuc) && amd_is_nb_event(&event->hw))
                              __amd_put_nb_event_constraints(cpuc, event);
            5  }
    
               PMU_FORMAT_ATTR(event, "config:0-7,32-35");
               PMU_FORMAT_ATTR(umask, "config:8-15"   );
    
      [root@quaco ~]#
    
    After:
    
      [root@quaco ~]# perf probe -L amd_put_event_constraints
      <amd_put_event_constraints@/usr/src/debug/kernel-5.2.fc30/linux-5.2.18-200.fc30.x86_64/arch/x86/events/amd/core.c:0>
            0  static void amd_put_event_constraints(struct cpu_hw_events *cpuc,
                                                    struct perf_event *event)
            2  {
            3         if (amd_has_nb(cpuc) && amd_is_nb_event(&event->hw))
            4                 __amd_put_nb_event_constraints(cpuc, event);
            5  }
    
               PMU_FORMAT_ATTR(event, "config:0-7,32-35");
               PMU_FORMAT_ATTR(umask, "config:8-15"   );
    
      [root@quaco ~]# perf probe amd_put_event_constraints:4
      Added new event:
        probe:amd_put_event_constraints (on amd_put_event_constraints:4)
    
      You can now use it in all perf tools, such as:
    
      	perf record -e probe:amd_put_event_constraints -aR sleep 1
    
      [root@quaco ~]#
    
      [root@quaco ~]# perf probe -l
        probe:amd_put_event_constraints (on amd_put_event_constraints:4@arch/x86/events/amd/core.c)
        probe:clear_tasks_mm_cpumask (on clear_tasks_mm_cpumask@kernel/cpu.c)
      [root@quaco ~]#
    
    Using it:
    
      [root@quaco ~]# perf trace -e probe:*
      ^C[root@quaco ~]#
    
    Ok, Intel system here... :-)
    
    Fixes: 4cc9cec6 ("perf probe: Introduce lines walker interface")
    Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Link: http://lore.kernel.org/lkml/157199322107.8075.12659099000567865708.stgit@devnote2Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    18e21eb6
dwarf-aux.c 33.2 KB