1. 20 Aug, 2018 1 commit
    • Rasmus Villemoes's avatar
      perf tools: Disable parallelism for 'make clean' · da15fc2f
      Rasmus Villemoes authored
      The Yocto build system does a 'make clean' when rebuilding due to
      changed dependencies, and that consistently fails for me (causing the
      whole BSP build to fail) with errors such as
      
      | find: '[...]/perf/1.0-r9/perf-1.0/plugin_mac80211.so': No such file or directory
      | find: '[...]/perf/1.0-r9/perf-1.0/plugin_mac80211.so': No such file or directory
      | find: find: '[...]/perf/1.0-r9/perf-1.0/libtraceevent.a''[...]/perf/1.0-r9/perf-1.0/libtraceevent.a': No such file or directory: No such file or directory
      |
      [...]
      | find: cannot delete '/mnt/xfs/devel/pil/yocto/tmp-glibc/work/wandboard-oe-linux-gnueabi/perf/1.0-r9/perf-1.0/util/.pstack.o.cmd': No such file or directory
      
      Apparently (despite the comment), 'make clean' ends up launching
      multiple sub-makes that all want to remove the same things - perhaps
      this only happens in combination with a O=... parameter. In any case, we
      don't lose much by explicitly disabling the parallelism for the clean
      target, and it makes automated builds much more reliable.
      Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20180705131527.19749-1-linux@rasmusvillemoes.dkSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      da15fc2f
  2. 18 Aug, 2018 1 commit
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo-4.19-20180815' of... · 5804b110
      Ingo Molnar authored
      Merge tag 'perf-core-for-mingo-4.19-20180815' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
      
      Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
      
      kernel:
      
      - kallsyms, x86: Export addresses of PTI entry trampolines (Alexander Shishkin)
      
      - kallsyms: Simplify update_iter_mod() (Adrian Hunter)
      
      - x86: Add entry trampolines to kcore (Adrian Hunter)
      
      Hardware tracing:
      
      - Fix auxtrace queue resize (Adrian Hunter)
      
      Arch specific:
      
      - Fix uninitialized ARM SPE record error variable (Kim Phillips)
      
      - Fix trace event post-processing in powerpc (Sandipan Das)
      
      Build:
      
      - Fix check-headers.sh AND list path of execution (Alexander Kapshuk)
      
      - Remove -mcet and -fcf-protection when building the python binding
        with older clang versions (Arnaldo Carvalho de Melo)
      
      - Make check-headers.sh check based on kernel dir (Jiri Olsa)
      
      - Move syscall_64.tbl check into check-headers.sh (Jiri Olsa)
      
      Infrastructure:
      
      - Check for null when copying nsinfo.  (Benno Evers)
      
      Libraries:
      
      - Rename libtraceevent prefixes, prep work for making it a shared
        library generaly available (Tzvetomir Stoyanov (VMware))
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5804b110
  3. 14 Aug, 2018 12 commits
    • Adrian Hunter's avatar
      x86: Add entry trampolines to kcore · 6855dc41
      Adrian Hunter authored
      Without program headers for PTI entry trampoline pages, the trampoline
      virtual addresses do not map to anything.
      
      Example before:
      
       sudo gdb --quiet vmlinux /proc/kcore
       Reading symbols from vmlinux...done.
       [New process 1]
       Core was generated by `BOOT_IMAGE=/boot/vmlinuz-4.16.0 root=UUID=a6096b83-b763-4101-807e-f33daff63233'.
       #0  0x0000000000000000 in irq_stack_union ()
       (gdb) x /21ib 0xfffffe0000006000
          0xfffffe0000006000:  Cannot access memory at address 0xfffffe0000006000
       (gdb) quit
      
      After:
      
       sudo gdb --quiet vmlinux /proc/kcore
       [sudo] password for ahunter:
       Reading symbols from vmlinux...done.
       [New process 1]
       Core was generated by `BOOT_IMAGE=/boot/vmlinuz-4.16.0-fix-4-00005-gd6e65a8b4072 root=UUID=a6096b83-b7'.
       #0  0x0000000000000000 in irq_stack_union ()
       (gdb) x /21ib 0xfffffe0000006000
          0xfffffe0000006000:  swapgs
          0xfffffe0000006003:  mov    %rsp,-0x3e12(%rip)        # 0xfffffe00000021f8
          0xfffffe000000600a:  xchg   %ax,%ax
          0xfffffe000000600c:  mov    %cr3,%rsp
          0xfffffe000000600f:  bts    $0x3f,%rsp
          0xfffffe0000006014:  and    $0xffffffffffffe7ff,%rsp
          0xfffffe000000601b:  mov    %rsp,%cr3
          0xfffffe000000601e:  mov    -0x3019(%rip),%rsp        # 0xfffffe000000300c
          0xfffffe0000006025:  pushq  $0x2b
          0xfffffe0000006027:  pushq  -0x3e35(%rip)        # 0xfffffe00000021f8
          0xfffffe000000602d:  push   %r11
          0xfffffe000000602f:  pushq  $0x33
          0xfffffe0000006031:  push   %rcx
          0xfffffe0000006032:  push   %rdi
          0xfffffe0000006033:  mov    $0xffffffff91a00010,%rdi
          0xfffffe000000603a:  callq  0xfffffe0000006046
          0xfffffe000000603f:  pause
          0xfffffe0000006041:  lfence
          0xfffffe0000006044:  jmp    0xfffffe000000603f
          0xfffffe0000006046:  mov    %rdi,(%rsp)
          0xfffffe000000604a:  retq
       (gdb) quit
      
      In addition, entry trampolines all map to the same page.  Represent that
      by giving the corresponding program headers in kcore the same offset.
      
      This has the benefit that, when perf tools uses /proc/kcore as a source
      for kernel object code, samples from different CPU trampolines are
      aggregated together.  Note, such aggregation is normal for profiling
      i.e. people want to profile the object code, not every different virtual
      address the object code might be mapped to (across different processes
      for example).
      
      Notes by PeterZ:
      
      This also adds the KCORE_REMAP functionality.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarAndi Kleen <ak@linux.intel.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86@kernel.org
      Link: http://lkml.kernel.org/r/1528289651-4113-4-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6855dc41
    • Alexander Shishkin's avatar
      kallsyms, x86: Export addresses of PTI entry trampolines · d83212d5
      Alexander Shishkin authored
      Currently, the addresses of PTI entry trampolines are not exported to
      user space. Kernel profiling tools need these addresses to identify the
      kernel code, so add a symbol and address for each CPU's PTI entry
      trampoline.
      Signed-off-by: default avatarAlexander Shishkin <alexander.shishkin@linux.intel.com>
      Acked-by: default avatarAndi Kleen <ak@linux.intel.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86@kernel.org
      Link: http://lkml.kernel.org/r/1528289651-4113-3-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d83212d5
    • Adrian Hunter's avatar
      kallsyms: Simplify update_iter_mod() · b9667942
      Adrian Hunter authored
      The logic in update_iter_mod() is overcomplicated and gets worse every
      time another get_ksymbol_* function is added.
      
      In preparation for adding another get_ksymbol_* function, simplify logic
      in update_iter_mod().
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: default avatar(ftrace changes only) Steven Rostedt (VMware) <rostedt@goodmis.org>
      Acked-by: default avatarAndi Kleen <ak@linux.intel.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86@kernel.org
      Link: http://lkml.kernel.org/r/1528289651-4113-2-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b9667942
    • Adrian Hunter's avatar
      perf auxtrace: Fix queue resize · 99cbbe56
      Adrian Hunter authored
      When the number of queues grows beyond 32, the array of queues is
      resized but not all members were being copied. Fix by also copying
      'tid', 'cpu' and 'set'.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: stable@vger.kernel.org
      Fixes: e5027893 ("perf auxtrace: Add helpers for queuing AUX area tracing data")
      Link: http://lkml.kernel.org/r/20180814084608.6563-1-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      99cbbe56
    • Arnaldo Carvalho de Melo's avatar
      perf python: Remove -mcet and -fcf-protection when building with clang · 5508672d
      Arnaldo Carvalho de Melo authored
      These options are not present in older clang versions, so when we build
      for a distro that has a gcc new enough to have these options and that
      the distro python build config settings use them but clang doesn't
      support, b00m.
      
      This is the case with fedora 28 and rawhide, so check if clang has the
      options and remove the missing ones from CFLAGS.
      
      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-7asds7yn6gzg6ns1lw17ukul@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5508672d
    • Kim Phillips's avatar
      perf arm spe: Fix uninitialized record error variable · 34435336
      Kim Phillips authored
      The auxtrace init variable 'err' was not being initialized, leading perf
      to abort early in an SPE record command when there was no explicit
      error, rather only based whatever memory contents were on the stack.
      Initialize it explicitly on getting an SPE successfully, the same way
      cs-etm does.
      Signed-off-by: default avatarKim Phillips <kim.phillips@arm.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Dongjiu Geng <gengdongjiu@huawei.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Fixes: ffd3d18c ("perf tools: Add ARM Statistical Profiling Extensions (SPE) support")
      Link: http://lkml.kernel.org/r/20180810174512.52900813e57cbccf18ce99a2@arm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      34435336
    • Jiri Olsa's avatar
      perf tools: Move syscall_64.tbl check into check-headers.sh · c9b51a01
      Jiri Olsa authored
      Probably leftover from the time we introducd the check-headers.sh script.
      
      Committer testing:
      
      Remove the 'rseq' syscall from tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
      to fake a diff:
      
      make: Entering directory '/home/acme/git/perf/tools/perf'
        BUILD:   Doing 'make -j4' parallel build
      Warning: Kernel ABI header at 'tools/perf/arch/x86/entry/syscalls/syscall_64.tbl' differs from latest version at 'arch/x86/entry/syscalls/syscall_64.tbl'
      diff -u tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl
        CC       /tmp/build/perf/util/syscalltbl.o
        INSTALL  trace_plugins
      <SNIP>
        $ diff -u tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl
        --- tools/perf/arch/x86/entry/syscalls/syscall_64.tbl	2018-08-13 15:49:50.896585176 -0300
        +++ arch/x86/entry/syscalls/syscall_64.tbl	2018-07-20 12:04:04.536858304 -0300
        @@ -342,6 +342,7 @@
         331	common	pkey_free		__x64_sys_pkey_free
         332	common	statx			__x64_sys_statx
         333	common	io_pgetevents		__x64_sys_io_pgetevents
        +334	common	rseq			__x64_sys_rseq
      
        #
        # x32-specific system call numbers start at 512 to avoid cache impact
        $
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Kapshuk <alexander.kapshuk@gmail.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20180813111504.3568-2-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c9b51a01
    • Jiri Olsa's avatar
      perf tools: Make check-headers.sh check based on kernel dir · 7ea6e983
      Jiri Olsa authored
      Changing the logic to compare files with paths relative to kernel source
      base dir. This way we can keep the output message for 2 unrelated files,
      which is coming in following patch.
      
      Committer testing:
      
      Remove a line from tools/arch/x86/lib/memcpy_64.S to have it detected:
      
      make: Entering directory '/home/acme/git/perf/tools/perf'
        BUILD:   Doing 'make -j4' parallel build
      Warning: Kernel ABI header at 'tools/arch/x86/lib/memcpy_64.S' differs from latest version at 'arch/x86/lib/memcpy_64.S'
      diff -u tools/arch/x86/lib/memcpy_64.S arch/x86/lib/memcpy_64.S
        INSTALL  GTK UI
        INSTALL  binaries
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Kapshuk <alexander.kapshuk@gmail.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20180813111504.3568-1-jolsa@kernel.org
      Link: http://lkml.kernel.org/r/20180814072726.GA13931@krava
      [ Do not use pushd/popd, its a bashism, reported by Michael Ellerman, fixed by Jiri Olsa ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7ea6e983
    • Linus Torvalds's avatar
      Merge branch 'x86-timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 13e091b6
      Linus Torvalds authored
      Pull x86 timer updates from Thomas Gleixner:
       "Early TSC based time stamping to allow better boot time analysis.
      
        This comes with a general cleanup of the TSC calibration code which
        grew warts and duct taping over the years and removes 250 lines of
        code. Initiated and mostly implemented by Pavel with help from various
        folks"
      
      * 'x86-timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (37 commits)
        x86/kvmclock: Mark kvm_get_preset_lpj() as __init
        x86/tsc: Consolidate init code
        sched/clock: Disable interrupts when calling generic_sched_clock_init()
        timekeeping: Prevent false warning when persistent clock is not available
        sched/clock: Close a hole in sched_clock_init()
        x86/tsc: Make use of tsc_calibrate_cpu_early()
        x86/tsc: Split native_calibrate_cpu() into early and late parts
        sched/clock: Use static key for sched_clock_running
        sched/clock: Enable sched clock early
        sched/clock: Move sched clock initialization and merge with generic clock
        x86/tsc: Use TSC as sched clock early
        x86/tsc: Initialize cyc2ns when tsc frequency is determined
        x86/tsc: Calibrate tsc only once
        ARM/time: Remove read_boot_clock64()
        s390/time: Remove read_boot_clock64()
        timekeeping: Default boot time offset to local_clock()
        timekeeping: Replace read_boot_clock64() with read_persistent_wall_and_boot_offset()
        s390/time: Add read_persistent_wall_and_boot_offset()
        x86/xen/time: Output xen sched_clock time from 0
        x86/xen/time: Initialize pv xen time in init_hypervisor_platform()
        ...
      13e091b6
    • Linus Torvalds's avatar
      Merge branch 'x86/pti' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · eac34119
      Linus Torvalds authored
      Pull x86 PTI updates from Thomas Gleixner:
       "The Speck brigade sadly provides yet another large set of patches
        destroying the perfomance which we carefully built and preserved
      
         - PTI support for 32bit PAE. The missing counter part to the 64bit
           PTI code implemented by Joerg.
      
         - A set of fixes for the Global Bit mechanics for non PCID CPUs which
           were setting the Global Bit too widely and therefore possibly
           exposing interesting memory needlessly.
      
         - Protection against userspace-userspace SpectreRSB
      
         - Support for the upcoming Enhanced IBRS mode, which is preferred
           over IBRS. Unfortunately we dont know the performance impact of
           this, but it's expected to be less horrible than the IBRS
           hammering.
      
         - Cleanups and simplifications"
      
      * 'x86/pti' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (60 commits)
        x86/mm/pti: Move user W+X check into pti_finalize()
        x86/relocs: Add __end_rodata_aligned to S_REL
        x86/mm/pti: Clone kernel-image on PTE level for 32 bit
        x86/mm/pti: Don't clear permissions in pti_clone_pmd()
        x86/mm/pti: Fix 32 bit PCID check
        x86/mm/init: Remove freed kernel image areas from alias mapping
        x86/mm/init: Add helper for freeing kernel image pages
        x86/mm/init: Pass unconverted symbol addresses to free_init_pages()
        mm: Allow non-direct-map arguments to free_reserved_area()
        x86/mm/pti: Clear Global bit more aggressively
        x86/speculation: Support Enhanced IBRS on future CPUs
        x86/speculation: Protect against userspace-userspace spectreRSB
        x86/kexec: Allocate 8k PGDs for PTI
        Revert "perf/core: Make sure the ring-buffer is mapped in all page-tables"
        x86/mm: Remove in_nmi() warning from vmalloc_fault()
        x86/entry/32: Check for VM86 mode in slow-path check
        perf/core: Make sure the ring-buffer is mapped in all page-tables
        x86/pti: Check the return value of pti_user_pagetable_walk_pmd()
        x86/pti: Check the return value of pti_user_pagetable_walk_p4d()
        x86/entry/32: Add debug code to check entry/exit CR3
        ...
      eac34119
    • Linus Torvalds's avatar
      Merge branch 'x86-vdso-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · d191c82d
      Linus Torvalds authored
      Pull x86 vdso update from Thomas Gleixner:
       "Use LD to link the VDSO libs instead of indirecting trough CC which
        causes build failures with Clang"
      
      * 'x86-vdso-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86: vdso: Use $LD instead of $CC to link
      d191c82d
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 4d5ac4b8
      Linus Torvalds authored
      Pull misc x86 fixes from Thomas Gleixner:
       "Two fixes for x86:
      
         - Provide a declaration for native_save_fl() which unbreaks the
           wreckage caused by making it 'extern inline'.
      
         - Fix the failing paravirt patching which is supposed to replace
           indirect with direct calls. The wreckage is caused by an incorrect
           clobber test"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/paravirt: Fix spectre-v2 mitigations for paravirt guests
        x86/irqflags: Provide a declaration for native_save_fl
      4d5ac4b8
  4. 13 Aug, 2018 26 commits