1. 18 Oct, 2018 4 commits
    • David Miller's avatar
      perf annotate: Add Sparc support · 0ab41886
      David Miller authored
      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: default avatarDavid S. Miller <davem@davemloft.net>
      Link: http://lkml.kernel.org/r/20181016.205555.1070918198627611771.davem@davemloft.netSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0ab41886
    • Alexey Budankov's avatar
      perf record: Encode -k clockid frequency into Perf trace · cf790516
      Alexey Budankov authored
      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: default avatarAlexey 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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      cf790516
    • Arnaldo Carvalho de Melo's avatar
      ce6c9da1
    • Ingo Molnar's avatar
      Merge tag 'perf-urgent-for-mingo-4.19-20181017' of... · 20e8e72d
      Ingo Molnar authored
      Merge tag 'perf-urgent-for-mingo-4.19-20181017' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
      
      Pull perf/urgent fixes from Arnaldo Carvalho de Melo:
      
      - Stop falling back to kallsyms for vDSO symbols lookup, this wasn't
        being really used and is not valid in arches such as Sparc, where
        user and kernel space don't share the address space, relying only on
        cpumode to figure out what DSOs to lookup (Arnaldo Carvalho de Melo)
      
      - Align CPU map synthesized events properly, fixing SIGBUS in
        CPUs like Sparc (David Miller)
      
      - Fix use of alternatives to find JDIR (Jarod Wilson)
      
      - Store IDs for events with their own CPUs when synthesizing user
        level event details (scale, unit, etc) events, fixing a crash
        when recording a PMU event with a cpumask defined (Jiri Olsa)
      
      - Fix wrong filter_band* values for uncore Intel vendor events (Jiri Olsa)
      
      - Fix detection of tracefs path in systems without tracefs, where
        that path should be the debugfs mountpoint plus "/tracing/" (Jiri Olsa)
      
      - Pass build flags to traceevent build, allowing using alternative
        flags in distro packages, RPM, for instance (Jiri Olsa)
      
      - Fix 'perf report' crash on invalid inline debug information (Milian Wolff)
      
      - Synch KVM UAPI copies (Arnaldo Carvalho de Melo)
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      20e8e72d
  2. 17 Oct, 2018 1 commit
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Stop fallbacking to kallsyms for vdso symbols lookup · edeb0c90
      Arnaldo Carvalho de Melo authored
      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: default avatarDavid Miller <davem@davemloft.net>
      Acked-by: default avatarDavid 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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      edeb0c90
  3. 16 Oct, 2018 10 commits
    • Jiri Olsa's avatar
      perf tools: Pass build flags to traceevent build · 298faf53
      Jiri Olsa authored
      So the extra user build flags are propagated to libtraceevent.
      Signed-off-by: default avatarJiri 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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      298faf53
    • Milian Wolff's avatar
      perf report: Don't crash on invalid inline debug information · d4046e8e
      Milian Wolff authored
      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: default avatarHadrien Grasland <grasland@lal.in2p3.fr>
      Signed-off-by: default avatarMilian 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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d4046e8e
    • Greg Kroah-Hartman's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc · b955a910
      Greg Kroah-Hartman authored
      David writes:
        "Sparc fixes
      
         1) Revert the %pOF change, it causes regressions.
      
         2) Wire up io_pgetevents().
      
         3) Fix perf events on single-PCR sparc64 cpus.
      
         4) Do proper perf event throttling like arm and x86."
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc:
        Revert "sparc: Convert to using %pOFn instead of device_node.name"
        sparc64: Set %l4 properly on trap return after handling signals.
        sparc64: Make proc_id signed.
        sparc: Throttle perf events properly.
        sparc: Fix single-pcr perf event counter management.
        sparc: Wire up io_pgetevents system call.
        sunvdc: Remove VLA usage
      b955a910
    • Greg Kroah-Hartman's avatar
      Merge tag 'selinux-pr-20181015' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux · a8861998
      Greg Kroah-Hartman authored
      Paul writes:
        "SELinux fixes for v4.19
      
         We've got one SELinux "fix" that I'd like to get into v4.19 if
         possible.  I'm using double quotes on "fix" as this is just an update
         to the MAINTAINERS file and not a code change.  From my perspective,
         MAINTAINERS updates generally don't warrant inclusion during the -rcX
         phase, but this is a change to the mailing list location so it seemed
         prudent to get this in before v4.19 is released"
      
      * tag 'selinux-pr-20181015' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux:
        MAINTAINERS: update the SELinux mailing list location
      a8861998
    • David Miller's avatar
      perf cpu_map: Align cpu map synthesized events properly. · 0ed149cf
      David Miller authored
      The size of the resulting cpu map can be smaller than a multiple of
      sizeof(u64), resulting in SIGBUS on cpus like Sparc as the next event
      will not be aligned properly.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@intel.com>
      Fixes: 6c872901 ("perf cpu_map: Add cpu_map event synthesize function")
      Link: http://lkml.kernel.org/r/20181011.224655.716771175766946817.davem@davemloft.netSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0ed149cf
    • Jiri Olsa's avatar
      perf/x86/intel: Export mem events only if there's PEBS support · d4ae5529
      Jiri Olsa authored
      Memory events depends on PEBS support and access to LDLAT MSR, but we
      display them in /sys/devices/cpu/events even if the CPU does not
      provide those, like for KVM guests.
      
      That brings the false assumption that those events should be
      available, while they fail event to open.
      
      Separating the mem-* events attributes and merging them with
      cpu_events only if there's PEBS support detected.
      
      We could also check if LDLAT MSR is available, but the PEBS check
      seems to cover the need now.
      Suggested-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Link: http://lkml.kernel.org/r/20180906135748.GC9577@kravaSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      d4ae5529
    • Jiri Olsa's avatar
      perf tools: Fix tracing_path_mount proper path · c458a620
      Jiri Olsa authored
      If there's no tracefs (RHEL7) support the tracing_path_mount
      returns debugfs path which results in following fail:
      
        # perf probe sys_write
        kprobe_events file does not exist - please rebuild kernel with CONFIG_KPROBE_EVENTS.
        Error: Failed to add events.
      
      In tracing_path_debugfs_mount function we need to return the
      'tracing' path instead of just the mount to make it work:
      
        # perf probe sys_write
        Added new event:
          probe:sys_write      (on sys_write)
      
        You can now use it in all perf tools, such as:
      
                perf record -e probe:sys_write -aR sleep 1
      
      Adding the 'return tracing_path;' also to tracing_path_tracefs_mount
      function just for consistency with tracing_path_debugfs_mount.
      
      Upstream keeps working, because it has the tracefs support.
      
      Link: http://lkml.kernel.org/n/tip-yiwkzexq9fk1ey1xg3gnjlw4@git.kernel.orgSigned-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Fixes: 23773ca1 ("perf tools: Make perf aware of tracefs")
      Link: http://lkml.kernel.org/r/20181016114818.3595-1-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c458a620
    • Jarod Wilson's avatar
      perf tools: Fix use of alternatives to find JDIR · 36b8d462
      Jarod Wilson authored
      When a build is run from something like a cron job, the user's $PATH is
      rather minimal, of note, not including /usr/sbin in my own case. Because
      of that, an automated rpm package build ultimately fails to find
      libperf-jvmti.so, because somewhere within the build, this happens...
      
        /bin/sh: alternatives: command not found
        /bin/sh: alternatives: command not found
        Makefile.config:849: No openjdk development package found, please install
        JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel
      
      ...and while the build continues, libperf-jvmti.so isn't built, and
      things fall down when rpm tries to find all the %files specified. Exact
      same system builds everything just fine when the job is launched from a
      login shell instead of a cron job, since alternatives is in $PATH, so
      openjdk is actually found.
      
      The test required to get into this section of code actually specifies
      the full path, as does a block just above it, so let's do that here too.
      Signed-off-by: default avatarJarod Wilson <jarod@redhat.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: William Cohen <wcohen@redhat.com>
      Fixes: d4dfdf00 ("perf jvmti: Plug compilation into perf build")
      Link: http://lkml.kernel.org/r/20180906221812.11167-1-jarod@redhat.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      36b8d462
    • Jiri Olsa's avatar
      perf evsel: Store ids for events with their own cpus perf_event__synthesize_event_update_cpus · 4ab8455f
      Jiri Olsa authored
      John reported crash when recording on an event under PMU with cpumask defined:
      
        root@localhost:~# ./perf_debug_ record -e armv8_pmuv3_0/br_mis_pred/ sleep 1
        perf: Segmentation fault
        Obtained 9 stack frames.
        ./perf_debug_() [0x4c5ef8]
        [0xffff82ba267c]
        ./perf_debug_() [0x4bc5a8]
        ./perf_debug_() [0x419550]
        ./perf_debug_() [0x41a928]
        ./perf_debug_() [0x472f58]
        ./perf_debug_() [0x473210]
        ./perf_debug_() [0x4070f4]
        /lib/aarch64-linux-gnu/libc.so.6(__libc_start_main+0xe0) [0xffff8294c8a0]
        Segmentation fault (core dumped)
      
      We synthesize an update event that needs to touch the evsel id array, which is
      not defined at that time. Fixing this by forcing the id allocation for events
      with their own cpus.
      Reported-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarJohn Garry <john.garry@huawei.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linuxarm@huawei.com
      Fixes: bfd8f72c ("perf record: Synthesize unit/scale/... in event update")
      Link: http://lkml.kernel.org/r/20181003212052.GA32371@kravaSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4ab8455f
    • David S. Miller's avatar
      Revert "sparc: Convert to using %pOFn instead of device_node.name" · a06ecbfe
      David S. Miller authored
      This reverts commit 0b9871a3.
      
      Causes crashes with qemu, interacts badly with commit commit
      6d0a70a2 ("vsprintf: print OF node name using full_name")
      etc.
      Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a06ecbfe
  4. 15 Oct, 2018 4 commits
    • David Howells's avatar
      afs: Fix clearance of reply · f0a7d188
      David Howells authored
      The recent patch to fix the afs_server struct leak didn't actually fix the
      bug, but rather fixed some of the symptoms.  The problem is that an
      asynchronous call that holds a resource pointed to by call->reply[0] will
      find the pointer cleared in the call destructor, thereby preventing the
      resource from being cleaned up.
      
      In the case of the server record leak, the afs_fs_get_capabilities()
      function in devel code sets up a call with reply[0] pointing at the server
      record that should be altered when the result is obtained, but this was
      being cleared before the destructor was called, so the put in the
      destructor does nothing and the record is leaked.
      
      Commit f014ffb0 removed the additional ref obtained by
      afs_install_server(), but the removal of this ref is actually used by the
      garbage collector to mark a server record as being defunct after the record
      has expired through lack of use.
      
      The offending clearance of call->reply[0] upon completion in
      afs_process_async_call() has been there from the origin of the code, but
      none of the asynchronous calls actually use that pointer currently, so it
      should be safe to remove (note that synchronous calls don't involve this
      function).
      
      Fix this by the following means:
      
       (1) Revert commit f014ffb0.
      
       (2) Remove the clearance of reply[0] from afs_process_async_call().
      
      Without this, afs_manage_servers() will suffer an assertion failure if it
      sees a server record that didn't get used because the usage count is not 1.
      
      Fixes: f014ffb0 ("afs: Fix afs_server struct leak")
      Fixes: 08e0e7c8 ("[AF_RXRPC]: Make the in-kernel AFS filesystem use AF_RXRPC.")
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f0a7d188
    • Greg Kroah-Hartman's avatar
      Linux 4.19-rc8 · 35a7f35a
      Greg Kroah-Hartman authored
      35a7f35a
    • David S. Miller's avatar
      sparc64: Set %l4 properly on trap return after handling signals. · d1f1f98c
      David S. Miller authored
      If we did some signal processing, we have to reload the pt_regs
      tstate register because it's value may have changed.
      
      In doing so we also have to extract the %pil value contained in there
      anre load that into %l4.
      
      This value is at bit 20 and thus needs to be shifted down before we
      later write it into the %pil register.
      
      Most of the time this is harmless as we are returning to userspace
      and the %pil is zero for that case.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d1f1f98c
    • David S. Miller's avatar
      sparc64: Make proc_id signed. · b3e1eb8e
      David S. Miller authored
      So that when it is unset, ie. '-1', userspace can see it
      properly.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b3e1eb8e
  5. 14 Oct, 2018 2 commits
  6. 13 Oct, 2018 11 commits
  7. 12 Oct, 2018 8 commits