1. 25 Jun, 2020 37 commits
  2. 22 Jun, 2020 3 commits
    • Greg Kroah-Hartman's avatar
      Linux 4.19.129 · b3a99fd3
      Greg Kroah-Hartman authored
      b3a99fd3
    • Adrian Hunter's avatar
      perf symbols: Fix debuginfo search for Ubuntu · 7e8c391e
      Adrian Hunter authored
      commit 85afd355 upstream.
      
      Reportedly, from 19.10 Ubuntu has begun mixing up the location of some
      debug symbol files, putting files expected to be in
      /usr/lib/debug/usr/lib into /usr/lib/debug/lib instead. Fix by adding
      another dso_binary_type.
      
      Example on Ubuntu 20.04
      
        Before:
      
          $ perf record -e intel_pt//u uname
          Linux
          [ perf record: Woken up 1 times to write data ]
          [ perf record: Captured and wrote 0.030 MB perf.data ]
          $ perf script --call-trace | head -5
                 uname 14003 [005] 15321.764958566:  cbr: 42 freq: 4219 MHz (156%)
                 uname 14003 [005] 15321.764958566: (/usr/lib/x86_64-linux-gnu/ld-2.31.so              )          7f1e71cc4100
                 uname 14003 [005] 15321.764961566: (/usr/lib/x86_64-linux-gnu/ld-2.31.so              )              7f1e71cc4df0
                 uname 14003 [005] 15321.764961900: (/usr/lib/x86_64-linux-gnu/ld-2.31.so              )              7f1e71cc4e18
                 uname 14003 [005] 15321.764963233: (/usr/lib/x86_64-linux-gnu/ld-2.31.so              )              7f1e71cc5128
      
        After:
      
          $ perf script --call-trace | head -5
                 uname 14003 [005] 15321.764958566:  cbr: 42 freq: 4219 MHz (156%)
                 uname 14003 [005] 15321.764958566: (/usr/lib/x86_64-linux-gnu/ld-2.31.so              )      _start
                 uname 14003 [005] 15321.764961566: (/usr/lib/x86_64-linux-gnu/ld-2.31.so              )          _dl_start
                 uname 14003 [005] 15321.764961900: (/usr/lib/x86_64-linux-gnu/ld-2.31.so              )          _dl_start
                 uname 14003 [005] 15321.764963233: (/usr/lib/x86_64-linux-gnu/ld-2.31.so              )          _dl_start
      Reported-by: default avatarTravis Downs <travis.downs@gmail.com>
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: stable@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20200526155207.9172-1-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7e8c391e
    • Masami Hiramatsu's avatar
      perf probe: Check address correctness by map instead of _etext · c7006692
      Masami Hiramatsu authored
      commit 2ae5d0d7 upstream.
      
      Since commit 03db8b58 ("perf tools: Fix
      maps__find_symbol_by_name()") introduced map address range check in
      maps__find_symbol_by_name(), we can not get "_etext" from kernel map
      because _etext is placed on the edge of the kernel .text section (=
      kernel map in perf.)
      
      To fix this issue, this checks the address correctness by map address
      range information (map->start and map->end) instead of using _etext
      address.
      
      This can cause an error if the target inlined function is embedded in
      both __init function and normal function.
      
      For exaample, request_resource() is a normal function but also embedded
      in __init reserve_setup(). In this case, the probe point in
      reserve_setup() must be skipped.
      
      However, without this fix, it failes to setup all probe points:
      
        # ./perf probe -v request_resource
        probe-definition(0): request_resource
        symbol:request_resource file:(null) line:0 offset:0 return:0 lazy:(null)
        0 arguments
        Looking at the vmlinux_path (8 entries long)
        Using /usr/lib/debug/lib/modules/5.5.17-200.fc31.x86_64/vmlinux for symbols
        Open Debuginfo file: /usr/lib/debug/lib/modules/5.5.17-200.fc31.x86_64/vmlinux
        Try to find probe point from debuginfo.
        Matched function: request_resource [15e29ad]
        found inline addr: 0xffffffff82fbf892
        Probe point found: reserve_setup+204
        found inline addr: 0xffffffff810e9790
        Probe point found: request_resource+0
        Found 2 probe_trace_events.
        Opening /sys/kernel/debug/tracing//kprobe_events write=1
        Opening /sys/kernel/debug/tracing//README write=0
        Writing event: p:probe/request_resource _text+33290386
        Failed to write event: Invalid argument
          Error: Failed to add events. Reason: Invalid argument (Code: -22)
        #
      
      With this fix,
      
        # ./perf probe request_resource
        reserve_setup is out of .text, skip it.
        Added new events:
          (null):(null)        (on request_resource)
          probe:request_resource (on request_resource)
      
        You can now use it in all perf tools, such as:
      
        	perf record -e probe:request_resource -aR sleep 1
      
        #
      
      Fixes: 03db8b58 ("perf tools: Fix maps__find_symbol_by_name()")
      Reported-by: default avatarArnaldo Carvalho de Melo <acme@kernel.org>
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: stable@vger.kernel.org
      Link: http://lore.kernel.org/lkml/158763967332.30755.4922496724365529088.stgit@devnote2Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c7006692