1. 20 Mar, 2018 17 commits
  2. 19 Mar, 2018 10 commits
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo-4.17-20180319' of... · ecd380b8
      Ingo Molnar authored
      Merge tag 'perf-core-for-mingo-4.17-20180319' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
      
      Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
      
      - Fixes for problems experienced with new GCC 8 warnings, that treated
        as errors, broke the build, related to snprintf and casting issues.
        (Arnaldo Carvalho de Melo, Jiri Olsa, Josh Poinboeuf)
      
      - Fix build of new breakpoint 'perf test' entry with clang < 6, noticed
        on fedora 25, 26 and 27 (Arnaldo Carvalho de Melo)
      
      - Workaround problem with symbol resolution in 'perf annotate', using
        the symbol name already present in the objdump output (Arnaldo Carvalho de Melo)
      
      - Document 'perf top --ignore-vmlinux' (Arnaldo Carvalho de Melo)
      
      - Fix out of bounds access on array fd when cnt is 100 in one of the
        'perf test' entries, detected using 'cpptest' (Colin Ian King)
      
      - Add support for the forced leader feature, i.e. 'perf report --group'
        for a group of events not really grouped when scheduled (without using
        {} to enclose the list of events in the command line) in pipe mode,
        e.g.:
      
          $ perf record -e cycles,instructions -o - kill | perf report --group -i -
      
      - Use right type to access array elements in 'perf probe' (Masami Hiramatsu)
      
      - Update POWER9 vendor events (those described in JSON format) (Sukadev Bhattiprolu)
      
      - Discard head in overwrite_rb_find_range() (Yisheng Xie)
      
      - Avoid setting 'quiet' to 'true' unnecessarily (Yisheng Xie)
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      ecd380b8
    • Ingo Molnar's avatar
      134933e5
    • Arnaldo Carvalho de Melo's avatar
      perf tests bp_account: Fix build with clang-6 · 1cd61883
      Arnaldo Carvalho de Melo authored
      To shut up this compiler warning:
      
          CC       /tmp/build/perf/tests/bp_account.o
          CC       /tmp/build/perf/tests/task-exit.o
          CC       /tmp/build/perf/tests/sw-clock.o
        tests/bp_account.c:106:20: error: pointer type mismatch ('int (*)(void)' and 'void *') [-Werror,-Wpointer-type-mismatch]
                void *addr = is_x ? test_function : (void *) &the_var;
                                  ^ ~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~
        1 error generated.
      
      Noticed with clang 6 on fedora rawhide.
      
        [perfbuilder@44490f0e7241 perf]$ clang -v
        clang version 6.0.0 (tags/RELEASE_600/final)
        Target: x86_64-unknown-linux-gnu
        Thread model: posix
        InstalledDir: /usr/bin
        Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/8
        Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/8
        Selected GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/8
        Candidate multilib: .;@m64
        Candidate multilib: 32;@m32
        Selected multilib: .;@m64
        [perfbuilder@44490f0e7241 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: Wang Nan <wangnan0@huawei.com>
      Fixes: 032db28e ("perf tests: Add breakpoint accounting/modify test")
      Link: https://lkml.kernel.org/n/tip-a3jnkzh4xam0l954de5tn66d@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1cd61883
    • Josh Poimboeuf's avatar
      objtool, perf: Fix GCC 8 -Wrestrict error · 854e55ad
      Josh Poimboeuf authored
      Starting with recent GCC 8 builds, objtool and perf fail to build with
      the following error:
      
        ../str_error_r.c: In function ‘str_error_r’:
        ../str_error_r.c:25:3: error: passing argument 1 to restrict-qualified parameter aliases with argument 5 [-Werror=restrict]
           snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d", errnum, buf, buflen, err);
      
      The code seems harmless, but there's probably no benefit in printing the
      'buf' pointer in this situation anyway, so just remove it to make GCC
      happy.
      Reported-by: default avatarLaura Abbott <labbott@redhat.com>
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Tested-by: default avatarLaura Abbott <labbott@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/20180316031154.juk2uncs7baffctp@trebleSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      854e55ad
    • Masami Hiramatsu's avatar
      perf probe: Use right type to access array elements · d0461794
      Masami Hiramatsu authored
      Current 'perf probe' converts the type of array-elements incorrectly. It
      always converts the types as a pointer of array. This passes the "array"
      type DIE to the type converter so that it can get correct "element of
      array" type DIE from it.
      
      E.g.
        ====
        $ cat hello.c
        #include <stdio.h>
      
        void foo(int a[])
        {
      	  printf("%d\n", a[1]);
        }
      
        void main()
        {
      	  int a[3] = {4, 5, 6};
      	  printf("%d\n", a[0]);
      	  foo(a);
        }
      
        $ gcc -g hello.c -o hello
        $ perf probe -x ./hello -D "foo a[1]"
        ====
      
      Without this fix, above outputs
        ====
        p:probe_hello/foo /tmp/hello:0x4d3 a=+4(-8(%bp)):u64
        ====
      The "u64" means "int *", but a[1] is "int".
      
      With this,
        ====
        p:probe_hello/foo /tmp/hello:0x4d3 a=+4(-8(%bp)):s32
        ====
      So, "int" correctly converted to "s32"
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tom Zanussi <tom.zanussi@linux.intel.com>
      Cc: linux-kselftest@vger.kernel.org
      Cc: linux-trace-users@vger.kernel.org
      Fixes: b2a3c12b ("perf probe: Support tracing an entry of array")
      Link: http://lkml.kernel.org/r/152129114502.31874.2474068470011496356.stgit@devboxSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d0461794
    • Arnaldo Carvalho de Melo's avatar
      perf annotate: Use ops->target.name when available for unresolved call targets · 4c9cb2c2
      Arnaldo Carvalho de Melo authored
      There is a bug where when using 'perf annotate timerqueue_add' the
      target for its only routine called with the 'callq' instruction,
      'rb_insert_color', doesn't get resolved from its address when parsing
      that 'callq' instruction.
      
      That symbol resolution works when using 'perf report --tui' and then
      doing annotation for 'timerqueue_add' from there, the vmlinux
      dso->symbols rb_tree somehow gets in a state that we can't find that
      address, that is a bug that has to be further investigated.
      
      But since the objdump output has the function name, i.e. the raw objdump
      disassembled line looks like:
      
      So, before:
      
        # perf annotate timerqueue_add
      
                    │      mov    %rbx,%rdi
                    │      mov    %rbx,(%rdx)
                    │    → callq  *ffffffff8184dc80
                    │      mov    0x8(%rbp),%rdx
                    │      test   %rdx,%rdx
                    │    ↓ je     67
      
        # perf report
      
                    │      mov    %rbx,%rdi
                    │      mov    %rbx,(%rdx)
                    │    → callq  rb_insert_color
                    │      mov    0x8(%rbp),%rdx
                    │      test   %rdx,%rdx
                    │    ↓ je     67
      
      And after both look the same:
      
        # perf annotate timerqueue_add
      
                    │      mov    %rbx,%rdi
                    │      mov    %rbx,(%rdx)
                    │    → callq  rb_insert_color
                    │      mov    0x8(%rbp),%rdx
                    │      test   %rdx,%rdx
                    │    ↓ je     67
      
      From 'perf report' one can annotate and navigate to that 'rb_insert_color'
      function, but not directly from 'perf annotate timerqueue_add', that
      remains to be investigated and fixed.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jin Yao <yao.jin@linux.intel.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-nkktz6355rhqtq7o8atr8f8r@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4c9cb2c2
    • Arnaldo Carvalho de Melo's avatar
      perf top: Document --ignore-vmlinux · a8403912
      Arnaldo Carvalho de Melo authored
      We've had this since 2013, document it.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Cc: Willy Tarreau <w@1wt.eu>
      Fixes: fc2be696 ("perf symbols: Add new option --ignore-vmlinux for perf top")
      Link: https://lkml.kernel.org/n/tip-0jwfueooddwfsw9r603belxi@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a8403912
    • Jiri Olsa's avatar
      perf tools: Fix python extension build for gcc 8 · b7a313d8
      Jiri Olsa authored
      The gcc 8 compiler won't compile the python extension code with the
      following errors (one example):
      
        python.c:830:15: error: cast between incompatible  function types from              \
        ‘PyObject * (*)(struct pyrf_evsel *, PyObject *, PyObject *)’                       \
        uct _object * (*)(struct pyrf_evsel *, struct _object *, struct _object *)’} to     \
        ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _objeuct \
        _object *)’} [-Werror=cast-function-type]
           .ml_meth  = (PyCFunction)pyrf_evsel__open,
      
      The problem with the PyMethodDef::ml_meth callback is that its type is
      determined based on the PyMethodDef::ml_flags value, which we set as
      METH_VARARGS | METH_KEYWORDS.
      
      That indicates that the callback is expecting an extra PyObject* arg, and is
      actually PyCFunctionWithKeywords type, but the base PyMethodDef::ml_meth type
      stays PyCFunction.
      
      Previous gccs did not find this, gcc8 now does. Fixing this by silencing this
      warning for python.c build.
      
      Commiter notes:
      
      Do not do that for CC=clang, as it breaks the build in some clang
      versions, like the ones in fedora up to fedora27:
      
        fedora:25:error: unknown warning option '-Wno-cast-function-type'; did you mean '-Wno-bad-function-cast'? [-Werror,-Wunknown-warning-option]
        fedora:26:error: unknown warning option '-Wno-cast-function-type'; did you mean '-Wno-bad-function-cast'? [-Werror,-Wunknown-warning-option]
        fedora:27:error: unknown warning option '-Wno-cast-function-type'; did you mean '-Wno-bad-function-cast'? [-Werror,-Wunknown-warning-option]
        #
      
      those have:
      
        clang version 3.9.1 (tags/RELEASE_391/final)
      
      The one in rawhide accepts that:
      
        clang version 6.0.0 (tags/RELEASE_600/final)
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
      Link: http://lkml.kernel.org/r/20180319082902.4518-2-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b7a313d8
    • Jiri Olsa's avatar
      perf tools: Fix snprint warnings for gcc 8 · 77f18153
      Jiri Olsa authored
      With gcc 8 we get new set of snprintf() warnings that breaks the
      compilation, one example:
      
        tests/mem.c: In function ‘check’:
        tests/mem.c:19:48: error: ‘%s’ directive output may be truncated writing \
              up to 99 bytes into a region of size 89 [-Werror=format-truncation=]
          snprintf(failure, sizeof failure, "unexpected %s", out);
      
      The gcc docs says:
      
       To avoid the warning either use a bigger buffer or handle the
       function's return value which indicates whether or not its output
       has been truncated.
      
      Given that all these warnings are harmless, because the code either
      properly fails due to uncomplete file path or we don't care for
      truncated output at all, I'm changing all those snprintf() calls to
      scnprintf(), which actually 'checks' for the snprint return value so the
      gcc stays silent.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
      Link: http://lkml.kernel.org/r/20180319082902.4518-1-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      77f18153
    • Linus Torvalds's avatar
      Linux 4.16-rc6 · c698ca52
      Linus Torvalds authored
      c698ca52
  3. 18 Mar, 2018 5 commits
    • Linus Torvalds's avatar
      Merge branch 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 9e1909b9
      Linus Torvalds authored
      Pull x86/pti updates from Thomas Gleixner:
       "Another set of melted spectrum updates:
      
         - Iron out the last late microcode loading issues by actually
           checking whether new microcode is present and preventing the CPU
           synchronization to run into a timeout induced hang.
      
         - Remove Skylake C2 from the microcode blacklist according to the
           latest Intel documentation
      
         - Fix the VM86 POPF emulation which traps if VIP is set, but VIF is
           not. Enhance the selftests to catch that kind of issue
      
         - Annotate indirect calls/jumps for objtool on 32bit. This is not a
           functional issue, but for consistency sake its the right thing to
           do.
      
         - Fix a jump label build warning observed on SPARC64 which uses 32bit
           storage for the code location which is casted to 64 bit pointer w/o
           extending it to 64bit first.
      
         - Add two new cpufeature bits. Not really an urgent issue, but
           provides them for both x86 and x86/kvm work. No impact on the
           current kernel"
      
      * 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/microcode: Fix CPU synchronization routine
        x86/microcode: Attempt late loading only when new microcode is present
        x86/speculation: Remove Skylake C2 from Speculation Control microcode blacklist
        jump_label: Fix sparc64 warning
        x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32-bit kernels
        x86/vm86/32: Fix POPF emulation
        selftests/x86/entry_from_vm86: Add test cases for POPF
        selftests/x86/entry_from_vm86: Exit with 1 if we fail
        x86/cpufeatures: Add Intel PCONFIG cpufeature
        x86/cpufeatures: Add Intel Total Memory Encryption cpufeature
      9e1909b9
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · df4fe178
      Linus Torvalds authored
      Pull x86 fix from Thomas Gleixner:
       "A single fix for vmalloc_fault() which uses p*d_huge() unconditionally
        whether CONFIG_HUGETLBFS is set or not. In case of CONFIG_HUGETLBFS=n
        this results in a crash as p*d_huge() returns 0 in that case"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/mm: Fix vmalloc_fault to use pXd_large
      df4fe178
    • Linus Torvalds's avatar
      Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · d2149e13
      Linus Torvalds authored
      Pull irq fixes from Thomas Gleixner:
       "Three fixes for irq chip drivers:
      
         - Make sure the allocations in the GIC-V3 ITS driver are large enough
           to accomodate the interrupt space
      
         - Fix a misplaced __iomem annotation which causes a splat of 26
           sparse warnings
      
         - Remove an unused function in the IMX GPCV2 driver which causes
           build warnings"
      
      * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        irqchip/irq-imx-gpcv2: Remove unused function
        irqchip/gic-v3-its: Ensure nr_ites >= nr_lpis
        irqchip/gic-v3-its: Fix misplaced __iomem annotations
      d2149e13
    • Linus Torvalds's avatar
      Merge branch 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 23fe85ae
      Linus Torvalds authored
      Pull EFI fix from Thomas Gleixner:
       "A single fix to prevent partially initialized pointers in mixed mode
        (64bit kernel on 32bit UEFI)"
      
      * 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        efi/libstub/tpm: Initialize pointer variables to zero for mixed mode
      23fe85ae
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 3cd1d327
      Linus Torvalds authored
      Pull KVM fixes from Paolo Bonzini:
       "PPC:
         - fix bug leading to lost IPIs and smp_call_function_many() lockups
           on POWER9
      
        ARM:
         - locking fix
         - reset fix
         - GICv2 multi-source SGI injection fix
         - GICv2-on-v3 MMIO synchronization fix
         - make the console less verbose.
      
        x86:
         - fix device passthrough on AMD SME"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM: x86: Fix device passthrough when SME is active
        kvm: arm/arm64: vgic-v3: Tighten synchronization for guests using v2 on v3
        KVM: arm/arm64: vgic: Don't populate multiple LRs with the same vintid
        KVM: arm/arm64: Reduce verbosity of KVM init log
        KVM: arm/arm64: Reset mapped IRQs on VM reset
        KVM: arm/arm64: Avoid vcpu_load for other vcpu ioctls than KVM_RUN
        KVM: arm/arm64: vgic: Add missing irq_lock to vgic_mmio_read_pending
        KVM: PPC: Book3S HV: Fix trap number return from __kvmppc_vcore_entry
      3cd1d327
  4. 17 Mar, 2018 1 commit
    • John David Anglin's avatar
      parisc: Handle case where flush_cache_range is called with no context · 9ef0f88f
      John David Anglin authored
      Just when I had decided that flush_cache_range() was always called with
      a valid context, Helge reported two cases where the
      "BUG_ON(!vma->vm_mm->context);" was hit on the phantom buildd:
      
       kernel BUG at /mnt/sdb6/linux/linux-4.15.4/arch/parisc/kernel/cache.c:587!
       CPU: 1 PID: 3254 Comm: kworker/1:2 Tainted: G D 4.15.0-1-parisc64-smp #1 Debian 4.15.4-1+b1
       Workqueue: events free_ioctx
        IAOQ[0]: flush_cache_range+0x164/0x168
        IAOQ[1]: flush_cache_page+0x0/0x1c8
        RP(r2): unmap_page_range+0xae8/0xb88
       Backtrace:
        [<00000000404a6980>] unmap_page_range+0xae8/0xb88
        [<00000000404a6ae0>] unmap_single_vma+0xc0/0x188
        [<00000000404a6cdc>] zap_page_range_single+0x134/0x1f8
        [<00000000404a702c>] unmap_mapping_range+0x1cc/0x208
        [<0000000040461518>] truncate_pagecache+0x98/0x108
        [<0000000040461624>] truncate_setsize+0x9c/0xb8
        [<00000000405d7f30>] put_aio_ring_file+0x80/0x100
        [<00000000405d803c>] aio_free_ring+0x8c/0x290
        [<00000000405d82c0>] free_ioctx+0x80/0x180
        [<0000000040284e6c>] process_one_work+0x21c/0x668
        [<00000000402854c4>] worker_thread+0x20c/0x778
        [<0000000040291d44>] kthread+0x2d4/0x2e0
        [<0000000040204020>] end_fault_vector+0x20/0xc0
      
      This indicates that we need to handle the no context case in
      flush_cache_range() as we do in flush_cache_mm().
      
      In thinking about this, I realized that we don't need to flush the TLB
      when there is no context.  So, I added context checks to the large flush
      cases in flush_cache_mm() and flush_cache_range().  The large flush case
      occurs frequently in flush_cache_mm() and the change should improve fork
      performance.
      
      The v2 version of this change removes the BUG_ON from flush_cache_page()
      by skipping the TLB flush when there is no context.  I also added code
      to flush the TLB in flush_cache_mm() and flush_cache_range() when we
      have a context that's not current.  Now all three routines handle TLB
      flushes in a similar manner.
      Signed-off-by: default avatarJohn David Anglin <dave.anglin@bell.net>
      Cc: stable@vger.kernel.org # 4.9+
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      9ef0f88f
  5. 16 Mar, 2018 7 commits