02 Jun, 2016

1 commit

  • commit 916d4092a1d2d7bb50630497be71ee4c4c2807fa upstream.

    $ rpm -q glibc
    glibc-2.12-1.166.el6_7.1.x86_64

    CC /tmp/build/perf/tests/llvm.o
    cc1: warnings being treated as errors
    tests/llvm.c: In function ‘test_llvm__fetch_bpf_obj’:
    tests/llvm.c:53: error: declaration of ‘index’ shadows a global declaration
    /usr/include/string.h:489: error: shadowed declaration is here

    CC /tmp/build/perf/tests/bpf.o
    cc1: warnings being treated as errors
    tests/bpf.c: In function ‘__test__bpf’:
    tests/bpf.c:149: error: declaration of ‘index’ shadows a global declaration
    /usr/include/string.h:489: error: shadowed declaration is here

    Cc: He Kuang
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: pi3orama@163.com
    Cc: Wang Nan
    Cc: Zefan Li
    Fixes: b31de018a628 ("perf test: Enhance the LLVM test: update basic BPF test program")
    Fixes: ba1fae431e74 ("perf test: Add 'perf test BPF'")
    Link: http://lkml.kernel.org/n/tip-akpo4r750oya2phxoh9e3447@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Cc: Nikolay Borisov
    Signed-off-by: Greg Kroah-Hartman

    Arnaldo Carvalho de Melo
     

19 May, 2016

1 commit

  • commit 106b816cb46ebd87408b4ed99a2e16203114daa6 upstream.

    At the end of process_filter(), collapse_tree() was changed to update
    the parg parameter, but the reassignment after the call wasn't removed.

    What happens is that the "current_op" gets modified and freed and parg
    is assigned to the new allocated argument. But after the call to
    collapse_tree(), parg is assigned again to the just freed "current_op",
    and this causes the tool to crash.

    The current_op variable must also be assigned to NULL in case of error,
    otherwise it will cause it to be free()ed twice.

    Signed-off-by: Steven Rostedt
    Acked-by: Namhyung Kim
    Fixes: 42d6194d133c ("tools lib traceevent: Refactor process_filter()")
    Link: http://lkml.kernel.org/r/20160511150936.678c18a1@gandalf.local.home
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Steven Rostedt
     

05 May, 2016

5 commits

  • commit f594bae08183fb6b57db55387794ece3e1edf6f6 upstream.

    I'm surprised this remained undocumented since at least 2011. And it is
    actually a very useful switch, as Steve and I came to realize recently.

    Add the text from

    2cba3ffb9a9d ("perf stat: Add -d -d and -d -d -d options to show more CPU events")

    which added the incrementing aspect to -d.

    Tested-by: Arnaldo Carvalho de Melo
    Signed-off-by: Borislav Petkov
    Signed-off-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: David Ahern
    Cc: Davidlohr Bueso
    Cc: Jiri Olsa
    Cc: Mel Gorman
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Cc: Thomas Gleixner
    Fixes: 2cba3ffb9a9d ("perf stat: Add -d -d and -d -d -d options to show more CPU events")
    Link: http://lkml.kernel.org/r/1457347294-32546-1-git-send-email-bp@alien8.de
    Signed-off-by: Ingo Molnar
    Signed-off-by: Greg Kroah-Hartman

    Borislav Petkov
     
  • commit 89fee59b504f86925894fcc9ba79d5c933842f93 upstream.

    Steam frequently puts game binaries in folders with spaces.

    Note: "(deleted)" markers are now treated as part of the file name.

    Signed-off-by: Marcin Ślusarz
    Acked-by: Namhyung Kim
    Fixes: 6064803313ba ("perf tools: Use sscanf for parsing /proc/pid/maps")
    Link: http://lkml.kernel.org/r/20160119190303.GA17579@marcin-Inspiron-7720
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Marcin Ślusarz
     
  • commit c221acb0f970d3b80d72c812cda19c121acf5d52 upstream.

    When this feature was introduced a check was made if there was a
    resolved symbol under the cursor, it got lost in commit ea7cd5923309
    ("perf hists browser: Split popup menu actions - part 2"), reinstate it.

    Signed-off-by: Namhyung Kim
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Andi Kleen
    Cc: David Ahern
    Cc: Jiri Olsa ,
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Wang Nan
    Fixes: ea7cd5923309 ("perf hists browser: Split popup menu actions - part 2")
    Link: http://lkml.kernel.org/r/1452960197-5323-9-git-send-email-namhyung@kernel.org
    [ Carved out from a larger patch ]
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Namhyung Kim
     
  • commit a55e5663761366fb883f6f25375dd68bc958b9db upstream.

    We were dropping the reference we possibly held but not obtaining one
    for the new maps, which we will drop at perf_evlist__delete(), fix it.

    This was caught by Steven Noonan in some of the machines which would
    produce this output when caught by glibc debug mechanisms:

    $ sudo perf test 21
    21: Test object code reading :***
    Error in `perf': corrupted double-linked list: 0x00000000023ffcd0 ***
    ======= Backtrace: =========
    /usr/lib/libc.so.6(+0x72055)[0x7f25be0f3055]
    /usr/lib/libc.so.6(+0x779b6)[0x7f25be0f89b6]
    /usr/lib/libc.so.6(+0x7a0ed)[0x7f25be0fb0ed]
    /usr/lib/libc.so.6(__libc_calloc+0xba)[0x7f25be0fceda]
    perf(parse_events_lex_init_extra+0x38)[0x4cfff8]
    perf(parse_events+0x55)[0x4a0615]
    perf(perf_evlist__config+0xcf)[0x4eeb2f]
    perf[0x479f82]
    perf(test__code_reading+0x1e)[0x47ad4e]
    perf(cmd_test+0x5dd)[0x46452d]
    perf[0x47f4e3]
    perf(main+0x603)[0x42c723]
    /usr/lib/libc.so.6(__libc_start_main+0xf0)[0x7f25be0a1610]
    perf(_start+0x29)[0x42c859]

    Further investigation using valgrind led to the reference count imbalance fixed
    in this patch.

    Reported-and-Tested-by: Steven Noonan
    Report-Link: http://lkml.kernel.org/r/CAKbGBLjC2Dx5vshxyGmQkcD+VwiAQLbHoXA9i7kvRB2-2opHZQ@mail.gmail.com
    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Fixes: f30a79b012e5 ("perf tools: Add reference counting for cpu_map object")
    Link: http://lkml.kernel.org/n/tip-j0u1bdhr47sa511sgg76kb8h@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Arnaldo Carvalho de Melo
     
  • commit 1342e0b7a6c1a060c593037fbac9f4b717f1cb3b upstream.

    Tracing a workload that uses transactions gave a seg fault as follows:

    perf record -e intel_pt// workload
    perf report
    Program received signal SIGSEGV, Segmentation fault.
    0x000000000054b58c in intel_pt_reset_last_branch_rb (ptq=0x1a36110)
    at util/intel-pt.c:929
    929 ptq->last_branch_rb->nr = 0;
    (gdb) p ptq->last_branch_rb
    $1 = (struct branch_stack *) 0x0
    (gdb) up
    1148 intel_pt_reset_last_branch_rb(ptq);
    (gdb) l
    1143 if (ret)
    1144 pr_err("Intel Processor Trace: failed to deliver transaction event
    1145 ret);
    1146
    1147 if (pt->synth_opts.callchain)
    1148 intel_pt_reset_last_branch_rb(ptq);
    1149
    1150 return ret;
    1151 }
    1152
    (gdb) p pt->synth_opts.callchain
    $2 = true
    (gdb)
    (gdb) bt
    #0 0x000000000054b58c in intel_pt_reset_last_branch_rb (ptq=0x1a36110)
    #1 0x000000000054c1e0 in intel_pt_synth_transaction_sample (ptq=0x1a36110)
    #2 0x000000000054c5b2 in intel_pt_sample (ptq=0x1a36110)

    Caused by checking the 'callchain' flag when it should have been the
    'last_branch' flag. Fix that.

    Reported-by: Andi Kleen
    Signed-off-by: Adrian Hunter
    Cc: Jiri Olsa
    Fixes: f14445ee72c5 ("perf intel-pt: Support generating branch stack")
    Link: http://lkml.kernel.org/r/1460977068-11566-1-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Adrian Hunter
     

13 Apr, 2016

4 commits

  • commit 50fe6dd10069e7c062e27f29606f6e91ea979399 upstream.

    Use the local uapi headers to keep in sync with "recently" added #define's
    (e.g. VSS_OP_REGISTER1).

    Fixes: 3eb2094c59e8 ("Adding makefile for tools/hv")
    Signed-off-by: Kamal Mostafa
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Kamal Mostafa
     
  • commit 67d5268908283c187e0a460048a423256c2fb288 upstream.

    The util/python-ext-sources file contains source files required to build
    the python extension relative to $(srctree)/tools/perf,

    Such a file path $(FILE).c is handed over to the python extension build
    system, which builds the final object in the
    $(PYTHON_EXTBUILD)/tmp/$(FILE).o path.

    After the build is done all files from $(PYTHON_EXTBUILD)lib/ are
    carried as the result binaries.

    Above system fails when we add source file relative to ../lib, which we
    do for:

    ../lib/bitmap.c
    ../lib/find_bit.c
    ../lib/hweight.c
    ../lib/rbtree.c

    All above objects will be built like:

    $(PYTHON_EXTBUILD)/tmp/../lib/bitmap.c
    $(PYTHON_EXTBUILD)/tmp/../lib/find_bit.c
    $(PYTHON_EXTBUILD)/tmp/../lib/hweight.c
    $(PYTHON_EXTBUILD)/tmp/../lib/rbtree.c

    which accidentally happens to be final library path:

    $(PYTHON_EXTBUILD)/lib/

    Changing setup.py to pass full paths of source files to Extension build
    class and thus keep all built objects under $(PYTHON_EXTBUILD)tmp
    directory.

    Reported-by: Jeff Bastian
    Signed-off-by: Jiri Olsa
    Tested-by: Josh Boyer
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20160227201350.GB28494@krava.redhat.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Jiri Olsa
     
  • commit 26dee028d365fbc0e3326606a8520260b4462381 upstream.

    According to man pages, asprintf returns -1 when failure. This patch
    fixes two incorrect return value checker.

    Signed-off-by: Wang Nan
    Cc: Adrian Hunter
    Cc: Alexei Starovoitov
    Cc: Brendan Gregg
    Cc: Cody P Schafer
    Cc: He Kuang
    Cc: Jeremie Galarneau
    Cc: Jiri Olsa
    Cc: Kirill Smelkov
    Cc: Li Zefan
    Cc: Masami Hiramatsu
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Zefan Li
    Cc: pi3orama@163.com
    Fixes: ffeb883e5662 ("perf tools: Show proper error message for wrong terms of hw/sw events")
    Link: http://lkml.kernel.org/r/1455882283-79592-5-git-send-email-wangnan0@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Wang Nan
     
  • commit 940db6dcd3f4659303fdf6befe7416adc4d24118 upstream.

    When an error happens during alias parsing currently the complete
    parsing of all attributes of the PMU is stopped. This is breaks old perf
    on a newer kernel that may have not-yet-know alias attributes (such as
    .scale or .per-pkg).

    Continue when some attribute is unparseable.

    This is IMHO a stable candidate and should be backported to older
    versions to avoid problems with newer kernels.

    v2: Print warnings when something goes wrong.
    v3: Change warning to debug output

    Signed-off-by: Andi Kleen
    Cc: Jiri Olsa
    Link: http://lkml.kernel.org/r/1455749095-18358-1-git-send-email-andi@firstfloor.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Andi Kleen
     

04 Mar, 2016

3 commits

  • commit 3f416f22d1e21709a631189ba169f76fd267b374 upstream.

    Mel reported stddev reporting was broken due to following commit:

    106a94a0f8c2 ("perf stat: Introduce read_counters function")

    This commit merged interval and overall counters reading into single
    read_counters function.

    The old interval code cleaned the stddev data for some reason (it's
    never displayed in interval mode) and the mentioned commit kept on
    cleaning the stddev data in merged function, which resulted in the
    stddev not being displayed.

    Removing the wrong stddev data cleanup init_stats call.

    Reported-and-Tested-by: Mel Gorman
    Signed-off-by: Jiri Olsa
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Fixes: 106a94a0f8c2 ("perf stat: Introduce read_counters function")
    Link: http://lkml.kernel.org/r/1453290995-18485-4-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Jiri Olsa
     
  • commit a689d2510f188e75391dbebacbddfd74d42f2a7e upstream.

    Fix the write()'s argument in the daemon code.

    Cc: Vitaly Kuznetsov
    Cc: "K. Y. Srinivasan"
    Signed-off-by: Dexuan Cui
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Dexuan Cui
     
  • commit ed8b0de5a33d2a2557dce7f9429dca8cb5bc5879 upstream.

    "rm -rf" is bricking some peoples' laptops because of variables being
    used to store non-reinitializable firmware driver data that's required
    to POST the hardware.

    These are 100% bugs, and they need to be fixed, but in the mean time it
    shouldn't be easy to *accidentally* brick machines.

    We have to have delete working, and picking which variables do and don't
    work for deletion is quite intractable, so instead make everything
    immutable by default (except for a whitelist), and make tools that
    aren't quite so broad-spectrum unset the immutable flag.

    Signed-off-by: Peter Jones
    Tested-by: Lee, Chun-Yi
    Acked-by: Matthew Garrett
    Signed-off-by: Matt Fleming
    Signed-off-by: Greg Kroah-Hartman

    Peter Jones
     

26 Feb, 2016

3 commits

  • commit 3caeaa562733c4836e61086ec07666635006a787 upstream.

    While recording guest samples in host using perf kvm record, it will
    populate unprocessable sample error, though samples will be recorded
    properly. While generating report using perf kvm report, no samples will
    be processed and same error will populate. We have seen this behaviour
    with upstream perf(4.4-rc3) on x86 and ppc64 hardware.

    Reason behind this failure is, when it tries to fetch machine from
    rb_tree of machines, it fails. As a part of tracing a bug, we figured
    out that this code was incorrectly refactored in commit 54245fdc3576
    ("perf session: Remove wrappers to machines__find").

    This patch will change the functionality such that if it can't fetch
    machine in first trial, it will create one node of machine and add that to
    rb_tree. So next time when it tries to fetch same machine from rb_tree,
    it won't fail. Actually it was the case before refactoring of code in
    aforementioned commit.

    This patch is generated from acme perf/core branch.

    Below I've mention an example that demonstrate the behaviour before and
    after applying patch.

    Before applying patch:
    [Note: One needs to run guest before recording data in host]

    ravi@ravi-bangoria:~$ ./perf kvm record -a
    Warning:
    5903 unprocessable samples recorded.
    Do you have a KVM guest running and not using 'perf kvm'?
    [ perf record: Captured and wrote 1.409 MB perf.data.guest (285 samples) ]

    ravi@ravi-bangoria:~$ ./perf kvm report --stdio
    Warning:
    5903 unprocessable samples recorded.
    Do you have a KVM guest running and not using 'perf kvm'?
    # To display the perf.data header info, please use --header/--header-only options.
    #
    # Total Lost Samples: 0
    #
    # Samples: 285 of event 'cycles'
    # Event count (approx.): 88715406
    #
    # Overhead Command Shared Object Symbol
    # ........ ....... ............. ......
    #

    # (For a higher level overview, try: perf report --sort comm,dso)
    #

    After applying patch:

    ravi@ravi-bangoria:~$ ./perf kvm record -a
    [ perf record: Captured and wrote 1.188 MB perf.data.guest (17 samples) ]

    ravi@ravi-bangoria:~$ ./perf kvm report --stdio
    # To display the perf.data header info, please use --header/--header-only options.
    #
    # Total Lost Samples: 0
    #
    # Samples: 17 of event 'cycles'
    # Event count (approx.): 700746
    #
    # Overhead Command Shared Object Symbol
    # ........ ....... ................ ......................
    #
    34.19% :5758 [unknown] [g] 0xffffffff818682ab
    22.79% :5758 [unknown] [g] 0xffffffff812dc7f8
    22.79% :5758 [unknown] [g] 0xffffffff818650d0
    14.83% :5758 [unknown] [g] 0xffffffff8161a1b6
    2.49% :5758 [unknown] [g] 0xffffffff818692bf
    0.48% :5758 [unknown] [g] 0xffffffff81869253
    0.05% :5758 [unknown] [g] 0xffffffff81869250

    Signed-off-by: Ravi Bangoria
    Cc: Naveen N. Rao
    Fixes: 54245fdc3576 ("perf session: Remove wrappers to machines__find")
    Link: http://lkml.kernel.org/r/1449471302-11283-1-git-send-email-ravi.bangoria@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Ravi Bangoria
     
  • commit ec183d22cc284a7a1e17f0341219d8ec8ca070cc upstream.

    Fixes segmentation fault using, for instance:

    (gdb) run record -I -e intel_pt/tsc=1,noretcomp=1/u /bin/ls
    Starting program: /home/acme/bin/perf record -I -e intel_pt/tsc=1,noretcomp=1/u /bin/ls
    Missing separate debuginfos, use: dnf debuginfo-install glibc-2.22-7.fc23.x86_64
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib64/libthread_db.so.1".

    Program received signal SIGSEGV, Segmentation fault.
    0 x00000000004b9ea5 in tracepoint_error (e=0x0, err=13, sys=0x19b1370 "sched", name=0x19a5d00 "sched_switch") at util/parse-events.c:410
    (gdb) bt
    #0 0x00000000004b9ea5 in tracepoint_error (e=0x0, err=13, sys=0x19b1370 "sched", name=0x19a5d00 "sched_switch") at util/parse-events.c:410
    #1 0x00000000004b9fc5 in add_tracepoint (list=0x19a5d20, idx=0x7fffffffb8c0, sys_name=0x19b1370 "sched", evt_name=0x19a5d00 "sched_switch", err=0x0, head_config=0x0)
    at util/parse-events.c:433
    #2 0x00000000004ba334 in add_tracepoint_event (list=0x19a5d20, idx=0x7fffffffb8c0, sys_name=0x19b1370 "sched", evt_name=0x19a5d00 "sched_switch", err=0x0, head_config=0x0)
    at util/parse-events.c:498
    #3 0x00000000004bb699 in parse_events_add_tracepoint (list=0x19a5d20, idx=0x7fffffffb8c0, sys=0x19b1370 "sched", event=0x19a5d00 "sched_switch", err=0x0, head_config=0x0)
    at util/parse-events.c:936
    #4 0x00000000004f6eda in parse_events_parse (_data=0x7fffffffb8b0, scanner=0x19a49d0) at util/parse-events.y:391
    #5 0x00000000004bc8e5 in parse_events__scanner (str=0x663ff2 "sched:sched_switch", data=0x7fffffffb8b0, start_token=258) at util/parse-events.c:1361
    #6 0x00000000004bca57 in parse_events (evlist=0x19a5220, str=0x663ff2 "sched:sched_switch", err=0x0) at util/parse-events.c:1401
    #7 0x0000000000518d5f in perf_evlist__can_select_event (evlist=0x19a3b90, str=0x663ff2 "sched:sched_switch") at util/record.c:253
    #8 0x0000000000553c42 in intel_pt_track_switches (evlist=0x19a3b90) at arch/x86/util/intel-pt.c:364
    #9 0x00000000005549d1 in intel_pt_recording_options (itr=0x19a2c40, evlist=0x19a3b90, opts=0x8edf68 ) at arch/x86/util/intel-pt.c:664
    #10 0x000000000051e076 in auxtrace_record__options (itr=0x19a2c40, evlist=0x19a3b90, opts=0x8edf68 ) at util/auxtrace.c:539
    #11 0x0000000000433368 in cmd_record (argc=1, argv=0x7fffffffde60, prefix=0x0) at builtin-record.c:1264
    #12 0x000000000049bec2 in run_builtin (p=0x8fa2a8 , argc=5, argv=0x7fffffffde60) at perf.c:390
    #13 0x000000000049c12a in handle_internal_command (argc=5, argv=0x7fffffffde60) at perf.c:451
    #14 0x000000000049c278 in run_argv (argcp=0x7fffffffdcbc, argv=0x7fffffffdcb0) at perf.c:495
    #15 0x000000000049c60a in main (argc=5, argv=0x7fffffffde60) at perf.c:618
    (gdb)

    Intel PT attempts to find the sched:sched_switch tracepoint but that seg
    faults if tracefs is not readable, because the error reporting structure
    is null, as errors are not reported when automatically adding
    tracepoints. Fix by checking before using.

    Committer note:

    This doesn't take place in a kernel that supports
    perf_event_attr.context_switch, that is the default way that will be
    used for tracking context switches, only in older kernels, like 4.2, in
    a machine with Intel PT (e.g. Broadwell) for non-priviledged users.

    Further info from a similar patch by Wang:

    The error is in tracepoint_error: it assumes the 'e' parameter is valid.

    However, there are many situation a parse_event() can be called without
    parse_events_error. See result of

    $ grep 'parse_events(.*NULL)' ./tools/perf/ -r'

    Signed-off-by: Adrian Hunter
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Jiri Olsa
    Cc: Josh Poimboeuf
    Cc: Tong Zhang
    Cc: Wang Nan
    Fixes: 196581717d85 ("perf tools: Enhance parsing events tracepoint error output")
    Link: http://lkml.kernel.org/r/1453809921-24596-2-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Adrian Hunter
     
  • commit 32abc2ede536aae52978d6c0a8944eb1df14f460 upstream.

    When a long value is read on 32 bit machines for 64 bit output, the
    parsing needs to change "%lu" into "%llu", as the value is read
    natively.

    Unfortunately, if "%llu" is already there, the code will add another "l"
    to it and fail to parse it properly.

    Signed-off-by: Steven Rostedt
    Acked-by: Namhyung Kim
    Link: http://lkml.kernel.org/r/20151116172516.4b79b109@gandalf.local.home
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Steven Rostedt
     

09 Jan, 2016

1 commit

  • Pull perf fixes from Ingo Molnar:
    "Two core subsystem fixes, plus a handful of tooling fixes"

    * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    perf: Fix race in swevent hash
    perf: Fix race in perf_event_exec()
    perf list: Robustify event printing routine
    perf list: Add support for PERF_COUNT_SW_BPF_OUT
    perf hists browser: Fix segfault if use symbol filter in cmdline
    perf hists browser: Reset selection when refresh
    perf hists browser: Add NULL pointer check to prevent crash
    perf buildid-list: Fix return value of perf buildid-list -k
    perf buildid-list: Show running kernel build id fix

    Linus Torvalds
     

17 Dec, 2015

2 commits

  • When a43eec304259 ("bpf: introduce bpf_perf_event_output() helper") added
    PERF_COUNT_SW_BPF_OUTPUT we ended up with a new entry in the event_symbols_sw
    array that wasn't initialized, thus set to NULL, fix print_symbol_events()
    to check for that case so that we don't crash if this happens again.

    (gdb) bt
    #0 __match_glob (ignore_space=false, pat=, str=) at util/string.c:198
    #1 strglobmatch (str=, pat=pat@entry=0x7fffffffe61d "stall") at util/string.c:252
    #2 0x00000000004993a5 in print_symbol_events (type=1, syms=0x872880 , max=11, name_only=false, event_glob=0x7fffffffe61d "stall")
    at util/parse-events.c:1615
    #3 print_events (event_glob=event_glob@entry=0x7fffffffe61d "stall", name_only=false) at util/parse-events.c:1675
    #4 0x000000000042c79e in cmd_list (argc=1, argv=0x7fffffffe390, prefix=) at builtin-list.c:68
    #5 0x00000000004788a5 in run_builtin (p=p@entry=0x871758 , argc=argc@entry=2, argv=argv@entry=0x7fffffffe390) at perf.c:370
    #6 0x0000000000420ab0 in handle_internal_command (argv=0x7fffffffe390, argc=2) at perf.c:429
    #7 run_argv (argv=0x7fffffffe110, argcp=0x7fffffffe11c) at perf.c:473
    #8 main (argc=2, argv=0x7fffffffe390) at perf.c:588
    (gdb) p event_symbols_sw[PERF_COUNT_SW_BPF_OUTPUT]
    $4 = {symbol = 0x0, alias = 0x0}
    (gdb)

    A patch to robustify perf to not segfault when the next counter gets added in
    the kernel will follow this one.

    Reported-by: Ingo Molnar
    Cc: Adrian Hunter
    Cc: Alexei Starovoitov
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-57wysblcjfrseb0zg5u7ek10@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • When PERF_COUNT_SW_BPF_OUTPUT was added to the kernel we should've
    added it to tools/perf, where it is used just to list events.

    This ended up causing a segfault in commands like "perf list stall".

    Fix it by adding that new software counter.

    A patch to robustify perf to not segfault when the next counter gets
    added in the kernel will follow this one.

    Reported-by: Ingo Molnar
    Cc: Adrian Hunter
    Cc: Alexei Starovoitov
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-uya354upi3eprsey6mi5962d@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

07 Dec, 2015

7 commits

  • commit cf561f0d2eb74574ad9985a2feab134267a9d298 ("virtio: introduce
    virtio_is_little_endian() helper") changed byteswap logic to
    skip feature bit checks for LE platforms, but didn't
    update tools/virtio, so vring_bench started failing.

    Update the copy under tools/virtio/ (TODO: find a way to avoid this code
    duplication).

    Cc: Greg Kurz
    Signed-off-by: Michael S. Tsirkin

    Michael S. Tsirkin
     
  • Makes them more generally available.

    Signed-off-by: Michael S. Tsirkin

    Michael S. Tsirkin
     
  • If feed perf a symbol filter in cmdline and the result is empty,
    pressing 'Enter' in the hist browser causes crash:

    # ./perf report perf.data
    Acked-by: Namhyung Kim
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Zefan Li
    Cc: pi3orama@163.com
    Link: http://lkml.kernel.org/r/1449455746-41952-2-git-send-email-wangnan0@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Wang Nan
     
  • With the following steps:

    Step 1: perf report

    Step 2: Use UP/DOWN to select an entry, don't press 'ENTER'

    Step 3: Use '/' to filter symbols, use a filter which returns
    empty result

    Step 4: Press 'ENTER'

    We see that, even if we have filtered all the symbols (and the main
    interface is empty), pressing 'ENTER' still selects one symbol. This
    behavior surprises the user.

    This patch resets browser->{he_,}selection in hist_browser__refresh()
    and lets it choose default selection. In this case
    browser->{he_,}selection keeps NULL so user won't see annotation item in
    menu.

    Signed-off-by: Wang Nan
    Acked-by: Namhyung Kim
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Zefan Li
    Cc: pi3orama@163.com
    Link: http://lkml.kernel.org/r/1449455746-41952-4-git-send-email-wangnan0@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Wang Nan
     
  • Before this patch we can trigger a segfault by following steps:

    Step 0: Use 'perf record' to generate a perf.data without callchain

    Step 1: perf report

    Step 2: Use UP/DOWN to select an entry, don't press 'ENTER'

    Step 3: Use '/' to filter symbols, use a filter which returns
    empty result

    Step 4: Press 'ENTER' (notice here that the old selection is still
    there. This is another problem)

    Step 5: Press 'ENTER' to annotate that symbol

    Step 6: Press 'LEFT' to go out.

    Result: segfault:

    perf: Segmentation fault
    -------- backtrace --------
    /home/wangnan/perf[0x53e568]
    /lib64/libc.so.6(+0x3545f)[0x7fba75d3245f]
    /home/wangnan/perf[0x537516]
    /home/wangnan/perf[0x533fef]
    /home/wangnan/perf[0x53b347]
    /home/wangnan/perf(perf_evlist__tui_browse_hists+0x96)[0x53d206]
    /home/wangnan/perf(cmd_report+0x1b9f)[0x442c7f]
    /home/wangnan/perf[0x47efa2]
    /home/wangnan/perf(main+0x5f5)[0x432fa5]
    /lib64/libc.so.6(__libc_start_main+0xf4)[0x7fba75d1ebd4]
    /home/wangnan/perf[0x4330d4]

    This is because in this case 'nd' could be NULL in
    ui_browser__hists_seek(), but that function never checks it.

    This patch adds checker for potential NULL pointer in that function.
    After this patch the above steps won't segfault.

    Signed-off-by: Wang Nan
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Namhyung Kim
    Cc: Zefan Li
    Cc: pi3orama@163.com
    Link: http://lkml.kernel.org/r/1449455746-41952-3-git-send-email-wangnan0@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Wang Nan
     
  • The buildid string length is returned by perf buildid-list -k command.
    Since a non-zero return value means an error, perf buildid-list -k cmd
    should return 0 when successful instead.

    Before:

    # perf buildid-list -k
    39356d74e96e02346fe0ec1f3f162b6c522bac62
    # echo $?
    41

    After:

    # perf buildid-list -k
    39356d74e96e02346fe0ec1f3f162b6c522bac62
    # echo $?
    0

    Signed-off-by: Michael Petlan
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Masami Hiramatsu
    Fixes: 0b5a7935f3b5 ("perf buildid: Introduce sysfs/filename__sprintf_build_id")
    LPU-Reference: 1449080871.24573.145.camel@redhat.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Michael Petlan
     
  • The --kernel option of perf buildid-list tool should show the running
    kernel buildid. The functionality has been lost during other changes of
    the related code.

    The build_id__sprintf() function should return length of the build-id
    string, but it was the length of the build-id raw data instead. Due to
    that, some return value checking caused that the final string was not
    printed out.

    With this patch the build_id__sprintf() returns the correct value, so
    the --kernel option works again.

    Before:

    # perf buildid-list --kernel
    #

    After:

    # perf buildid-list --kernel
    972c1edab5bdc06cc224af45d510af662a3c6972
    #

    Signed-off-by: Michael Petlan
    Cc: Jiri Olsa
    Cc: Masami Hiramatsu
    LPU-Reference: 1448632089.24573.114.camel@redhat.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Michael Petlan
     

01 Dec, 2015

1 commit

  • When support for _FIT was added, the code presumed that the data
    returned by the _FIT method is identical to the NFIT table, which
    starts with an acpi_table_header. However, the _FIT is defined
    to return a data in the format of a series of NFIT type structure
    entries and as a method, has an acpi_object header rather tahn
    an acpi_table_header.

    To address the differences, explicitly save the acpi_table_header
    from the NFIT, since it is accessible through /sys, and change
    the nfit pointer in the acpi_desc structure to point to the
    table entries rather than the headers.

    Reported-by: Jeff Moyer (jmoyer@redhat.com>
    Signed-off-by: Linda Knippers
    Acked-by: Vishal Verma
    [vishal: fix up unit test for new header assumptions]
    Signed-off-by: Dan Williams

    Linda Knippers
     

24 Nov, 2015

1 commit


23 Nov, 2015

1 commit

  • Pull perf tool fixes from Thomas Gleixner:
    "A couple of fixes for perf tools:

    - Build system updates

    - Plug a memory leak in an error path of perf probe

    - Tear down probes correctly when adding fails

    - Fixes to the perf symbol handling

    - Fix ordering of event processing in buildid-list

    - Fix per DSO filtering in the histogram browser"

    * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    perf probe: Clear probe_trace_event when add_probe_trace_event() fails
    perf probe: Fix memory leaking on failure by clearing all probe_trace_events
    perf inject: Also re-pipe lost_samples event
    perf buildid-list: Requires ordered events
    perf symbols: Fix dso lookup by long name and missing buildids
    perf symbols: Allow forcing reading of non-root owned files by root
    perf hists browser: The dso can be obtained from popup_action->ms.map->dso
    perf hists browser: Fix 'd' hotkey action to filter by DSO
    perf symbols: Rebuild rbtree when adjusting symbols for kcore
    tools: Add a "make all" rule
    tools: Actually install tmon in the install rule

    Linus Torvalds
     

21 Nov, 2015

2 commits

  • PageIdle is exported in include/uapi/linux/kernel-page-flags.h, so let's
    make page-types.c tool handle it.

    Signed-off-by: Naoya Horiguchi
    Reviewed-by: Vladimir Davydov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Naoya Horiguchi
     
  • Pull more power management and ACPI updates from Rafael Wysocki:
    "These are mostly fixes and cleanups (ACPI core, PM core, cpufreq, ACPI
    EC driver, device properties) including three reverts of recent
    intel_pstate driver commits due to a regression introduced by one of
    them plus support for Atom Airmont cores in intel_pstate (which really
    boils down to adding new frequency tables for Airmont) and additional
    turbostat updates.

    Specifics:

    - Revert three recent intel_pstate driver commits one of which
    introduced a regression and the remaining two depend on the
    problematic one (Rafael Wysocki).

    - Fix breakage related to the recently introduced ACPI _CCA object
    support in the PCI DMA setup code (Suravee Suthikulpanit).

    - Fix up the recently introduced ACPI CPPC support to only use the
    hardware-reduced version of the PCCT structure as the only
    architecture to support it (ARM64) will only use hardware-reduced
    ACPI anyway (Ashwin Chaugule).

    - Fix a cpufreq mediatek driver build problem (Arnd Bergmann).

    - Fix the SMBus transaction handling implementation in the ACPI core
    to avoid re-entrant calls to wait_event_timeout() which makes
    intermittent boot stalls related to the Smart Battery Subsystem
    initialization go away and revert a workaround of another problem
    with the same underlying root cause (Chris Bainbridge).

    - Fix the generic wakeup interrupts framework to avoid using invalid
    IRQ numbers (Dmitry Torokhov).

    - Remove a redundant check from the ACPI EC driver (Markus Elfring).

    - Modify the intel_pstate driver so it can support more Atom flavors
    than just one (Baytrail) and add support for Atom Airmont cores
    (which require new freqnency tables) to it (Philippe Longepe).

    - Clean up MSR-related symbols in turbostat (Len Brown)"

    * tag 'pm+acpi-4.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
    PCI: Fix OF logic in pci_dma_configure()
    Revert "Documentation: kernel_parameters for Intel P state driver"
    cpufreq: mediatek: fix build error
    cpufreq: intel_pstate: Add separate support for Airmont cores
    cpufreq: intel_pstate: Replace BYT with ATOM
    Revert "cpufreq: intel_pstate: Use ACPI perf configuration"
    Revert "cpufreq: intel_pstate: Avoid calculation for max/min"
    ACPI-EC: Drop unnecessary check made before calling acpi_ec_delete_query()
    Revert "ACPI / SBS: Add 5 us delay to fix SBS hangs on MacBook"
    ACPI / SMBus: Fix boot stalls / high CPU caused by reentrant code
    PM / wakeirq: check that wake IRQ is valid before accepting it
    ACPI / CPPC: Use h/w reduced version of the PCCT structure
    x86: remove unused definition of MSR_NHM_PLATFORM_INFO
    tools/power turbostat: use new name for MSR_PLATFORM_INFO

    Linus Torvalds
     

19 Nov, 2015

1 commit

  • The commit fd88d16c58c2 ("selftests/seccomp: Be more precise with
    syscall arguments.") use PAGE_SIZE directly which lead to build
    failure on arm64.

    Replace it with generic interface(sysconf(_SC_PAGESIZE)) to fix this
    failure.

    Build and test successful on x86_64 and arm64.

    Signed-off-by: Bamvor Jian Zhang
    Acked-by: Kees Cook
    Tested-by: Michael Ellerman
    Signed-off-by: Shuah Khan

    Bamvor Jian Zhang
     

18 Nov, 2015

1 commit

  • Pull networking fixes from David Miller:

    1) Fix list tests in netfilter ingress support, from Florian Westphal.

    2) Fix reversal of input and output interfaces in ingress hook
    invocation, from Pablo Neira Ayuso.

    3) We have a use after free in r8169, caught by Dave Jones, fixed by
    Francois Romieu.

    4) Splice use-after-free fix in AF_UNIX frmo Hannes Frederic Sowa.

    5) Three ipv6 route handling bug fixes from Martin KaFai Lau:
    a) Don't create clone routes not managed by the fib6 tree
    b) Don't forget to check expiration of DST_NOCACHE routes.
    c) Handle rt->dst.from == NULL properly.

    6) Several AF_PACKET fixes wrt transport header setting and SKB
    protocol setting, from Daniel Borkmann.

    7) Fix thunder driver crash on shutdown, from Pavel Fedin.

    8) Several Mellanox driver fixes (max MTU calculations, use of correct
    DMA unmap in TX path, etc.) from Saeed Mahameed, Tariq Toukan, Doron
    Tsur, Achiad Shochat, Eran Ben Elisha, and Noa Osherovich.

    9) Several mv88e6060 DSA driver fixes (wrong bit definitions for
    certain registers, etc.) from Neil Armstrong.

    10) Make sure to disable preemption while updating per-cpu stats of ip
    tunnels, from Jason A. Donenfeld.

    11) Various ARM64 bpf JIT fixes, from Yang Shi.

    12) Flush icache properly in ARM JITs, from Daniel Borkmann.

    13) Fix masking of RX and TX interrupts in ravb driver, from Masaru
    Nagai.

    14) Fix netdev feature propagation for devices not implementing
    ->ndo_set_features(). From Nikolay Aleksandrov.

    15) Big endian fix in vmxnet3 driver, from Shrikrishna Khare.

    16) RAW socket code increments incorrect SNMP counters, fix from Ben
    Cartwright-Cox.

    17) IPv6 multicast SNMP counters are bumped twice, fix from Neil Horman.

    18) Fix handling of VLAN headers on stacked devices when REORDER is
    disabled. From Vlad Yasevich.

    19) Fix SKB leaks and use-after-free in ipvlan and macvlan drivers, from
    Sabrina Dubroca.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (83 commits)
    MAINTAINERS: Update Mellanox's Eth NIC driver entries
    net/core: revert "net: fix __netdev_update_features return.." and add comment
    af_unix: take receive queue lock while appending new skb
    rtnetlink: fix frame size warning in rtnl_fill_ifinfo
    net: use skb_clone to avoid alloc_pages failure.
    packet: Use PAGE_ALIGNED macro
    packet: Don't check frames_per_block against negative values
    net: phy: Use interrupts when available in NOLINK state
    phy: marvell: Add support for 88E1540 PHY
    arm64: bpf: make BPF prologue and epilogue align with ARM64 AAPCS
    macvlan: fix leak in macvlan_handle_frame
    ipvlan: fix use after free of skb
    ipvlan: fix leak in ipvlan_rcv_frame
    vlan: Do not put vlan headers back on bridge and macvlan ports
    vlan: Fix untag operations of stacked vlans with REORDER_HEADER off
    via-velocity: unconditionally drop frames with bad l2 length
    ipg: Remove ipg driver
    dl2k: Add support for IP1000A-based cards
    snmp: Remove duplicate OUTMCAST stat increment
    net: thunder: Check for driver data in nicvf_remove()
    ...

    Linus Torvalds
     

17 Nov, 2015

2 commits


16 Nov, 2015

3 commits

  • Use the local uapi headers to keep in sync with "recently" added #define's
    (e.g. SKF_AD_VLAN_TPID). Refactored CFLAGS, and bpf_asm doesn't need -I.

    Fixes: 3f356385e8a4 ("filter: bpf_asm: add minimal bpf asm tool")
    Signed-off-by: Kamal Mostafa
    Acked-by: Daniel Borkmann
    Signed-off-by: David S. Miller

    Kamal Mostafa
     
  • Pull perf updates from Thomas Gleixner:
    "Mostly updates to the perf tool plus two fixes to the kernel core code:

    - Handle tracepoint filters correctly for inherited events (Peter
    Zijlstra)

    - Prevent a deadlock in perf_lock_task_context (Paul McKenney)

    - Add missing newlines to some pr_err() calls (Arnaldo Carvalho de
    Melo)

    - Print full source file paths when using 'perf annotate --print-line
    --full-paths' (Michael Petlan)

    - Fix 'perf probe -d' when just one out of uprobes and kprobes is
    enabled (Wang Nan)

    - Add compiler.h to list.h to fix 'make perf-tar-src-pkg' generated
    tarballs, i.e. out of tree building (Arnaldo Carvalho de Melo)

    - Add the llvm-src-base.c and llvm-src-kbuild.c files, generated by
    the 'perf test' LLVM entries, when running it in-tree, to
    .gitignore (Yunlong Song)

    - libbpf error reporting improvements, using a strerror interface to
    more precisely tell the user about problems with the provided
    scriptlet, be it in C or as a ready made object file (Wang Nan)

    - Do not be case sensitive when searching for matching 'perf test'
    entries (Arnaldo Carvalho de Melo)

    - Inform the user about objdump failures in 'perf annotate' (Andi
    Kleen)

    - Improve the LLVM 'perf test' entry, introduce a new ones for BPF
    and kbuild tests to check the environment used by clang to compile
    .c scriptlets (Wang Nan)"

    * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (32 commits)
    perf/x86/intel/rapl: Remove the unused RAPL_EVENT_DESC() macro
    tools include: Add compiler.h to list.h
    perf probe: Verify parameters in two functions
    perf session: Add missing newlines to some pr_err() calls
    perf annotate: Support full source file paths for srcline fix
    perf test: Add llvm-src-base.c and llvm-src-kbuild.c to .gitignore
    perf: Fix inherited events vs. tracepoint filters
    perf: Disable IRQs across RCU RS CS that acquires scheduler lock
    perf test: Do not be case sensitive when searching for matching tests
    perf test: Add 'perf test BPF'
    perf test: Enhance the LLVM tests: add kbuild test
    perf test: Enhance the LLVM test: update basic BPF test program
    perf bpf: Improve BPF related error messages
    perf tools: Make fetch_kernel_version() publicly available
    bpf tools: Add new API bpf_object__get_kversion()
    bpf tools: Improve libbpf error reporting
    perf probe: Cleanup find_perf_probe_point_from_map to reduce redundancy
    perf annotate: Inform the user about objdump failures in --stdio
    perf stat: Make stat options global
    perf sched latency: Fix thread pid reuse issue
    ...

    Linus Torvalds
     
  • Pull liblockdep fixes from Thomas Gleixner:
    "Three small patches to synchronize liblockdep with the latest core
    changes"

    * 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    tools/liblockdep: explicitly declare lockdep API we call from liblockdep
    tools/liblockdep: add userspace versions of WRITE_ONCE and RCU_INIT_POINTER
    tools/liblockdep: remove task argument from debug_check_no_locks_held

    Linus Torvalds
     

14 Nov, 2015

1 commit

  • Pull libnvdimm fixes from Dan Williams:

    - three fixes tagged for -stable including a crash fix, simple
    performance tweak, and an invalid i/o error.

    - build regression fix for the nvdimm unit tests

    - nvdimm documentation update

    * 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
    dax: fix __dax_pmd_fault crash
    libnvdimm: documentation clarifications
    libnvdimm, pmem: fix size trim in pmem_direct_access()
    libnvdimm, e820: fix numa node for e820-type-12 pmem ranges
    tools/testing/nvdimm, acpica: fix flag rename build breakage

    Linus Torvalds