1. 18 10月, 2018 3 次提交
    • D
      perf annotate: Add Sparc support · 0ab41886
      David Miller 提交于
      E.g.:
      
        $ perf annotate --stdio2
        Samples: 7K of event 'cycles:ppp', 4000 Hz, Event count (approx.): 3086733887
        __gettimeofday  /lib32/libc-2.27.so [Percent: local period]
        Percent│
               │
               │
               │    Disassembly of section .text:
               │
               │    000a6fa0 <__gettimeofday@@GLIBC_2.0>:
          0.47 │      save   %sp, -96, %sp
          0.73 │      sethi  %hi(0xe9000), %l7
               │    → call   __frame_state_for@@GLIBC_2.0+0x480
          0.30 │      add    %l7, 0x58, %l7     ! e9058 <nftw64@@GLIBC_2.3.3+0x818>
          1.33 │      mov    %i0, %o0
               │      mov    %i1, %o1
          0.43 │      mov    0x74, %g1
               │      ta     0x10
         88.92 │    ↓ bcc    30
          2.95 │      clr    %g1
               │      neg    %o0
               │      mov    1, %g1
          0.31 │30:   cmp    %g1, 0
               │      bne,pn %icc, a6fe4 <__gettimeofday@@GLIBC_2.0+0x44>
               │      mov    %o0, %i0
          1.96 │    ← return %i7 + 8
          2.62 │      nop
               │      sethi  %hi(0), %g1
               │      neg    %o0, %g2
               │      add    %g1, 0x160, %g1
               │      ld     [ %l7 + %g1 ], %g1
               │      st     %g2, [ %g7 + %g1 ]
               │    ← return %i7 + 8
               │      mov    -1, %o0
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Link: http://lkml.kernel.org/r/20181016.205555.1070918198627611771.davem@davemloft.netSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0ab41886
    • A
      perf record: Encode -k clockid frequency into Perf trace · cf790516
      Alexey Budankov 提交于
      Store -k clockid frequency into Perf trace to enable timestamps
      derived metrics conversion into wall clock time on reporting stage.
      
      Below is the example of perf report output:
      
        tools/perf/perf record -k raw -- ../../matrix/linux/matrix.gcc
        ...
        [ perf record: Captured and wrote 31.222 MB perf.data (818054 samples) ]
      
        tools/perf/perf report --header
        # ========
        ...
        # event : name = cycles:ppp, , size = 112, { sample_period, sample_freq } = 4000, sample_type = IP|TID|TIME|PERIOD, disabled = 1, inherit = 1, mmap = 1, comm = 1, freq = 1, enable_on_exec = 1, task = 1, precise_ip = 3, sample_id_all = 1, exclude_guest = 1, mmap2 = 1, comm_exec = 1, use_clockid = 1, clockid = 4
        ...
        # clockid frequency: 1000 MHz
        ...
        # ========
      Signed-off-by: NAlexey Budankov <alexey.budankov@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/23a4a1dc-b160-85a0-347d-40a2ed6d007b@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      cf790516
    • A
      perf tools: Stop fallbacking to kallsyms for vdso symbols lookup · edeb0c90
      Arnaldo Carvalho de Melo 提交于
      David reports that:
      
      <quote>
      Perf has this hack where it uses the kernel symbol map as a backup when
      a symbol can't be found in the user's symbol table(s).
      
      This causes problems because the tests driving this code path use
      machine__kernel_ip(), and that is completely meaningless on Sparc.  On
      sparc64 the kernel and user live in physically separate virtual address
      spaces, rather than a shared one.  And the kernel lives at a virtual
      address that overlaps common userspace addresses.  So this test passes
      almost all the time when a user symbol lookup fails.
      
      The consequence of this is that, if the unfound user virtual address in
      the sample doesn't match up to a kernel symbol either, we trigger things
      like this code in builtin-top.c:
      
      	if (al.sym == NULL && al.map != NULL) {
      		const char *msg = "Kernel samples will not be resolved.\n";
      		/*
      		 * As we do lazy loading of symtabs we only will know if the
      		 * specified vmlinux file is invalid when we actually have a
      		 * hit in kernel space and then try to load it. So if we get
      		 * here and there are _no_ symbols in the DSO backing the
      		 * kernel map, bail out.
      		 *
      		 * We may never get here, for instance, if we use -K/
      		 * --hide-kernel-symbols, even if the user specifies an
      		 * invalid --vmlinux ;-)
      		 */
      		if (!machine->kptr_restrict_warned && !top->vmlinux_warned &&
      		    __map__is_kernel(al.map) && map__has_symbols(al.map)) {
      			if (symbol_conf.vmlinux_name) {
      				char serr[256];
      				dso__strerror_load(al.map->dso, serr, sizeof(serr));
      				ui__warning("The %s file can't be used: %s\n%s",
      					    symbol_conf.vmlinux_name, serr, msg);
      			} else {
      				ui__warning("A vmlinux file was not found.\n%s",
      					    msg);
      			}
      
      			if (use_browser <= 0)
      				sleep(5);
      			top->vmlinux_warned = true;
      		}
      	}
      
      When I fire up a compilation on sparc, this triggers immediately.
      
      I'm trying to figure out what the "backup to kernel map" code is
      accomplishing.
      
      I see some language in the current code and in the changes that have
      happened in this area talking about vdso.  Does that really happen?
      
      The vdso is mapped into userspace virtual addresses, not kernel ones.
      
      More history.  This didn't cause problems on sparc some time ago,
      because the kernel IP check used to be "ip < 0" :-) Sparc kernel
      addresses are not negative.  But now with machine__kernel_ip(), which
      works using the symbol table determined kernel address range, it does
      trigger.
      
      What it all boils down to is that on architectures like sparc,
      machine__kernel_ip() should always return false in this scenerio, and
      therefore this kind of logic:
      
      		if (cpumode == PERF_RECORD_MISC_USER && machine &&
      		    mg != &machine->kmaps &&
      		    machine__kernel_ip(machine, al->addr)) {
      
      is basically invalid.  PERF_RECORD_MISC_USER implies no kernel address
      can possibly match for the sample/event in question (no matter how
      hard you try!) :-)
      </>
      
      So, I thought something had changed and in the past we would somehow
      find that address in the kallsyms, but I couldn't find anything to back
      that up, the patch introducing this is over a decade old, lots of things
      changed, so I was just thinking I was missing something.
      
      I tried a gtod busy loop to generate vdso activity and added a 'perf
      probe' at that branch, on x86_64 to see if it ever gets hit:
      
      Made thread__find_map() noinline, as 'perf probe' in lines of inline
      functions seems to not be working, only at function start. (Masami?)
      
        # perf probe -x ~/bin/perf -L thread__find_map:57
        <thread__find_map@/home/acme/git/perf/tools/perf/util/event.c:57>
           57                 if (cpumode == PERF_RECORD_MISC_USER && machine &&
           58                     mg != &machine->kmaps &&
           59                     machine__kernel_ip(machine, al->addr)) {
           60                         mg = &machine->kmaps;
           61                         load_map = true;
           62                         goto try_again;
                              }
                      } else {
                              /*
                               * Kernel maps might be changed when loading
                               * symbols so loading
                               * must be done prior to using kernel maps.
                               */
           69                 if (load_map)
           70                         map__load(al->map);
           71                 al->addr = al->map->map_ip(al->map, al->addr);
      
        # perf probe -x ~/bin/perf thread__find_map:60
        Added new event:
          probe_perf:thread__find_map (on thread__find_map:60 in /home/acme/bin/perf)
      
        You can now use it in all perf tools, such as:
      
      	perf record -e probe_perf:thread__find_map -aR sleep 1
      
        #
      
        Then used this to see if, system wide, those probe points were being hit:
      
        # perf trace -e *perf:thread*/max-stack=8/
        ^C[root@jouet ~]#
      
        No hits when running 'perf top' and:
      
        # cat gtod.c
        #include <sys/time.h>
      
        int main(void)
        {
      	struct timeval tv;
      
      	while (1)
      		gettimeofday(&tv, 0);
      
      	return 0;
        }
        [root@jouet c]# ./gtod
        ^C
      
        Pressed 'P' in 'perf top' and the [vdso] samples are there:
      
        62.84%  [vdso]                    [.] __vdso_gettimeofday
         8.13%  gtod                      [.] main
         7.51%  [vdso]                    [.] 0x0000000000000914
         5.78%  [vdso]                    [.] 0x0000000000000917
         5.43%  gtod                      [.] _init
         2.71%  [vdso]                    [.] 0x000000000000092d
         0.35%  [kernel]                  [k] native_io_delay
         0.33%  libc-2.26.so              [.] __memmove_avx_unaligned_erms
         0.20%  [vdso]                    [.] 0x000000000000091d
         0.17%  [i2c_i801]                [k] i801_access
         0.06%  firefox                   [.] free
         0.06%  libglib-2.0.so.0.5400.3   [.] g_source_iter_next
         0.05%  [vdso]                    [.] 0x0000000000000919
         0.05%  libpthread-2.26.so        [.] __pthread_mutex_lock
         0.05%  libpixman-1.so.0.34.0     [.] 0x000000000006d3a7
         0.04%  [kernel]                  [k] entry_SYSCALL_64_trampoline
         0.04%  libxul.so                 [.] style::dom_apis::query_selector_slow
         0.04%  [kernel]                  [k] module_get_kallsym
         0.04%  firefox                   [.] malloc
         0.04%  [vdso]                    [.] 0x0000000000000910
      
        I added a 'perf probe' to thread__find_map:69, and that surely got tons
        of hits, i.e. for every map found, just to make sure the 'perf probe'
        command was really working.
      
        In the process I noticed a bug, we're only have records for '[vdso]' for
        pre-existing commands, i.e. ones that are running when we start 'perf top',
        when we will generate the PERF_RECORD_MMAP by looking at /perf/PID/maps.
      
        I.e. like this, for preexisting processes with a vdso map, again,
        tracing for all the system, only pre-existing processes get a [vdso] map
        (when having one):
      
        [root@jouet ~]# perf probe -x ~/bin/perf __machine__addnew_vdso
        Added new event:
        probe_perf:__machine__addnew_vdso (on __machine__addnew_vdso in /home/acme/bin/perf)
      
        You can now use it in all perf tools, such as:
      
      	perf record -e probe_perf:__machine__addnew_vdso -aR sleep 1
      
        [root@jouet ~]# perf trace -e probe_perf:__machine__addnew_vdso/max-stack=8/
           0.000 probe_perf:__machine__addnew_vdso:(568eb3)
                                             __machine__addnew_vdso (/home/acme/bin/perf)
                                             map__new (/home/acme/bin/perf)
                                             machine__process_mmap2_event (/home/acme/bin/perf)
                                             machine__process_event (/home/acme/bin/perf)
                                             perf_event__process (/home/acme/bin/perf)
                                             perf_tool__process_synth_event (/home/acme/bin/perf)
                                             perf_event__synthesize_mmap_events (/home/acme/bin/perf)
                                             __event__synthesize_thread (/home/acme/bin/perf)
      
      The kernel is generating a PERF_RECORD_MMAP for vDSOs, but somehow
      'perf top' is not getting those records while 'perf record' is:
      
        # perf record ~acme/c/gtod
        ^C[ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.076 MB perf.data (1499 samples) ]
      
        # perf report -D | grep PERF_RECORD_MMAP2
        71293612401913 0x11b48 [0x70]: PERF_RECORD_MMAP2 25484/25484: [0x400000(0x1000) @ 0 fd:02 1137 541179306]: r-xp /home/acme/c/gtod
        71293612419012 0x11be0 [0x70]: PERF_RECORD_MMAP2 25484/25484: [0x7fa4a2783000(0x227000) @ 0 fd:00 3146370 854107250]: r-xp /usr/lib64/ld-2.26.so
        71293612432110 0x11c50 [0x60]: PERF_RECORD_MMAP2 25484/25484: [0x7ffcdb53a000(0x2000) @ 0 00:00 0 0]: r-xp [vdso]
        71293612509944 0x11cb0 [0x70]: PERF_RECORD_MMAP2 25484/25484: [0x7fa4a23cd000(0x3b6000) @ 0 fd:00 3149723 262067164]: r-xp /usr/lib64/libc-2.26.so
        #
        # perf script | grep vdso | head
            gtod 25484 71293.612768: 2485554 cycles:ppp:  7ffcdb53a914 [unknown] ([vdso])
            gtod 25484 71293.613576: 2149343 cycles:ppp:  7ffcdb53a917 [unknown] ([vdso])
            gtod 25484 71293.614274: 1814652 cycles:ppp:  7ffcdb53aca8 __vdso_gettimeofday+0x98 ([vdso])
            gtod 25484 71293.614862: 1669070 cycles:ppp:  7ffcdb53acc5 __vdso_gettimeofday+0xb5 ([vdso])
            gtod 25484 71293.615404: 1451589 cycles:ppp:  7ffcdb53acc5 __vdso_gettimeofday+0xb5 ([vdso])
            gtod 25484 71293.615999: 1269941 cycles:ppp:  7ffcdb53ace6 __vdso_gettimeofday+0xd6 ([vdso])
            gtod 25484 71293.616405: 1177946 cycles:ppp:  7ffcdb53a914 [unknown] ([vdso])
            gtod 25484 71293.616775: 1121290 cycles:ppp:  7ffcdb53ac47 __vdso_gettimeofday+0x37 ([vdso])
            gtod 25484 71293.617150: 1037721 cycles:ppp:  7ffcdb53ace6 __vdso_gettimeofday+0xd6 ([vdso])
            gtod 25484 71293.617478:  994526 cycles:ppp:  7ffcdb53ace6 __vdso_gettimeofday+0xd6 ([vdso])
        #
      
      The patch is the obvious one and with it we also continue to resolve
      vdso symbols for pre-existing processes in 'perf top' and for all
      processes in 'perf record' + 'perf report/script'.
      Suggested-by: NDavid Miller <davem@davemloft.net>
      Acked-by: NDavid Miller <davem@davemloft.net>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-cs7skq9pp0kjypiju6o7trse@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      edeb0c90
  2. 17 10月, 2018 2 次提交
    • J
      perf tools: Pass build flags to traceevent build · 298faf53
      Jiri Olsa 提交于
      So the extra user build flags are propagated to libtraceevent.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: "Herton R. Krzesinski" <herton@redhat.com>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
      Cc: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
      Link: http://lkml.kernel.org/r/20181016150614.21260-3-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      298faf53
    • M
      perf report: Don't crash on invalid inline debug information · d4046e8e
      Milian Wolff 提交于
      When the function name for an inline frame is invalid, we must not try
      to demangle this symbol, otherwise we crash with:
      
        #0  0x0000555555895c01 in bfd_demangle ()
        #1  0x0000555555823262 in demangle_sym (dso=0x555555d92b90, elf_name=0x0, kmodule=0) at util/symbol-elf.c:215
        #2  dso__demangle_sym (dso=dso@entry=0x555555d92b90, kmodule=<optimized out>, kmodule@entry=0, elf_name=elf_name@entry=0x0) at util/symbol-elf.c:400
        #3  0x00005555557fef4b in new_inline_sym (funcname=0x0, base_sym=0x555555d92b90, dso=0x555555d92b90) at util/srcline.c:89
        #4  inline_list__append_dso_a2l (dso=dso@entry=0x555555c7bb00, node=node@entry=0x555555e31810, sym=sym@entry=0x555555d92b90) at util/srcline.c:264
        #5  0x00005555557ff27f in addr2line (dso_name=dso_name@entry=0x555555d92430 "/home/milian/.debug/.build-id/f7/186d14bb94f3c6161c010926da66033d24fce5/elf", addr=addr@entry=2888, file=file@entry=0x0,
            line=line@entry=0x0, dso=dso@entry=0x555555c7bb00, unwind_inlines=unwind_inlines@entry=true, node=0x555555e31810, sym=0x555555d92b90) at util/srcline.c:313
        #6  0x00005555557ffe7c in addr2inlines (sym=0x555555d92b90, dso=0x555555c7bb00, addr=2888, dso_name=0x555555d92430 "/home/milian/.debug/.build-id/f7/186d14bb94f3c6161c010926da66033d24fce5/elf")
            at util/srcline.c:358
      
      So instead handle the case where we get invalid function names for
      inlined frames and use a fallback '??' function name instead.
      
      While this crash was originally reported by Hadrien for rust code, I can
      now also reproduce it with trivial C++ code. Indeed, it seems like
      libbfd fails to interpret the debug information for the inline frame
      symbol name:
      
        $ addr2line -e /home/milian/.debug/.build-id/f7/186d14bb94f3c6161c010926da66033d24fce5/elf -if b48
        main
        /usr/include/c++/8.2.1/complex:610
        ??
        /usr/include/c++/8.2.1/complex:618
        ??
        /usr/include/c++/8.2.1/complex:675
        ??
        /usr/include/c++/8.2.1/complex:685
        main
        /home/milian/projects/kdab/rnd/hotspot/tests/test-clients/cpp-inlining/main.cpp:39
      
      I've reported this bug upstream and also attached a patch there which
      should fix this issue:
      
      https://sourceware.org/bugzilla/show_bug.cgi?id=23715Reported-by: NHadrien Grasland <grasland@lal.in2p3.fr>
      Signed-off-by: NMilian Wolff <milian.wolff@kdab.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Fixes: a64489c5 ("perf report: Find the inline stack for a given address")
      [ The above 'Fixes:' cset is where originally the problem was
        introduced, i.e.  using a2l->funcname without checking if it is NULL,
        but this current patch fixes the current codebase, i.e. multiple csets
        were applied after a64489c5 before the problem was reported by Hadrien ]
      Link: http://lkml.kernel.org/r/20180926135207.30263-3-milian.wolff@kdab.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d4046e8e
  3. 16 10月, 2018 4 次提交
  4. 12 10月, 2018 2 次提交
  5. 11 10月, 2018 1 次提交
    • J
      perf vendor events intel: Fix wrong filter_band* values for uncore events · 94aafb74
      Jiri Olsa 提交于
      Michael reported that he could not stat following event:
      
        $ perf stat -e unc_p_freq_ge_1200mhz_cycles -a -- ls
        event syntax error: '..e_1200mhz_cycles'
                                          \___ value too big for format, maximum is 255
        Run 'perf list' for a list of valid events
      
      The event is unwrapped into:
      
        uncore_pcu/event=0xb,filter_band0=1200/
      
      where filter_band0 format says it's one byte only:
      
        # cat uncore_pcu/format/filter_band0
        config1:0-7
      
      while JSON files specifies bigger number:
      
        "Filter": "filter_band0=1200",
      
      all the filter_band* formats show 1 byte width:
      
        # cat uncore_pcu/format/filter_band1
        config1:8-15
        # cat uncore_pcu/format/filter_band2
        config1:16-23
        # cat uncore_pcu/format/filter_band3
        config1:24-31
      
      The reason of the issue is that filter_band* values are supposed to be
      in 100Mhz units.. it's stated in the JSON help for the events, like:
      
        filter_band3=XXX, with XXX in 100Mhz units
      
      This patch divides the filter_band* values by 100, plus there's couple
      of changes that actually change the number completely, like:
      
        -        "Filter": "edge=1,filter_band2=4000",
        +        "Filter": "edge=1,filter_band2=30",
      Reported-by: NMichael Petlan <mpetlan@redhat.com>
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Acked-by: NAndi Kleen <ak@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20181010080339.GB15790@kravaSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      94aafb74
  6. 09 10月, 2018 13 次提交
  7. 08 10月, 2018 2 次提交
    • A
      tools headers uapi: Sync kvm.h copy · 25fe15e5
      Arnaldo Carvalho de Melo 提交于
      To pick up the changes introduced in:
      
        6fbbde9a ("KVM: x86: Control guest reads of MSR_PLATFORM_INFO")
      
      That is not yet used in tools such as 'perf trace'.
      
      The type of the change in this file, a simple integer parameter to the
      KVM_CHECK_EXTENSION ioctl should be easier to implement tho, adding to
      the libbeauty TODO list.
      
      This silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
        diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Drew Schmitt <dasch@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-67h1bio5bihi1q6dy7hgwwx8@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      25fe15e5
    • A
      tools arch uapi: Sync the x86 kvm.h copy · 4312f2ab
      Arnaldo Carvalho de Melo 提交于
      To get the changes in:
      
        d1766202 ("x86/kvm/lapic: always disable MMIO interface in x2APIC mode")
      
      That at this time will not generate changes in tools such as 'perf trace',
      that still needs more work in tools/perf/examples/bpf/augmented_syscalls.c
      to need such id -> string tables.
      
      This silences the following perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/kvm.h' differs from latest version at 'arch/x86/include/uapi/asm/kvm.h'
        diff -u tools/arch/x86/include/uapi/asm/kvm.h arch/x86/include/uapi/asm/kvm.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-yadntj2ok6zpzjwi656onuh0@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4312f2ab
  8. 05 10月, 2018 2 次提交
    • M
      perf record: Use unmapped IP for inline callchain cursors · 7a8a8fcf
      Milian Wolff 提交于
      Only use the mapped IP to find inline frames, but keep using the
      unmapped IP for the callchain cursor. This ensures we properly show the
      unmapped IP when displaying a frame we received via the
      dso__parse_addr_inlines API for a module which does not contain
      sufficient debug symbols to show the srcline.
      
      This is another follow-up to commit 19610184 ("perf script: Show
      virtual addresses instead of offsets").
      Signed-off-by: NMilian Wolff <milian.wolff@kdab.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NRavi Bangoria <ravi.bangoria@linux.ibm.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Sandipan Das <sandipan@linux.ibm.com>
      Fixes: 19610184 ("perf script: Show virtual addresses instead of offsets")
      Link: http://lkml.kernel.org/r/20180926135207.30263-2-milian.wolff@kdab.com
      Link: http://lkml.kernel.org/r/20181002073949.3297-1-milian.wolff@kdab.com
      [ Squashed a fix from Milian for a problem reported by Ravi, fixed up space damage ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7a8a8fcf
    • A
      perf python: Use -Wno-redundant-decls to build with PYTHON=python3 · 05a2f546
      Arnaldo Carvalho de Melo 提交于
      When building in ClearLinux using 'make PYTHON=python3' with gcc 8.2.1
      it fails with:
      
          GEN      /tmp/build/perf/python/perf.so
        In file included from /usr/include/python3.7m/Python.h:126,
                         from /git/linux/tools/perf/util/python.c:2:
        /usr/include/python3.7m/import.h:58:24: error: redundant redeclaration of ‘_PyImport_AddModuleObject’ [-Werror=redundant-decls]
         PyAPI_FUNC(PyObject *) _PyImport_AddModuleObject(PyObject *, PyObject *);
                                ^~~~~~~~~~~~~~~~~~~~~~~~~
        /usr/include/python3.7m/import.h:47:24: note: previous declaration of ‘_PyImport_AddModuleObject’ was here
         PyAPI_FUNC(PyObject *) _PyImport_AddModuleObject(PyObject *name,
                                ^~~~~~~~~~~~~~~~~~~~~~~~~
        cc1: all warnings being treated as errors
        error: command 'gcc' failed with exit status 1
      
      And indeed there is a redundant declaration in that Python.h file, one
      with parameter names and the other without, so just add
      -Wno-error=redundant-decls to the python setup instructions.
      
      Now perf builds with gcc in ClearLinux with the following Dockerfile:
      
        # docker.io/acmel/linux-perf-tools-build-clearlinux:latest
        FROM docker.io/clearlinux:latest
        MAINTAINER Arnaldo Carvalho de Melo <acme@kernel.org>
        RUN swupd update && \
            swupd bundle-add sysadmin-basic-dev
        RUN mkdir -m 777 -p /git /tmp/build/perf /tmp/build/objtool /tmp/build/linux && \
            groupadd -r perfbuilder && \
            useradd -m -r -g perfbuilder perfbuilder && \
            chown -R perfbuilder.perfbuilder /tmp/build/ /git/
        USER perfbuilder
        COPY rx_and_build.sh /
        ENV EXTRA_MAKE_ARGS=PYTHON=python3
        ENTRYPOINT ["/rx_and_build.sh"]
      
      Now to figure out why the build fails with clang, that is present in the
      above container as detected by the rx_and_build.sh script:
      
        clang version 6.0.1 (tags/RELEASE_601/final)
        Target: x86_64-unknown-linux-gnu
        Thread model: posix
        InstalledDir: /usr/sbin
        make: Entering directory '/git/linux/tools/perf'
          BUILD:   Doing 'make -j4' parallel build
          HOSTCC   /tmp/build/perf/fixdep.o
          HOSTLD   /tmp/build/perf/fixdep-in.o
          LINK     /tmp/build/perf/fixdep
      
        Auto-detecting system features:
        ...                         dwarf: [ OFF ]
        ...            dwarf_getlocations: [ OFF ]
        ...                         glibc: [ OFF ]
        ...                          gtk2: [ OFF ]
        ...                      libaudit: [ OFF ]
        ...                        libbfd: [ OFF ]
        ...                        libelf: [ OFF ]
        ...                       libnuma: [ OFF ]
        ...        numa_num_possible_cpus: [ OFF ]
        ...                       libperl: [ OFF ]
        ...                     libpython: [ OFF ]
        ...                      libslang: [ OFF ]
        ...                     libcrypto: [ OFF ]
        ...                     libunwind: [ OFF ]
        ...            libdw-dwarf-unwind: [ OFF ]
        ...                          zlib: [ OFF ]
        ...                          lzma: [ OFF ]
        ...                     get_cpuid: [ OFF ]
        ...                           bpf: [ OFF ]
      
        Makefile.config:331: *** No gnu/libc-version.h found, please install glibc-dev[el].  Stop.
        make[1]: *** [Makefile.perf:206: sub-make] Error 2
        make: *** [Makefile:70: all] Error 2
        make: Leaving directory '/git/linux/tools/perf'
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Thiago Macieira <thiago.macieira@intel.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-c3khb9ac86s00qxzjrueomme@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      05a2f546
  9. 04 10月, 2018 1 次提交
  10. 02 10月, 2018 2 次提交
  11. 01 10月, 2018 1 次提交
  12. 30 9月, 2018 1 次提交
  13. 28 9月, 2018 3 次提交
    • M
      selftests/powerpc: Fix Makefiles for headers_install change · 7e0cf1c9
      Michael Ellerman 提交于
      Commit b2d35fa5 ("selftests: add headers_install to lib.mk")
      introduced a requirement that Makefiles more than one level below the
      selftests directory need to define top_srcdir, but it didn't update
      any of the powerpc Makefiles.
      
      This broke building all the powerpc selftests with eg:
      
        make[1]: Entering directory '/src/linux/tools/testing/selftests/powerpc'
        BUILD_TARGET=/src/linux/tools/testing/selftests/powerpc/alignment; mkdir -p $BUILD_TARGET; make OUTPUT=$BUILD_TARGET -k -C alignment all
        make[2]: Entering directory '/src/linux/tools/testing/selftests/powerpc/alignment'
        ../../lib.mk:20: ../../../../scripts/subarch.include: No such file or directory
        make[2]: *** No rule to make target '../../../../scripts/subarch.include'.
        make[2]: Failed to remake makefile '../../../../scripts/subarch.include'.
        Makefile:38: recipe for target 'alignment' failed
      
      Fix it by setting top_srcdir in the affected Makefiles.
      
      Fixes: b2d35fa5 ("selftests: add headers_install to lib.mk")
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      7e0cf1c9
    • M
      perf report: Don't try to map ip to invalid map · ff4ce288
      Milian Wolff 提交于
      Fixes a crash when the report encounters an address that could not be
      associated with an mmaped region:
      
        #0  0x00005555557bdc4a in callchain_srcline (ip=<error reading variable: Cannot access memory at address 0x38>, sym=0x0, map=0x0) at util/machine.c:2329
        #1  unwind_entry (entry=entry@entry=0x7fffffff9180, arg=arg@entry=0x7ffff5642498) at util/machine.c:2329
        #2  0x00005555558370af in entry (arg=0x7ffff5642498, cb=0x5555557bdb50 <unwind_entry>, thread=<optimized out>, ip=18446744073709551615) at util/unwind-libunwind-local.c:586
        #3  get_entries (ui=ui@entry=0x7fffffff9620, cb=0x5555557bdb50 <unwind_entry>, arg=0x7ffff5642498, max_stack=<optimized out>) at util/unwind-libunwind-local.c:703
        #4  0x0000555555837192 in _unwind__get_entries (cb=<optimized out>, arg=<optimized out>, thread=<optimized out>, data=<optimized out>, max_stack=<optimized out>) at util/unwind-libunwind-local.c:725
        #5  0x00005555557c310f in thread__resolve_callchain_unwind (max_stack=127, sample=0x7fffffff9830, evsel=0x555555c7b3b0, cursor=0x7ffff5642498, thread=0x555555c7f6f0) at util/machine.c:2351
        #6  thread__resolve_callchain (thread=0x555555c7f6f0, cursor=0x7ffff5642498, evsel=0x555555c7b3b0, sample=0x7fffffff9830, parent=0x7fffffff97b8, root_al=0x7fffffff9750, max_stack=127) at util/machine.c:2378
        #7  0x00005555557ba4ee in sample__resolve_callchain (sample=<optimized out>, cursor=<optimized out>, parent=parent@entry=0x7fffffff97b8, evsel=<optimized out>, al=al@entry=0x7fffffff9750,
            max_stack=<optimized out>) at util/callchain.c:1085
      Signed-off-by: NMilian Wolff <milian.wolff@kdab.com>
      Tested-by: NSandipan Das <sandipan@linux.ibm.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Fixes: 2a9d5050 ("perf script: Show correct offsets for DWARF-based unwinding")
      Link: http://lkml.kernel.org/r/20180926135207.30263-1-milian.wolff@kdab.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ff4ce288
    • M
      rseq/selftests: fix parametrized test with -fpie · ce01a157
      Mathieu Desnoyers 提交于
      On x86-64, the parametrized selftest code for rseq crashes with a
      segmentation fault when compiled with -fpie. This happens when the
      param_test binary is loaded at an address beyond 32-bit on x86-64.
      
      The issue is caused by use of a 32-bit register to hold the address
      of the loop counter variable.
      
      Fix this by using a 64-bit register to calculate the address of the
      loop counter variables as an offset from rip.
      Signed-off-by: NMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Acked-by: N"Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
      Cc: <stable@vger.kernel.org> # v4.18
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Joel Fernandes <joelaf@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Dave Watson <davejwatson@fb.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: linux-kselftest@vger.kernel.org
      Cc: "H . Peter Anvin" <hpa@zytor.com>
      Cc: Chris Lameter <cl@linux.com>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: "Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
      Cc: Paul Turner <pjt@google.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Josh Triplett <josh@joshtriplett.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Ben Maurer <bmaurer@fb.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NShuah Khan (Samsung OSG) <shuah@kernel.org>
      ce01a157
  14. 25 9月, 2018 2 次提交
  15. 22 9月, 2018 1 次提交