1. 13 Apr, 2016 4 commits
    • Julia Lawall's avatar
      uprobes/x86: Constify uprobe_xol_ops structures · dac42987
      Julia Lawall authored
      The uprobe_xol_ops structures are never modified, so declare them as const.
      
      Done with the help of Coccinelle.
      Signed-off-by: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: kernel-janitors@vger.kernel.org
      Link: http://lkml.kernel.org/r/1460200649-32526-1-git-send-email-Julia.Lawall@lip6.frSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      dac42987
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo-20160411' of... · bed9441b
      Ingo Molnar authored
      Merge tag 'perf-core-for-mingo-20160411' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
      
      Pull perf/core improvements from Arnaldo Carvalho de Melo:
      
      User visible changes:
      
      - Automagically create a 'bpf-output' event, easing the setup of BPF
        C "scripts" that produce output via the perf ring buffer. Now it is
        just a matter of calling any perf tool, such as 'trace', with a C
        source file that references the __bpf_stdout__ output channel and
        that channel will be created and connected to the script:
      
        # trace -e nanosleep --event test_bpf_stdout.c usleep 1
          0.013 ( 0.013 ms): usleep/2818 nanosleep(rqtp: 0x7ffcead45f40                                        ) ...
          0.013 (         ): __bpf_stdout__:Raise a BPF event!..)
          0.015 (         ): perf_bpf_probe:func_begin:(ffffffff81112460))
          0.261 (         ): __bpf_stdout__:Raise a BPF event!..)
          0.262 (         ): perf_bpf_probe:func_end:(ffffffff81112460 <- ffffffff81003d92))
          0.264 ( 0.264 ms): usleep/2818  ... [continued]: nanosleep()) = 0
        #
      
        Further work is needed to reduce the number of lines in a perf bpf C source
        file, this being the part where we greatly reduce the command line setup (Wang Nan)
      
      - 'perf trace' now supports callchains, with 'trace --call-graph dwarf' using
        libunwind, just like 'perf top', to ask the kernel for stack dumps for CFI
        processing. This reduces the overhead by asking just for userspace callchains
        and also only for the syscall exit tracepoint (raw_syscalls:sys_exit)
        (Milian Wolff, Arnaldo Carvalho de Melo)
      
        Try it with, for instance:
      
           # perf trace --call dwarf ping 127.0.0.1
      
        An excerpt of a system wide 'perf trace --call dwarf" session is at:
      
         https://fedorapeople.org/~acme/perf/perf-trace--call-graph-dwarf--all-cpus.txt
      
        You may need to bump the number of mmap pages, using -m/--mmap-pages,
        but on a Broadwell machine the defaults allowed system wide tracing to
        work without losing that many records, experiment with just some
        syscalls, like:
      
          # perf trace --call dwarf -e nanosleep,futex
      
        All the targets available for 'perf record', 'perf top' (--pid, --tid, --cpu,
        etc) should work. Also --duration may be interesting to try.
      
        To get filenames from in various syscalls pointer args (open, ettc), add this
        to the mix:
      
        # perf probe 'vfs_getname=getname_flags:72 pathname=filename:string'
      
        Making this work is next in line:
      
           # trace --call dwarf --ev sched:sched_switch/call-graph=fp/ usleep 1
      
        I.e. honouring per-tracepoint callchains in 'perf trace' in addition to
        in raw_syscalls:sys_exit.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      bed9441b
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo-20160408' of... · aeaae7d6
      Ingo Molnar authored
      Merge tag 'perf-core-for-mingo-20160408' 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:
      
      User visible changes:
      
      - Beautify more syscall arguments in 'perf trace', using the type column in
        tracepoint /format fields to attach, for instance, a pid_t resolver to the
        thread COMM, also attach a mode_t beautifier in the same fashion
        (Arnaldo Carvalho de Melo)
      
      - Build the syscall table id <-> name resolver using the same .tbl file
        used in the kernel to generate headers, to avoid the delay in getting
        new syscalls supported in the audit-libs external dependency, done so
        far only for x86_64 (Arnaldo Carvalho de Melo)
      
      - Improve the documentation of event specifications (Andi Kleen)
      
      - Process update events in 'perf script', fixing up this use case:
      
          # perf stat -a -I 1000 -e cycles record | perf script -s script.py
      
      - Shared object symbol adjustment fixes, fixing symbol resolution in
        Android (Wang Nan)
      
      Infrastructure changes:
      
      - Add dedicated unwind addr_space member into thread struct, to allow
        tools to use thread->priv, noticed while working on having callchains
        in 'perf trace' (Jiri Olsa)
      
      Build fixes:
      
      - Fix the build in Ubuntu 12.04 (Arnaldo Carvalho de Melo, Vinson Lee)
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      aeaae7d6
    • Ingo Molnar's avatar
      889fac6d
  2. 12 Apr, 2016 14 commits
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Print unresolved symbol names as addresses · 00768a2b
      Arnaldo Carvalho de Melo authored
      Instead of having "[unknown]" as the name used for unresolved symbols,
      use the address in the callchain, in hexadecimal form:
      
        28.801 ( 0.007 ms): qemu-system-x8/10065 ppoll(ufds: 0x55c98b39e400, nfds: 72, tsp: 0x7fffe4e4fe60, sigsetsize: 8) = 0 Timeout
                                           ppoll+0x91 (/usr/lib64/libc-2.22.so)
                                           [0x337309] (/usr/bin/qemu-system-x86_64)
                                           [0x336ab4] (/usr/bin/qemu-system-x86_64)
                                           main+0x1724 (/usr/bin/qemu-system-x86_64)
                                           __libc_start_main+0xf0 (/usr/lib64/libc-2.22.so)
                                           [0xc59a9] (/usr/bin/qemu-system-x86_64)
        35.265 (14.805 ms): gnome-shell/2287  ... [continued]: poll()) = 1
                                           [0xf6fdd] (/usr/lib64/libc-2.22.so)
                                           g_main_context_iterate.isra.29+0x17c (/usr/lib64/libglib-2.0.so.0.4600.2)
                                           g_main_loop_run+0xc2 (/usr/lib64/libglib-2.0.so.0.4600.2)
                                           meta_run+0x2c (/usr/lib64/libmutter.so.0.0.0)
                                           main+0x3f7 (/usr/bin/gnome-shell)
                                           __libc_start_main+0xf0 (/usr/lib64/libc-2.22.so)
                                           [0x2909] (/usr/bin/gnome-shell)
      Suggested-by: default avatarMilian Wolff <milian.wolff@kdab.com>
      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: http://lkml.kernel.org/n/tip-fja1ods5vqpg42mdz09xcz3r@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      00768a2b
    • Arnaldo Carvalho de Melo's avatar
      perf evsel: Allow unresolved symbol names to be printed as addresses · fd4be130
      Arnaldo Carvalho de Melo authored
      The fprintf_sym() and fprintf_callchain() methods now allow users to
      change the existing behaviour of showing "[unknown]" as the name of
      unresolved symbols to instead show "[0x123456]", i.e. its address.
      
      The current patch doesn't change tools to use this facility, the results
      from 'perf trace' and 'perf script' cotinue like:
      
      70.109 ( 0.001 ms): qemu-system-x8/10153 poll(ufds: 0x7f2d93ffe870, nfds: 1) = 0 Timeout
                                         [unknown] (/usr/lib64/libc-2.22.so)
                                         [unknown] (/usr/lib64/libspice-server.so.1.10.0)
                                         [unknown] (/usr/lib64/libspice-server.so.1.10.0)
                                         [unknown] (/usr/lib64/libspice-server.so.1.10.0)
                                         start_thread+0xca (/usr/lib64/libpthread-2.22.so)
                                         __clone+0x6d (/usr/lib64/libc-2.22.so)
      
      The next patch will make 'perf trace' use the new formatting.
      Suggested-by: default avatarMilian Wolff <milian.wolff@kdab.com>
      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: http://lkml.kernel.org/n/tip-fja1ods5vqpg42mdz09xcz3r@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fd4be130
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Make "--call-graph" affect just "raw_syscalls:sys_exit" · fde54b78
      Arnaldo Carvalho de Melo authored
      We don't need the callchains at the syscall enter tracepoint, just when
      finishing it at syscall exit, so reduce the overhead by asking for
      callchains just at syscall exit.
      Suggested-by: default avatarMilian Wolff <milian.wolff@kdab.com>
      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: http://lkml.kernel.org/n/tip-fja1ods5vqpg42mdz09xcz3r@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fde54b78
    • Arnaldo Carvalho de Melo's avatar
      perf evsel: Rename config_callgraph() to config_callchain() and make it public · 01e0d50c
      Arnaldo Carvalho de Melo authored
      The rename is for consistency with the parameter name.
      
      Make it public for fine grained control of which evsels should have
      callchains enabled, like, for instance, will be done in the next
      changesets in 'perf trace', to enable callchains just on the
      "raw_syscalls:sys_exit" tracepoint.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Milian Wolff <milian.wolff@kdab.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-og8vup111rn357g4yagus3ao@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      01e0d50c
    • Arnaldo Carvalho de Melo's avatar
      perf evlist: Add (reset,set)_sample_bit methods · 22c8a376
      Arnaldo Carvalho de Melo authored
      For fiddling with sample_type fields in all evsels in an evlist.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Milian Wolff <milian.wolff@kdab.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-dg6yavctt0hzl2tsgfb43qsr@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      22c8a376
    • Arnaldo Carvalho de Melo's avatar
      perf evsel: Do not use globals in config() · e68ae9cf
      Arnaldo Carvalho de Melo authored
      Instead receive a callchain_param pointer to configure callchain
      aspects, not doing so if NULL is passed.
      
      This will allow fine grained control over which evsels in an evlist
      gets callchains enabled.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Milian Wolff <milian.wolff@kdab.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-2mupip6khc92mh5x4nw9to82@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e68ae9cf
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Exclude the kernel part of the callchain leading to a syscall · 44621819
      Arnaldo Carvalho de Melo authored
      The kernel parts are not that useful:
      
        # trace -m 512 -e nanosleep --call dwarf  usleep 1
           0.065 ( 0.065 ms): usleep/18732 nanosleep(rqtp: 0x7ffc4ee4e200) = 0
                                             syscall_slow_exit_work ([kernel.kallsyms])
                                             do_syscall_64 ([kernel.kallsyms])
                                             return_from_SYSCALL_64 ([kernel.kallsyms])
                                             __nanosleep (/usr/lib64/libc-2.22.so)
                                             usleep (/usr/lib64/libc-2.22.so)
                                             main (/usr/bin/usleep)
                                             __libc_start_main (/usr/lib64/libc-2.22.so)
                                             _start (/usr/bin/usleep)
        #
      
      So lets just use perf_event_attr.exclude_callchain_kernel to avoid
      collecting it in the ring buffer:
      
        # trace -m 512 -e nanosleep --call dwarf  usleep 1
           0.063 ( 0.063 ms): usleep/19212 nanosleep(rqtp: 0x7ffc3df10fb0) = 0
                                             __nanosleep (/usr/lib64/libc-2.22.so)
                                             usleep (/usr/lib64/libc-2.22.so)
                                             main (/usr/bin/usleep)
                                             __libc_start_main (/usr/lib64/libc-2.22.so)
                                             _start (/usr/bin/usleep)
        #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Milian Wolff <milian.wolff@kdab.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-qctu3gqhpim0dfbcp9d86c91@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      44621819
    • Arnaldo Carvalho de Melo's avatar
      perf evsel: Introduce fprintf_callchain() method out of fprintf_sym() · ea453965
      Arnaldo Carvalho de Melo authored
      In 'perf trace' we're just interested in printing callchains, and we
      don't want to use the symbol_conf.use_callchain, so move the callchain
      part to a new method.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Milian Wolff <milian.wolff@kdab.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-kcn3romzivcpxb3u75s9nz33@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ea453965
    • Arnaldo Carvalho de Melo's avatar
      perf evsel: Rename print_ip() to fprintf_sym() · ff0c1078
      Arnaldo Carvalho de Melo authored
      As it receives a FILE, and its more than just the IP, which can even be
      requested not to be printed.
      
      For consistency with other similar methods in tools/perf/, name it as
      perf_evsel__fprintf_sym() and make it return the number of bytes
      printed, just like 'fprintf(3)'
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Milian Wolff <milian.wolff@kdab.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-84gawlqa3lhk63nf0t9vnqnn@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ff0c1078
    • Milian Wolff's avatar
      perf trace: Add support for printing call chains on sys_exit events. · 566a0885
      Milian Wolff authored
      Now, one can print the call chain for every encountered sys_exit event,
      e.g.:
      
          $ perf trace -e nanosleep --call-graph dwarf path/to/ex_sleep
          1005.757 (1000.090 ms): ex_sleep/13167 nanosleep(...) = 0
                                                   syscall_slow_exit_work ([kernel.kallsyms])
                                                   syscall_return_slowpath ([kernel.kallsyms])
                                                   int_ret_from_sys_call ([kernel.kallsyms])
                                                   __nanosleep (/usr/lib/libc-2.23.so)
                                                   [unknown] (/usr/lib/libQt5Core.so.5.6.0)
                                                   QThread::sleep (/usr/lib/libQt5Core.so.5.6.0)
                                                   main (path/to/ex_sleep)
                                                   __libc_start_main (/usr/lib/libc-2.23.so)
                                                   _start (path/to/ex_sleep)
      
      Note that it is advised to increase the number of mmap pages to prevent
      event losses when using this new feature. Often, adding `-m 10M` to the
      `perf trace` invocation is enough.
      
      This feature is also available in strace when built with libunwind via
      `strace -k`. Performance wise, this solution is much better:
      
          $ time find path/to/linux &> /dev/null
      
          real    0m0.051s
          user    0m0.013s
          sys     0m0.037s
      
          $ time perf trace -m 800M --call-graph dwarf find path/to/linux &> /dev/null
      
          real    0m2.624s
          user    0m1.203s
          sys     0m1.333s
      
          $ time strace -k find path/to/linux  &> /dev/null
      
          real    0m35.398s
          user    0m10.403s
          sys     0m23.173s
      
      Note that it is currently not possible to configure the print output.
      Adding such a feature, similar to what is available in `perf script` via
      its `--fields` knob can be added later on.
      Signed-off-by: default avatarMilian Wolff <milian.wolff@kdab.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      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>
      LPU-Reference: 1460115255-17648-1-git-send-email-milian.wolff@kdab.com
      [ Split from a larger patch, do not print the IP, left align,
        remove dup call symbol__init(), added man page entry ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      566a0885
    • Arnaldo Carvalho de Melo's avatar
      perf evsel: Allow passing a left alignment when printing a symbol · db3617f3
      Arnaldo Carvalho de Melo authored
      For callchains, etc where we want it to align just below the syscall
      name, for instance, in 'perf trace'
      
      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: http://lkml.kernel.org/n/tip-uk9ekchd67651c625ltaur5y@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      db3617f3
    • Milian Wolff's avatar
      perf evsel: Allow specifying a file to output in perf_evsel__print_ip · 6186de9a
      Milian Wolff authored
      As this function will be used in 'perf trace'.
      
      Cc: Jiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/n/tip-8x297v9utnxq77onikevvlse@git.kernel.org
      [ Split from a larger patch ]
      Signed-off-by: default avatarMilian Wolff <milian.wolff@kdab.com>
      6186de9a
    • Wang Nan's avatar
      perf bpf: Automatically create bpf-output event __bpf_stdout__ · 72c08098
      Wang Nan authored
      This patch removes the need to set a bpf-output event in cmdline.  By
      referencing a map named '__bpf_stdout__', perf automatically creates an
      event for it.
      
      For example:
      
        # perf record -e ./test_bpf_trace.c usleep 100000
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.012 MB perf.data (2 samples) ]
        # perf script
                 usleep  4639 [000] 261895.307826:        0            __bpf_stdout__:  ffffffff810eb9a1 ...
             BPF output: 0000: 52 61 69 73 65 20 61 20  Raise a
                         0008: 42 50 46 20 65 76 65 6e  BPF even
                         0010: 74 21 00 00              t!..
             BPF string: "Raise a BPF event!"
      
                 usleep  4639 [000] 261895.407883:        0            __bpf_stdout__:  ffffffff8105d609 ...
             BPF output: 0000: 52 61 69 73 65 20 61 20  Raise a
                         0008: 42 50 46 20 65 76 65 6e  BPF even
                         0010: 74 21 00 00              t!..
             BPF string: "Raise a BPF event!"
      
        perf record -e ./test_bpf_trace.c usleep 100000
      
        equals to:
      
        perf record -e bpf-output/no-inherit=1,name=__bpf_stdout__/ \
                    -e ./test_bpf_trace.c/map:__bpf_stdout__.event=__bpf_stdout__/ \
                    usleep 100000
      
      Where test_bpf_trace.c is:
      
        /************************ BEGIN **************************/
        #include <uapi/linux/bpf.h>
        struct bpf_map_def {
               unsigned int type;
               unsigned int key_size;
               unsigned int value_size;
               unsigned int max_entries;
        };
        #define SEC(NAME) __attribute__((section(NAME), used))
        static u64 (*ktime_get_ns)(void) =
               (void *)BPF_FUNC_ktime_get_ns;
        static int (*trace_printk)(const char *fmt, int fmt_size, ...) =
               (void *)BPF_FUNC_trace_printk;
        static int (*get_smp_processor_id)(void) =
               (void *)BPF_FUNC_get_smp_processor_id;
        static int (*perf_event_output)(void *, struct bpf_map_def *, int, void *, unsigned long) =
               (void *)BPF_FUNC_perf_event_output;
      
        struct bpf_map_def SEC("maps") __bpf_stdout__ = {
               .type = BPF_MAP_TYPE_PERF_EVENT_ARRAY,
               .key_size = sizeof(int),
               .value_size = sizeof(u32),
               .max_entries = __NR_CPUS__,
        };
      
        static inline int __attribute__((always_inline))
        func(void *ctx, int type)
        {
      	char output_str[] = "Raise a BPF event!";
      	char err_str[] = "BAD %d\n";
      	int err;
      
              err = perf_event_output(ctx, &__bpf_stdout__, get_smp_processor_id(),
      			        &output_str, sizeof(output_str));
      	if (err)
      		trace_printk(err_str, sizeof(err_str), err);
              return 1;
        }
        SEC("func_begin=sys_nanosleep")
        int func_begin(void *ctx) {return func(ctx, 1);}
        SEC("func_end=sys_nanosleep%return")
        int func_end(void *ctx) { return func(ctx, 2);}
        char _license[] SEC("license") = "GPL";
        int _version SEC("version") = LINUX_VERSION_CODE;
        /************************* END ***************************/
      
      Committer note:
      
      Testing with 'perf trace':
      
        # trace -e nanosleep --ev test_bpf_stdout.c usleep 1
           0.007 ( 0.007 ms): usleep/729 nanosleep(rqtp: 0x7ffc5bbc5fe0) ...
           0.007 (         ): __bpf_stdout__:Raise a BPF event!..)
           0.008 (         ): perf_bpf_probe:func_begin:(ffffffff81112460))
           0.069 (         ): __bpf_stdout__:Raise a BPF event!..)
           0.070 (         ): perf_bpf_probe:func_end:(ffffffff81112460 <- ffffffff81003d92))
           0.072 ( 0.072 ms): usleep/729  ... [continued]: nanosleep()) = 0
        #
      Suggested-and-Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1460128045-97310-5-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      72c08098
    • Wang Nan's avatar
      perf bpf: Clone bpf stdout events in multiple bpf scripts · d7888573
      Wang Nan authored
      This patch allows cloning bpf-output event configuration among multiple
      bpf scripts. If there exist a map named '__bpf_output__' and not
      configured using 'map:__bpf_output__.event=', this patch clones the
      configuration of another '__bpf_stdout__' map. For example, following
      command:
      
        # perf trace --ev bpf-output/no-inherit,name=evt/ \
                     --ev ./test_bpf_trace.c/map:__bpf_stdout__.event=evt/ \
                     --ev ./test_bpf_trace2.c usleep 100000
      
      equals to:
      
        # perf trace --ev bpf-output/no-inherit,name=evt/ \
                     --ev ./test_bpf_trace.c/map:__bpf_stdout__.event=evt/  \
                     --ev ./test_bpf_trace2.c/map:__bpf_stdout__.event=evt/ \
                     usleep 100000
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Suggested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1460128045-97310-4-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d7888573
  3. 11 Apr, 2016 4 commits
  4. 10 Apr, 2016 1 commit
    • Linus Torvalds's avatar
      Revert "ext4: allow readdir()'s of large empty directories to be interrupted" · 9f2394c9
      Linus Torvalds authored
      This reverts commit 1028b55b.
      
      It's broken: it makes ext4 return an error at an invalid point, causing
      the readdir wrappers to write the the position of the last successful
      directory entry into the position field, which means that the next
      readdir will now return that last successful entry _again_.
      
      You can only return fatal errors (that terminate the readdir directory
      walk) from within the filesystem readdir functions, the "normal" errors
      (that happen when the readdir buffer fills up, for example) happen in
      the iterorator where we know the position of the actual failing entry.
      
      I do have a very different patch that does the "signal_pending()"
      handling inside the iterator function where it is allowable, but while
      that one passes all the sanity checks, I screwed up something like four
      times while emailing it out, so I'm not going to commit it today.
      
      So my track record is not good enough, and the stars will have to align
      better before that one gets committed.  And it would be good to get some
      review too, of course, since celestial alignments are always an iffy
      debugging model.
      
      IOW, let's just revert the commit that caused the problem for now.
      Reported-by: default avatarGreg Thelen <gthelen@google.com>
      Cc: Theodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9f2394c9
  5. 09 Apr, 2016 15 commits
    • Linus Torvalds's avatar
      Merge branch 'parisc-4.6-3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux · 5b5b7fd1
      Linus Torvalds authored
      Pull parisc fixes from Helge Deller:
       "Since commit 0de79858 ("parisc: Use generic extable search and
        sort routines") module loading is boken on parisc, because the parisc
        module loader wasn't prepared for the new R_PARISC_PCREL32 relocations.
      
        In addition, due to that breakage, Mikulas Patocka noticed that
        handling exceptions from modules probably never worked on parisc.  It
        was just masked by the fact that exceptions from modules don't happen
        during normal use.
      
        This patch series fixes those issues and survives the tests of the
        lib/test_user_copy kernel module test.  Some patches are tagged for
        stable"
      
      * 'parisc-4.6-3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
        parisc: Update comment regarding relative extable support
        parisc: Unbreak handling exceptions from kernel modules
        parisc: Fix kernel crash with reversed copy_from_user()
        parisc: Avoid function pointers for kernel exception routines
        parisc: Handle R_PARISC_PCREL32 relocations in kernel modules
      5b5b7fd1
    • Linus Torvalds's avatar
      Merge branch 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm · 239467e8
      Linus Torvalds authored
      Pull libnvdimm fixes from Dan Williams:
       "Three fixes, the first two are tagged for -stable:
      
         - The ndctl utility/library gained expanded unit tests illuminating a
           long standing bug in the libnvdimm SMART data retrieval
           implementation.
      
           It has been broken since its initial implementation, now fixed.
      
         - Another one line fix for the detection of stale info blocks.
      
           Without this change userspace can get into a situation where it is
           unable to reconfigure a namespace.
      
         - Fix the badblock initialization path in the presence of the new (in
           v4.6-rc1) section alignment workarounds.
      
           Without this change badblocks will be reported at the wrong offset.
      
        These have received a build success report from the kbuild robot and
        have appeared in -next with no reported issues"
      
      * 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
        libnvdimm, pfn: fix nvdimm_namespace_add_poison() vs section alignment
        libnvdimm, pfn: fix uuid validation
        libnvdimm: fix smart data retrieval
      239467e8
    • Linus Torvalds's avatar
      Merge tag 'gpio-v4.6-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio · 289b7bfd
      Linus Torvalds authored
      Pull GPIO fixes from Linus Walleij:
       "Here is a set of four GPIO fixes.  The two fixes to the core are
        serious as they are regressing minor architectures.
      
        Core fixes:
      
         - Defer GPIO device setup until after gpiolib is initialized.
      
           It turns out that a few very tightly integrated GPIO platform
           drivers initialize so early (befor core_initcall()) so that the
           gpiolib isn't even initialized itself.  That limits what the
           library can do, and we cannot reference uninitialized fields until
           later.
      
           Defer some of the initialization until right after the gpiolib is
           initialized in these (rare) cases.
      
         - As a consequence: do not use devm_* resources when allocating the
           states in the initial set-up of the gpiochip.
      
        Driver fixes:
      
         - In ACPI retrieveal: ignore GpioInt when looking for output GPIOs.
      
         - Fix legacy builds on the PXA without a backing pin controller.
      
         - Use correct datatype on pca953x register writes"
      
      * tag 'gpio-v4.6-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
        gpio: pca953x: Use correct u16 value for register word write
        gpiolib: Defer gpio device setup until after gpiolib initialization
        gpiolib: Do not use devm functions when registering gpio chip
        gpio: pxa: fix legacy non pinctrl aware builds
        gpio / ACPI: ignore GpioInt() GPIOs when requesting GPIO_OUT_*
      289b7bfd
    • Linus Torvalds's avatar
      Merge tag 'tty-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty · 183c948a
      Linus Torvalds authored
      Pull tty fixes from Greg KH:
       "Here are two tty fixes for issues found.
      
        One was due to a merge error in 4.6-rc1, and the other a regression
        fix for UML consoles that broke in 4.6-rc1.
      
        Both have been in linux-next for a while"
      
      * tag 'tty-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
        tty: Fix merge of "tty: Refactor tty_open()"
        tty: Fix UML console breakage
      183c948a
    • Linus Torvalds's avatar
      Merge tag 'usb-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · ffb927d1
      Linus Torvalds authored
      Pull USB fixes from Greg KH:
       "Here are some USB fixes and new device ids for 4.6-rc3.
      
        Nothing major, the normal USB gadget fixes and usb-serial driver ids,
        along with some other fixes mixed in.  All except the USB serial ids
        have been tested in linux-next, the id additions should be fine as
        they are 'trivial'"
      
      * tag 'usb-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (25 commits)
        USB: option: add "D-Link DWM-221 B1" device id
        USB: serial: cp210x: Adding GE Healthcare Device ID
        USB: serial: ftdi_sio: Add support for ICP DAS I-756xU devices
        usb: dwc3: keystone: drop dma_mask configuration
        usb: gadget: udc-core: remove manual dma configuration
        usb: dwc3: pci: add ID for one more Intel Broxton platform
        usb: renesas_usbhs: fix to avoid using a disabled ep in usbhsg_queue_done()
        usb: dwc2: do not override forced dr_mode in gadget setup
        usb: gadget: f_midi: unlock on error
        USB: digi_acceleport: do sanity checking for the number of ports
        USB: cypress_m8: add endpoint sanity check
        USB: mct_u232: add sanity checking in probe
        usb: fix regression in SuperSpeed endpoint descriptor parsing
        USB: usbip: fix potential out-of-bounds write
        usb: renesas_usbhs: disable TX IRQ before starting TX DMAC transfer
        usb: renesas_usbhs: avoid NULL pointer derefernce in usbhsf_pkt_handler()
        usb: gadget: f_midi: Fixed a bug when buflen was smaller than wMaxPacketSize
        usb: phy: qcom-8x16: fix regulator API abuse
        usb: ch9: Fix SSP Device Cap wFunctionalitySupport type
        usb: gadget: composite: Access SSP Dev Cap fields properly
        ...
      ffb927d1
    • Linus Torvalds's avatar
      Merge tag 'staging-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · c6e6e58c
      Linus Torvalds authored
      Pull staging and IIO driver fixes from Greg KH:
       "Here are some IIO driver fixes, along with two staging driver fixes
        for 4.6-rc3.
      
        One staging driver patch reverts the deletion of a driver that
        happened in 4.6-rc1.  We thought that laptop.org was dead, but it's
        still alive and kicking, and has users that were mad we broke their
        hardware by deleting a driver for their machines.  So that driver is
        added back and everyone is happy again.
      
        All of these have been in linux-next for a while with no reported
        issues"
      
      * tag 'staging-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
        Revert "Staging: olpc_dcon: Remove obsolete driver"
        staging/rdma/hfi1: select CRC32
        iio: gyro: bmg160: fix buffer read values
        iio: gyro: bmg160: fix endianness when reading axes
        iio: accel: bmc150: fix endianness when reading axes
        iio: st_magn: always define ST_MAGN_TRIGGER_SET_STATE
        iio: fix config watermark initial value
        iio: health: max30100: correct FIFO check condition
        iio: imu: Fix inv_mpu6050 dependencies
        iio: adc: Fix build error of missing devm_ioremap_resource on UM
        iio: light: apds9960: correct FIFO check condition
        iio: adc: max1363: correct reference voltage
        iio: adc: max1363: add missing adc to max1363_id
      c6e6e58c
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · fb41b4be
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "This is a set of eight fixes.
      
        Two are trivial gcc-6 updates (brace additions and unused variable
        removal).  There's a couple of cxlflash regressions, a correction for
        sd being overly chatty on revalidation (causing excess log increases).
        A VPD issue which could crash USB devices because they seem very
        intolerant to VPD inquiries, an ALUA deadlock fix and a mpt3sas buffer
        overrun fix"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: Do not attach VPD to devices that don't support it
        sd: Fix excessive capacity printing on devices with blocks bigger than 512 bytes
        scsi_dh_alua: Fix a recently introduced deadlock
        scsi: Declare local symbols static
        cxlflash: Move to exponential back-off when cmd_room is not available
        cxlflash: Fix regression issue with re-ordering patch
        mpt3sas: Don't overreach ioc->reply_post[] during initialization
        aacraid: add missing curly braces
      fb41b4be
    • Linus Torvalds's avatar
      Merge tag 'md/4.6-rc2-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/shli/md · 63b106a8
      Linus Torvalds authored
      Pull MD fixes from Shaohua Li:
       "This update mainly fixes bugs:
      
         - fix error handling (Guoqing)
         - fix a crash when a disk is hotremoved (me)
         - fix a dead loop (Wei Fang)"
      
      * tag 'md/4.6-rc2-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/shli/md:
        md/bitmap: clear bitmap if bitmap_create failed
        MD: add rdev reference for super write
        md: fix a trivial typo in comments
        md:raid1: fix a dead loop when read from a WriteMostly disk
      63b106a8
    • Linus Torvalds's avatar
      Merge tag 'pm+acpi-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 40bca9db
      Linus Torvalds authored
      Pull power management and ACPI fixes from Rafael Wysocki:
       "Fixes for some issues discovered after recent changes and for some
        that have just been found lately regardless of those changes
        (intel_pstate, intel_idle, PM core, mailbox/pcc, turbostat) plus
        support for some new CPU models (intel_idle, Intel RAPL driver,
        turbostat) and documentation updates (intel_pstate, PM core).
      
        Specifics:
      
         - intel_pstate fixes for two issues exposed by the recent switch over
           from using timers and for one issue introduced during the 4.4 cycle
           plus new comments describing data structures used by the driver
           (Rafael Wysocki, Srinivas Pandruvada).
      
         - intel_idle fixes related to CPU offline/online (Richard Cochran).
      
         - intel_idle support (new CPU IDs and state definitions mostly) for
           Skylake-X and Kabylake processors (Len Brown).
      
         - PCC mailbox driver fix for an out-of-bounds memory access that may
           cause the kernel to panic() (Shanker Donthineni).
      
         - New (missing) CPU ID for one apparently overlooked Haswell model in
           the Intel RAPL power capping driver (Srinivas Pandruvada).
      
         - Fix for the PM core's wakeup IRQs framework to make it work after
           wakeup settings reconfiguration from sysfs (Grygorii Strashko).
      
         - Runtime PM documentation update to make it describe what needs to
           be done during device removal more precisely (Krzysztof Kozlowski).
      
         - Stale comment removal cleanup in the cpufreq-dt driver (Viresh
           Kumar).
      
         - turbostat utility fixes and support for Broxton, Skylake-X and
           Kabylake processors (Len Brown)"
      
      * tag 'pm+acpi-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (28 commits)
        PM / wakeirq: fix wakeirq setting after wakup re-configuration from sysfs
        tools/power turbostat: work around RC6 counter wrap
        tools/power turbostat: initial KBL support
        tools/power turbostat: initial SKX support
        tools/power turbostat: decode BXT TSC frequency via CPUID
        tools/power turbostat: initial BXT support
        tools/power turbostat: print IRTL MSRs
        tools/power turbostat: SGX state should print only if --debug
        intel_idle: Add KBL support
        intel_idle: Add SKX support
        intel_idle: Clean up all registered devices on exit.
        intel_idle: Propagate hot plug errors.
        intel_idle: Don't overreact to a cpuidle registration failure.
        intel_idle: Setup the timer broadcast only on successful driver load.
        intel_idle: Avoid a double free of the per-CPU data.
        intel_idle: Fix dangling registration on error path.
        intel_idle: Fix deallocation order on the driver exit path.
        intel_idle: Remove redundant initialization calls.
        intel_idle: Fix a helper function's return value.
        intel_idle: remove useless return from void function.
        ...
      40bca9db
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 9ef11ceb
      Linus Torvalds authored
      Pull networking fixes from David Miller:
      
       1) Stale SKB data pointer access across pskb_may_pull() calls in L2TP,
          from Haishuang Yan.
      
       2) Fix multicast frame handling in mac80211 AP code, from Felix
          Fietkau.
      
       3) mac80211 station hashtable insert errors not handled properly, fix
          from Johannes Berg.
      
       4) Fix TX descriptor count limit handling in e1000, from Alexander
          Duyck.
      
       5) Revert a buggy netdev refcount fix in netpoll, from Bjorn Helgaas.
      
       6) Must assign rtnl_link_ops of the device before registering it, fix
          in ip6_tunnel from Thadeu Lima de Souza Cascardo.
      
       7) Memory leak fix in tc action net exit, from WANG Cong.
      
       8) Add missing AF_KCM entries to name tables, from Dexuan Cui.
      
       9) Fix regression in GRE handling of csums wrt.  FOU, from Alexander
          Duyck.
      
      10) Fix memory allocation alignment and congestion map corruption in
          RDS, from Shamir Rabinovitch.
      
      11) Fix default qdisc regression in tuntap driver, from Jason Wang.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (44 commits)
        bridge, netem: mark mailing lists as moderated
        tuntap: restore default qdisc
        mpls: find_outdev: check for err ptr in addition to NULL check
        ipv6: Count in extension headers in skb->network_header
        RDS: fix congestion map corruption for PAGE_SIZE > 4k
        RDS: memory allocated must be align to 8
        GRE: Disable segmentation offloads w/ CSUM and we are encapsulated via FOU
        net: add the AF_KCM entries to family name tables
        MAINTAINERS: intel-wired-lan list is moderated
        lib/test_bpf: Add additional BPF_ADD tests
        lib/test_bpf: Add test to check for result of 32-bit add that overflows
        lib/test_bpf: Add tests for unsigned BPF_JGT
        lib/test_bpf: Fix JMP_JSET tests
        VSOCK: Detach QP check should filter out non matching QPs.
        stmmac: fix adjust link call in case of a switch is attached
        af_packet: tone down the Tx-ring unsupported spew.
        net_sched: fix a memory leak in tc action
        samples/bpf: Enable powerpc support
        samples/bpf: Use llc in PATH, rather than a hardcoded value
        samples/bpf: Fix build breakage with map_perf_test_user.c
        ...
      9ef11ceb
    • Linus Torvalds's avatar
      Merge branch 'for-linus-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs · 839a3f76
      Linus Torvalds authored
      Pull btrfs fixes from Chris Mason:
       "These are bug fixes, including a really old fsync bug, and a few trace
        points to help us track down problems in the quota code"
      
      * 'for-linus-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
        Btrfs: fix file/data loss caused by fsync after rename and new inode
        btrfs: Reset IO error counters before start of device replacing
        btrfs: Add qgroup tracing
        Btrfs: don't use src fd for printk
        btrfs: fallback to vmalloc in btrfs_compare_tree
        btrfs: handle non-fatal errors in btrfs_qgroup_inherit()
        btrfs: Output more info for enospc_debug mount option
        Btrfs: fix invalid reference in replace_path
        Btrfs: Improve FL_KEEP_SIZE handling in fallocate
      839a3f76
    • Linus Torvalds's avatar
      Merge tag 'for-linus-4.6-ofs1' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux · 67592126
      Linus Torvalds authored
      Pull orangefs fixes from Mike Marshall:
       "Orangefs cleanups and a strncpy vulnerability fix.
      
        Cleanups:
         - remove an unused variable from orangefs_readdir.
         - clean up printk wrapper used for ofs "gossip" debugging.
         - clean up truncate ctime and mtime setting in inode.c
         - remove a useless null check found by coccinelle.
         - optimize some memcpy/memset boilerplate code.
         - remove some useless sanity checks from xattr.c
      
        Fix:
         - fix a potential strncpy vulnerability"
      
      * tag 'for-linus-4.6-ofs1' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux:
        orangefs: remove unused variable
        orangefs: Add KERN_<LEVEL> to gossip_<level> macros
        orangefs: strncpy -> strscpy
        orangefs: clean up truncate ctime and mtime setting
        Orangefs: fix ifnullfree.cocci warnings
        Orangefs: optimize boilerplate code.
        Orangefs: xattr.c cleanup
      67592126
    • Linus Torvalds's avatar
      Merge tag 'iommu-fixes-v4.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu · 1a59c539
      Linus Torvalds authored
      Pull IOMMU fixes from Joerg Roedel:
      
       - compile-time fixes (warnings and failures)
      
       - a bug in iommu core code which could cause the group->domain pointer
         to be falsly cleared
      
       - fix in scatterlist handling of the ARM common DMA-API code
      
       - stall detection fix for the Rockchip IOMMU driver
      
      * tag 'iommu-fixes-v4.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
        iommu/vt-d: Silence an uninitialized variable warning
        iommu/rockchip: Fix "is stall active" check
        iommu: Don't overwrite domain pointer when there is no default_domain
        iommu/dma: Restore scatterlist offsets correctly
        iommu: provide of_xlate pointer unconditionally
      1a59c539
    • Wolfram Sang's avatar
      i2c: jz4780: really prevent potential division by zero · caf28080
      Wolfram Sang authored
      Make sure we avoid a division-by-zero OOPS in case clock-frequency is
      set too low in DT. Add missing '\n' while we are here.
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      Acked-by: default avatarAxel Lin <axel.lin@ingics.com>
      caf28080
    • Wolfram Sang's avatar
      Revert "i2c: jz4780: prevent potential division by zero" · 4ececb7d
      Wolfram Sang authored
      This reverts commit 34cf2acd. 'ret' is
      not set when bailing out. Also, there is a better place to check for 0.
      Reported-by: default avatarAxel Lin <axel.lin@ingics.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      4ececb7d
  6. 08 Apr, 2016 2 commits