17 Aug, 2016

1 commit


15 Aug, 2016

2 commits


13 Aug, 2016

2 commits

  • Pull perf fixes from Ingo Molnar:
    "Mostly tooling fixes, plus two uncore-PMU fixes, an uprobes fix, a
    perf-cgroups fix and an AUX events fix"

    * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    perf/x86/intel/uncore: Add enable_box for client MSR uncore
    perf/x86/intel/uncore: Fix uncore num_counters
    uprobes/x86: Fix RIP-relative handling of EVEX-encoded instructions
    perf/core: Set cgroup in CPU contexts for new cgroup events
    perf/core: Fix sideband list-iteration vs. event ordering NULL pointer deference crash
    perf probe ppc64le: Fix probe location when using DWARF
    perf probe: Add function to post process kernel trace events
    tools: Sync cpufeatures headers with the kernel
    toops: Sync tools/include/uapi/linux/bpf.h with the kernel
    tools: Sync cpufeatures.h and vmx.h with the kernel
    perf probe: Support signedness casting
    perf stat: Avoid skew when reading events
    perf probe: Fix module name matching
    perf probe: Adjust map->reloc offset when finding kernel symbol from map
    perf hists: Trim libtraceevent trace_seq buffers
    perf script: Add 'bpf-output' field to usage message

    Linus Torvalds
     
  • Pull libnvdimm fixes from Dan Williams:

    - Fix for the nd_blk (NVDIMM Block Window Aperture) driver.

    A spec clarification requires the driver to mask off reserved bits in
    status register. This is tagged for -stable back to the v4.2 kernel.

    - Fix for a kernel crash in the nvdimm unit tests when module loading
    is interrupted with SIGTERM. Tagged for -stable since validation
    efforts external to Intel use the unit tests for qualifying
    backports.

    - Add a new 'size' sysfs attribute for the BTT (NVDIMM Block
    Translation Table) driver to make it symmetric with the other
    namespace personality drivers (PFN and DAX) that provide a size
    attribute for indicating how much namespace capacity is lost to
    metadata.

    The BTT change arrived at the start of the merge window and has
    appeared in a -next release. It can technically wait for 4.9, but it
    is small, fixes asymmetry in the libnvdimm-sysfs interface, and
    something I would have squeezed into the v4.8 pull request had it
    arrived a few days earlier.

    * 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
    tools/testing/nvdimm: fix SIGTERM vs hotplug crash
    nvdimm, btt: add a size attribute for BTTs
    libnvdimm, nd_blk: mask off reserved status bits

    Linus Torvalds
     

11 Aug, 2016

1 commit

  • The unit tests crash when hotplug races the previous probe. This race
    requires that the loading of the nfit_test module be terminated with
    SIGTERM, and the module to be unloaded while the ars scan is still
    running.

    In contrast to the normal nfit driver, the unit test calls
    acpi_nfit_init() twice to simulate hotplug, whereas the nominal case
    goes through the acpi_nfit_notify() event handler. The
    acpi_nfit_notify() path is careful to flush the previous region
    registration before servicing the hotplug event. The unit test was
    missing this guarantee.

    BUG: unable to handle kernel NULL pointer dereference at (null)
    IP: [] pwq_activate_delayed_work+0x47/0x170
    [..]
    Call Trace:
    [] pwq_dec_nr_in_flight+0x66/0xa0
    [] process_one_work+0x2d0/0x680
    [] ? process_one_work+0x171/0x680
    [] worker_thread+0x4e/0x480
    [] ? process_one_work+0x680/0x680
    [] ? process_one_work+0x680/0x680
    [] kthread+0xf3/0x110
    [] ret_from_fork+0x1f/0x40
    [] ? kthread_create_on_node+0x230/0x230

    Cc:
    Signed-off-by: Dan Williams

    Dan Williams
     

10 Aug, 2016

2 commits

  • We have some tests that assume we're using std=gnu99, which is fine on
    most compilers, but some old compilers use a different default.

    So make it explicit that we want to use std=gnu99.

    Signed-off-by: Michael Ellerman

    Michael Ellerman
     
  • …/kernel/git/acme/linux into perf/urgent

    Pull perf/urgent fixes from Arnaldo Carvalho de Melo:

    User visible fixes:

    - Fix the lookup for a kernel module in 'perf probe', fixing for instance, the
    erroneous return of "[raid10]" when looking for "[raid1]" (Konstantin Khlebnikov)

    - Disable counters in a group before reading them in 'perf stat', to avoid skew (Mark Rutland)

    - Fix adding probes to function aliases in systems using kaslr (Masami Hiramatsu)

    - Trip libtraceevent trace_seq buffers, removing unnecessary memory usage that could
    bring a system using tracepoint events with 'perf top' to a crawl, as the trace_seq
    buffers start at a whooping 4 KB, which is very rarely used in perf's usecases,
    so realloc it to the really used space as a last measure after using libtraceevent
    functions to format the fields of tracepoint events (Arnaldo Carvalho de Melo)

    - Fix 'perf probe' location when using DWARF on ppc64le (Ravi Bangoria)

    - Allow specifying signedness casts to a 'perf probe' variable, to shorten
    the number of steps to see signed values that otherwise would always appear
    as hex values (Naohiro Aota)

    Documentation fixes:

    - Add 'bpf-output' field to 'perf script' usage message (Brendan Gregg)

    Infrastructure fixes:

    - Sync kernel header files: cpufeatures.h, {disabled,required}-features.h,
    bpf.h and vmx.h, so that we get a clean build, without warnings about files
    being different from the kernel counterparts.

    A verification of the need or desirability of changes in tools/ based on what
    was done in the kernel changesets was made and documented in the respective
    file sync changesets (Arnaldo Carvalho de Melo)

    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Ingo Molnar
     

09 Aug, 2016

11 commits

  • Powerpc has Global Entry Point and Local Entry Point for functions. LEP
    catches call from both the GEP and the LEP. Symbol table of ELF contains
    GEP and Offset from which we can calculate LEP, but debuginfo does not
    have LEP info.

    Currently, perf prioritize symbol table over dwarf to probe on LEP for
    ppc64le. But when user tries to probe with function parameter, we fall
    back to using dwarf(i.e. GEP) and when function called via LEP, probe
    will never hit.

    For example:

    $ objdump -d vmlinux
    ...
    do_sys_open():
    c0000000002eb4a0: e8 00 4c 3c addis r2,r12,232
    c0000000002eb4a4: 60 00 42 38 addi r2,r2,96
    c0000000002eb4a8: a6 02 08 7c mflr r0
    c0000000002eb4ac: d0 ff 41 fb std r26,-48(r1)

    $ sudo ./perf probe do_sys_open
    $ sudo cat /sys/kernel/debug/tracing/kprobe_events
    p:probe/do_sys_open _text+3060904

    $ sudo ./perf probe 'do_sys_open filename:string'
    $ sudo cat /sys/kernel/debug/tracing/kprobe_events
    p:probe/do_sys_open _text+3060896 filename_string=+0(%gpr4):string

    For second case, perf probed on GEP. So when function will be called via
    LEP, probe won't hit.

    $ sudo ./perf record -a -e probe:do_sys_open ls
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.195 MB perf.data ]

    To resolve this issue, let's not prioritize symbol table, let perf
    decide what it wants to use. Perf is already converting GEP to LEP when
    it uses symbol table. When perf uses debuginfo, let it find LEP offset
    form symbol table. This way we fall back to probe on LEP for all cases.

    After patch:

    $ sudo ./perf probe 'do_sys_open filename:string'
    $ sudo cat /sys/kernel/debug/tracing/kprobe_events
    p:probe/do_sys_open _text+3060904 filename_string=+0(%gpr4):string

    $ sudo ./perf record -a -e probe:do_sys_open ls
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.197 MB perf.data (11 samples) ]

    Signed-off-by: Ravi Bangoria
    Acked-by: Masami Hiramatsu
    Cc: Alexander Shishkin
    Cc: Ananth N Mavinakayanahalli
    Cc: Balbir Singh
    Cc: Namhyung Kim
    Cc: Naveen N. Rao
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/1470723805-5081-2-git-send-email-ravi.bangoria@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Ravi Bangoria
     
  • Instead of inline code, introduce function to post process kernel
    probe trace events.

    Signed-off-by: Ravi Bangoria
    Acked-by: Masami Hiramatsu
    Cc: Alexander Shishkin
    Cc: Ananth N Mavinakayanahalli
    Cc: Balbir Singh
    Cc: Namhyung Kim
    Cc: Naveen N. Rao
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/1470723805-5081-1-git-send-email-ravi.bangoria@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Ravi Bangoria
     
  • Due to:

    1e61f78baf89 ("x86/cpufeature: Make sure DISABLED/REQUIRED macros are updated")

    No changes to tools using those headers (tools/arch/x86/lib/mem{set,cpu}_64.S)
    seems necessary.

    Detected by the tools build header drift checker:

    $ make -C tools/perf O=/tmp/build/perf
    make: Entering directory '/home/acme/git/linux/tools/perf'
    BUILD: Doing 'make -j4' parallel build
    GEN /tmp/build/perf/common-cmds.h
    Warning: tools/arch/x86/include/asm/disabled-features.h differs from kernel
    Warning: tools/arch/x86/include/asm/required-features.h differs from kernel
    Warning: tools/arch/x86/include/asm/cpufeatures.h differs from kernel
    CC /tmp/build/perf/util/probe-finder.o
    CC /tmp/build/perf/builtin-help.o

    ^C$

    Cc: Adrian Hunter
    Cc: Dave Hansen
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-ja75m7zk8j0jkzmrv16i5ehw@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • The way we're using kernel headers in tools/ now, with a copy that is
    made to the same path prefixed by "tools/" plus checking if that copy
    got stale, i.e. if the kernel counterpart changed, helps in keeping
    track with new features that may be useful for tools to exploit.

    For instance, looking at all the changes to bpf.h since it was last
    copied to tools/include brings this to toolers' attention:

    Need to investigate this one to check how to run a program via perf, setting up
    a BPF event, that will take advantage of the way perf already calls clang/LLVM,
    sets up the event and runs the workload in a single command line, helping in
    debugging such semi cooperative programs:

    96ae52279594 ("bpf: Add bpf_probe_write_user BPF helper to be called in tracers")

    This one needs further investigation about using the feature it improves
    in 'perf trace' to do some tcpdumpin' mixed with syscalls, tracepoints,
    probe points, callgraphs, etc:

    555c8a8623a3 ("bpf: avoid stack copy and use skb ctx for event output")

    Add tracing just packets that are related to some container to that mix:

    4a482f34afcc ("cgroup: bpf: Add bpf_skb_in_cgroup_proto")
    4ed8ec521ed5 ("cgroup: bpf: Add BPF_MAP_TYPE_CGROUP_ARRAY")

    Definetely needs to have example programs accessing task_struct from a bpf proggie
    started from 'perf trace':

    606274c5abd8 ("bpf: introduce bpf_get_current_task() helper")

    Core networking related, XDP:

    6ce96ca348a9 ("bpf: add XDP_TX xdp_action for direct forwarding")
    6a773a15a1e8 ("bpf: add XDP prog type for early driver filter")
    13c5c240f789 ("bpf: add bpf_get_hash_recalc helper")
    d2485c4242a8 ("bpf: add bpf_skb_change_type helper")
    6578171a7ff0 ("bpf: add bpf_skb_change_proto helper")

    Changes detected by the tools build system:

    $ make -C tools/perf O=/tmp/build/perf install-bin
    make: Entering directory '/home/acme/git/linux/tools/perf'
    BUILD: Doing 'make -j4' parallel build
    Warning: tools/include/uapi/linux/bpf.h differs from kernel
    INSTALL GTK UI
    CC /tmp/build/perf/bench/mem-memcpy-x86-64-asm.o

    $

    Cc: Adrian Hunter
    Cc: Alexei Starovoitov
    Cc: Brenden Blanco
    Cc: Daniel Borkmann
    Cc: David Ahern
    Cc: David S. Miller
    Cc: Jiri Olsa
    Cc: Martin KaFai Lau
    Cc: Namhyung Kim
    Cc: Sargun Dhillon
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-difq4ts1xvww6eyfs9e7zlft@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • There were changes related to the deprecation of the "pcommit"
    instruction:

    fd1d961dd681 ("x86/insn: remove pcommit")
    dfa169bbee00 ("Revert "KVM: x86: add pcommit support"")

    No need to update anything in the tools, as "pcommit" wasn't being
    listed on the VMX_EXIT_REASONS in the tools/perf/arch/x86/util/kvm-stat.c
    file.

    Just grab fresh copies of these files to silence the file cache
    coherency detector:

    $ make -C tools/perf O=/tmp/build/perf install-bin
    make: Entering directory '/home/acme/git/linux/tools/perf'
    BUILD: Doing 'make -j4' parallel build
    Warning: tools/arch/x86/include/asm/cpufeatures.h differs from kernel
    Warning: tools/arch/x86/include/uapi/asm/vmx.h differs from kernel
    INSTALL GTK UI

    #

    Cc: Adrian Hunter
    Cc: Dan Williams
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Paolo Bonzini
    Cc: Ross Zwisler
    Cc: Wang Nan
    Cc: Xiao Guangrong
    Link: http://lkml.kernel.org/n/tip-07pmcc1ysydhyyxbmp1vt0l4@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • The 'perf probe' tool detects a variable's type and use the detected
    type to add a new probe. Then, kprobes prints its variable in
    hexadecimal format if the variable is unsigned and prints in decimal if
    it is signed.

    We sometimes want to see unsigned variable in decimal format (i.e.
    sector_t or size_t). In that case, we need to investigate the variable's
    size manually to specify just signedness.

    This patch add signedness casting support. By specifying "s" or "u" as a
    type, perf-probe will investigate variable size as usual and use the
    specified signedness.

    E.g. without this:

    $ perf probe -a 'submit_bio bio->bi_iter.bi_sector'
    Added new event:
    probe:submit_bio (on submit_bio with bi_sector=bio->bi_iter.bi_sector)
    You can now use it in all perf tools, such as:
    perf record -e probe:submit_bio -aR sleep 1
    $ cat trace_pipe|head
    dbench-9692 [003] d..1 971.096633: submit_bio: (submit_bio+0x0/0x140) bi_sector=0x3a3d00
    dbench-9692 [003] d..1 971.096685: submit_bio: (submit_bio+0x0/0x140) bi_sector=0x1a3d80
    dbench-9692 [003] d..1 971.096687: submit_bio: (submit_bio+0x0/0x140) bi_sector=0x3a3d80
    ...
    // need to investigate the variable size
    $ perf probe -a 'submit_bio bio->bi_iter.bi_sector:s64'
    Added new event:
    probe:submit_bio (on submit_bio with bi_sector=bio->bi_iter.bi_sector:s64)
    You can now use it in all perf tools, such as:
    perf record -e probe:submit_bio -aR sleep 1

    With this:

    // just use "s" to cast its signedness
    $ perf probe -v -a 'submit_bio bio->bi_iter.bi_sector:s'
    Added new event:
    probe:submit_bio (on submit_bio with bi_sector=bio->bi_iter.bi_sector:s)
    You can now use it in all perf tools, such as:
    perf record -e probe:submit_bio -aR sleep 1
    $ cat trace_pipe|head
    dbench-9689 [001] d..1 1212.391237: submit_bio: (submit_bio+0x0/0x140) bi_sector=128
    dbench-9689 [001] d..1 1212.391252: submit_bio: (submit_bio+0x0/0x140) bi_sector=131072
    dbench-9697 [006] d..1 1212.398611: submit_bio: (submit_bio+0x0/0x140) bi_sector=30208

    This commit also update perf-probe.txt to describe "types". Most parts
    are based on existing documentation: Documentation/trace/kprobetrace.txt

    Committer note:

    Testing using 'perf trace':

    # perf probe -a 'submit_bio bio->bi_iter.bi_sector'
    Added new event:
    probe:submit_bio (on submit_bio with bi_sector=bio->bi_iter.bi_sector)

    You can now use it in all perf tools, such as:

    perf record -e probe:submit_bio -aR sleep 1

    # trace --no-syscalls --ev probe:submit_bio
    0.000 probe:submit_bio:(ffffffffac3aee00) bi_sector=0xc133c0)
    3181.861 probe:submit_bio:(ffffffffac3aee00) bi_sector=0x6cffb8)
    3181.881 probe:submit_bio:(ffffffffac3aee00) bi_sector=0x6cffc0)
    3184.488 probe:submit_bio:(ffffffffac3aee00) bi_sector=0x6cffc8)

    4717.927 probe:submit_bio:(ffffffffac3aee00) bi_sector=0x4dc7a88)
    4717.970 probe:submit_bio:(ffffffffac3aee00) bi_sector=0x4dc7880)
    ^C[root@jouet ~]#

    Now, using this new feature:

    [root@jouet ~]# perf probe -a 'submit_bio bio->bi_iter.bi_sector:s'
    Added new event:
    probe:submit_bio (on submit_bio with bi_sector=bio->bi_iter.bi_sector:s)

    You can now use it in all perf tools, such as:

    perf record -e probe:submit_bio -aR sleep 1

    [root@jouet ~]# trace --no-syscalls --ev probe:submit_bio
    0.000 probe:submit_bio:(ffffffffac3aee00) bi_sector=7145704)
    0.017 probe:submit_bio:(ffffffffac3aee00) bi_sector=7145712)
    0.019 probe:submit_bio:(ffffffffac3aee00) bi_sector=7145720)
    2.567 probe:submit_bio:(ffffffffac3aee00) bi_sector=7145728)
    5631.919 probe:submit_bio:(ffffffffac3aee00) bi_sector=0)
    5631.941 probe:submit_bio:(ffffffffac3aee00) bi_sector=8)
    5631.945 probe:submit_bio:(ffffffffac3aee00) bi_sector=16)
    5631.948 probe:submit_bio:(ffffffffac3aee00) bi_sector=24)
    ^C#

    With callchains:

    # trace --no-syscalls --ev probe:submit_bio/max-stack=10/
    0.000 probe:submit_bio:(ffffffffac3aee00) bi_sector=50662544)
    submit_bio+0xa8200001 ([kernel.kallsyms])
    submit_bh+0xa8200013 ([kernel.kallsyms])
    jbd2_journal_commit_transaction+0xa8200691 ([kernel.kallsyms])
    kjournald2+0xa82000ca ([kernel.kallsyms])
    kthread+0xa82000d8 ([kernel.kallsyms])
    ret_from_fork+0xa820001f ([kernel.kallsyms])
    0.023 probe:submit_bio:(ffffffffac3aee00) bi_sector=50662552)
    submit_bio+0xa8200001 ([kernel.kallsyms])
    submit_bh+0xa8200013 ([kernel.kallsyms])
    jbd2_journal_commit_transaction+0xa8200691 ([kernel.kallsyms])
    kjournald2+0xa82000ca ([kernel.kallsyms])
    kthread+0xa82000d8 ([kernel.kallsyms])
    ret_from_fork+0xa820001f ([kernel.kallsyms])
    0.027 probe:submit_bio:(ffffffffac3aee00) bi_sector=50662560)
    submit_bio+0xa8200001 ([kernel.kallsyms])
    submit_bh+0xa8200013 ([kernel.kallsyms])
    jbd2_journal_commit_transaction+0xa8200691 ([kernel.kallsyms])
    kjournald2+0xa82000ca ([kernel.kallsyms])
    kthread+0xa82000d8 ([kernel.kallsyms])
    ret_from_fork+0xa820001f ([kernel.kallsyms])
    2.593 probe:submit_bio:(ffffffffac3aee00) bi_sector=50662568)
    submit_bio+0xa8200001 ([kernel.kallsyms])
    submit_bh+0xa8200013 ([kernel.kallsyms])
    journal_submit_commit_record+0xa82001ac ([kernel.kallsyms])
    jbd2_journal_commit_transaction+0xa82012e8 ([kernel.kallsyms])
    kjournald2+0xa82000ca ([kernel.kallsyms])
    kthread+0xa82000d8 ([kernel.kallsyms])
    ret_from_fork+0xa820001f ([kernel.kallsyms])
    ^C#

    Signed-off-by: Naohiro Aota
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: Hemant Kumar
    Cc: Masami Hiramatsu
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/1470710408-23515-1-git-send-email-naohiro.aota@hgst.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Naohiro Aota
     
  • When we don't have a tracee (i.e. we're attaching to a task or CPU),
    counters can still be running after our workload finishes, and can still
    be running as we read their values. As we read events one-by-one, there
    can be arbitrary skew between values of events, even within a group.
    This means that ratios within an event group are not reliable.

    This skew can be seen if measuring a group of identical events, e.g:

    # perf stat -a -C0 -e '{cycles,cycles}' sleep 1

    To avoid this, we must stop groups from counting before we read the
    values of any constituent events. This patch adds and makes use of a new
    disable_counters() helper, which disables group leaders (and thus each
    group as a whole). This mirrors the use of enable_counters() for
    starting event groups in the absence of a tracee.

    Closing a group leader splits the group, and without a disabled group
    leader the newly split events will begin counting. Thus to ensure counts
    are reliable we must defer closing group leaders until all counts have
    been read. To do so this patch removes the event closing logic from the
    read_counters() helper, explicitly closes the events using
    perf_evlist__close(), which also aids legibility.

    Signed-off-by: Mark Rutland
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1470747869-3567-1-git-send-email-mark.rutland@arm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Mark Rutland
     
  • If module is "module" then dso->short_name is "[module]". Substring
    comparing is't enough: "raid10" matches to "[raid1]". This patch also
    checks terminating zero in module name.

    Signed-off-by: Konstantin Khlebnikov
    Acked-by: Masami Hiramatsu
    Link: http://lkml.kernel.org/r/147039975648.715620.12985971832789032159.stgit@buzz
    Signed-off-by: Arnaldo Carvalho de Melo

    Konstantin Khlebnikov
     
  • Adjust map->reloc offset for the unmapped address when finding
    alternative symbol address from map, because KASLR can relocate the
    kernel symbol address.

    The same adjustment has been done when finding appropriate kernel symbol
    address from map which was introduced by commit f90acac75713 ("perf
    probe: Find given address from offline dwarf")

    Reported-by: Arnaldo Carvalho de Melo
    Signed-off-by: Masami Hiramatsu
    Cc: Alexei Starovoitov
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/20160806192948.e366f3fbc4b194de600f8326@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • When we use libtraceevent to format trace event fields into printable
    strings to use in hist entries it is important to trim it from the
    default 4 KiB it starts with to what is really used, to reduce the
    memory footprint, so use realloc(seq.buffer, seq.len + 1) when returning
    the seq.buffer formatted with the fields contents.

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

    Arnaldo Carvalho de Melo
     
  • This adds the 'bpf-output' field to the perf script usage message, and docs.

    Signed-off-by: Brendan Gregg
    Cc: Alexander Shishkin
    Cc: Alexei Starovoitov
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/1470192469-11910-4-git-send-email-bgregg@netflix.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Brendan Gregg
     

06 Aug, 2016

2 commits

  • Pull perf updates from Ingo Molnar:
    "Mostly tooling fixes and some late tooling updates, plus two perf
    related printk message fixes"

    * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    perf tests bpf: Use SyS_epoll_wait alias
    perf tests: objdump output can contain multi byte chunks
    perf record: Add --sample-cpu option
    perf hists: Introduce output_resort_cb method
    perf tools: Move config/Makefile into Makefile.config
    perf tests: Add test for bitmap_scnprintf function
    tools lib: Add bitmap_and function
    tools lib: Add bitmap_scnprintf function
    tools lib: Add bitmap_alloc function
    tools lib traceevent: Ignore generated library files
    perf tools: Fix build failure on perl script context
    perf/core: Change log level for duration warning to KERN_INFO
    perf annotate: Plug filename string leak
    perf annotate: Introduce strerror for handling symbol__disassemble() errors
    perf annotate: Rename symbol__annotate() to symbol__disassemble()
    perf/x86: Modify error message in virtualized environment
    perf target: str_error_r() always returns the buffer it receives
    perf annotate: Use pipe + fork instead of popen
    perf evsel: Introduce constructor for cycles event

    Linus Torvalds
     
  • Pull NTB updates from Jon Mason:
    "NTB bug fixes for the ntb_tool and ntb_perf, and improvements to the
    ntb_perf and ntb_pingpong for increased debugability.

    Also, modification to the ntb_transport layer to increase/decrease
    the number of transport entries depending on the ring size"

    * tag 'ntb-4.8' of git://github.com/jonmason/ntb:
    NTB: ntb_hw_intel: use local variable pdev
    NTB: ntb_hw_intel: show BAR size in debugfs info
    ntb_test: Add a selftest script for the NTB subsystem
    ntb_perf: clear link_is_up flag when the link goes down.
    ntb_pingpong: Add a debugfs file to get the ping count
    ntb_tool: Add link status and files to debugfs
    ntb_tool: Postpone memory window initialization for the user
    ntb_perf: Wait for link before running test
    ntb_perf: Return results by reading the run file
    ntb_perf: Improve thread handling to increase robustness
    ntb_perf: Schedule based on time not on performance
    ntb_transport: Check the number of spads the hardware supports
    ntb_tool: Add memory window debug support
    ntb_perf: Allow limiting the size of the memory windows
    NTB: allocate number transport entries depending on size of ring size
    ntb_tool: BUG: Ensure the buffer size is large enough to return all spads
    ntb_tool: Fix infinite loop bug when writing spad/peer_spad file

    Linus Torvalds
     

05 Aug, 2016

2 commits

  • This script automates testing doorbells, scratchpads and memory windows
    for an NTB device. It can be run locally, with the NTB looped
    back to the same host or use SSH to remotely control the second host.

    In the single host case, the script just needs to be passed two
    arguments: a PCI ID for each side of the link. In the two host case
    the -r option must be used to specify the remote hostname (which must
    be SSH accessible and should probably have ssh-keys exchanged).

    A sample run looks like this:

    $ sudo ./ntb_test.sh 0000:03:00.1 0000:83:00.1 -p 29
    Starting ntb_tool tests...
    Running link tests on: 0000:03:00.1 / 0000:83:00.1
    Passed
    Running link tests on: 0000:83:00.1 / 0000:03:00.1
    Passed
    Running db tests on: 0000:03:00.1 / 0000:83:00.1
    Passed
    Running db tests on: 0000:83:00.1 / 0000:03:00.1
    Passed
    Running spad tests on: 0000:03:00.1 / 0000:83:00.1
    Passed
    Running spad tests on: 0000:83:00.1 / 0000:03:00.1
    Passed
    Running mw0 tests on: 0000:03:00.1 / 0000:83:00.1
    Passed
    Running mw0 tests on: 0000:83:00.1 / 0000:03:00.1
    Passed
    Running mw1 tests on: 0000:03:00.1 / 0000:83:00.1
    Passed
    Running mw1 tests on: 0000:83:00.1 / 0000:03:00.1
    Passed

    Starting ntb_pingpong tests...
    Running ping pong tests on: 0000:03:00.1 / 0000:83:00.1
    Passed

    Starting ntb_perf tests...
    Running local perf test without DMA
    0: copied 536870912 bytes in 164453 usecs, 3264 MBytes/s
    Passed
    Running remote perf test without DMA
    0: copied 536870912 bytes in 164453 usecs, 3264 MBytes/s
    Passed

    Signed-off-by: Logan Gunthorpe
    Acked-by: Shuah Khan
    Acked-by: Allen Hubbe
    Signed-off-by: Jon Mason

    Logan Gunthorpe
     
  • Pull RTC updates from Alexandre Belloni:
    "RTC for 4.8

    Cleanups:
    - huge cleanup of rtc-generic and char/genrtc this allowed to cleanup
    rtc-cmos, rtc-sh, rtc-m68k, rtc-powerpc and rtc-parisc
    - move mn10300 to rtc-cmos

    Subsystem:
    - fix wakealarms after hibernate
    - multiples fixes for rctest
    - simplify implementations of .read_alarm

    New drivers:
    - Maxim MAX6916

    Drivers:
    - ds1307: fix weekday
    - m41t80: add wakeup support
    - pcf85063: add support for PCF85063A variant
    - rv8803: extend i2c fix and other fixes
    - s35390a: fix alarm reading, this fixes instant reboot after
    shutdown for QNAP TS-41x
    - s3c: clock fixes"

    * tag 'rtc-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (65 commits)
    rtc: rv8803: Clear V1F when setting the time
    rtc: rv8803: Stop the clock while setting the time
    rtc: rv8803: Always apply the I²C workaround
    rtc: rv8803: Fix read day of week
    rtc: rv8803: Remove the check for valid time
    rtc: rv8803: Kconfig: Indicate rx8900 support
    rtc: asm9260: remove .owner field for driver
    rtc: at91sam9: Fix missing spin_lock_init()
    rtc: m41t80: add suspend handlers for alarm IRQ
    rtc: m41t80: make it a real error message
    rtc: pcf85063: Add support for the PCF85063A device
    rtc: pcf85063: fix year range
    rtc: hym8563: in .read_alarm set .tm_sec to 0 to signal minute accuracy
    rtc: explicitly set tm_sec = 0 for drivers with minute accurancy
    rtc: s3c: Add s3c_rtc_{enable/disable}_clk in s3c_rtc_setfreq()
    rtc: s3c: Remove unnecessary call to disable already disabled clock
    rtc: abx80x: use devm_add_action_or_reset()
    rtc: m41t80: use devm_add_action_or_reset()
    rtc: fix a typo and reduce three empty lines to one
    rtc: s35390a: improve two comments in .set_alarm
    ...

    Linus Torvalds
     

04 Aug, 2016

2 commits

  • …ernel/git/acme/linux into perf/urgent

    Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:

    New features:

    - Add --sample-cpu to 'perf record', to explicitely ask for sampling
    the CPU (Jiri Olsa)

    Fixes:

    - Fix processing of multi byte chunks in objdump output, fixing
    disassemble processing for annotation on at least ARM64 (Jan Stancek)

    - Use SyS_epoll_wait in a BPF 'perf test' entry instead of sys_epoll_wait, that
    is not present in the DWARF info in vmlinux files (Arnaldo Carvalho de Melo)

    - Add -wno-shadow when processing files using perl headers, fixing
    the build on Fedora Rawhide and Arch Linux (Namhyung Kim)

    Infrastructure changes:

    - Annotate prep work to better catch and report errors related to
    using objdump to disassemble DSOs (Arnaldo Carvalho de Melo)

    - Add 'alloc', 'scnprintf' and 'and' methods for bitmap processing (Jiri Olsa)

    - Add nested output resorting callback in hists processing (Jiri Olsa)

    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Ingo Molnar
     
  • Something made the sys_epoll_wait() function alias not to be found in
    the vmlinux DWARF info, being found only in /proc/kallsyms, which made
    the BPF perf tests to fail:

    [root@jouet ~]# perf test BPF
    37: Test BPF filter :
    37.1: Test basic BPF filtering : FAILED!
    37.2: Test BPF prologue generation : Skip
    37.3: Test BPF relocation checker : Skip
    [root@jouet ~]#

    Using -v we can see it is failing to find DWARF info for the probed function,
    sys_epoll_wait, which we can find in /proc/kallsyms but not in vmlinux with
    CONFIG_DEBUG_INFO:

    [root@jouet ~]# grep -w sys_epoll_wait /proc/kallsyms
    ffffffffbd295b50 T sys_epoll_wait
    [root@jouet ~]#

    [root@jouet ~]# readelf -wi /lib/modules/4.7.0+/build/vmlinux | grep -w sys_epoll_wait
    [root@jouet ~]#

    If we try to use perf probe:

    [root@jouet ~]# perf probe sys_epoll_wait
    Failed to find debug information for address ffffffffbd295b50
    Probe point 'sys_epoll_wait' not found.
    Error: Failed to add events.
    [root@jouet ~]#

    It all works if we use SyS_epoll_wait, that is just an alias to the probed
    function:

    [root@jouet ~]# grep -i sys_epoll_wait /proc/kallsyms
    ffffffffbd295b50 T SyS_epoll_wait
    ffffffffbd295b50 T sys_epoll_wait
    [root@jouet ~]#

    So use it:

    [root@jouet ~]# perf test BPF
    37: Test BPF filter :
    37.1: Test basic BPF filtering : Ok
    37.2: Test BPF prologue generation : Ok
    37.3: Test BPF relocation checker : Ok
    [root@jouet ~]#

    Further info:

    [root@jouet ~]# gcc --version
    gcc (GCC) 6.1.1 20160621 (Red Hat 6.1.1-3)
    [acme@jouet linux]$ cat /etc/fedora-release
    Fedora release 24 (Twenty Four)

    Investigation as to why it fails is still underway, but it was always
    going from sys_epoll_wait to SyS_epoll_wait when looking up the DWARF
    info in vmlinux, and this is what is breaking now.

    Switching to use SyS_epoll_wait allows this test to proceed and test the
    BPF code it was designed for, so lets have this in to allow passing this
    test while we fix the root cause.

    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-7hekjp0bodwjbb419sl2b55h@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

03 Aug, 2016

9 commits

  • Apparently, the tools/testing version dates to a few flags ago, and
    we've sprouted 4 new ones since. Keep in sync with the value in the
    main tree...

    Link: http://lkml.kernel.org/r/23400.1469702675@turing-police.cc.vt.edu
    Signed-off-by: Valdis Kletnieks
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Valdis Kletnieks
     
  • objdump's raw insn output can vary across architectures on the number of
    bytes per chunk (bpc) displayed and their endianness.

    The code-reading test relied on reading objdump output as 1 bpc. Kaixu
    Xia reported test failure on ARM64, where objdump displays 4 bpc:

    70c48: f90027bf str xzr, [x29,#72]
    70c4c: 91224000 add x0, x0, #0x890
    70c50: f90023a0 str x0, [x29,#64]

    This patch adds support to read raw insn output for any bpc length.
    In case of 2+ bpc it also guesses objdump's display endian.

    Reported-and-Tested-by: Kaixu Xia
    Signed-off-by: Jan Stancek
    Acked-by: Adrian Hunter
    Cc: Corey Ashford
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/07f0f7bcbda78deb423298708ef9b6a54d6b92bd.1452592712.git.jstancek@redhat.com
    [ Fix up pr_fmt() call to use %zd for size_t variables, fixing the build on Ubuntu cross-compiling to armhf and ppc64 ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Jan Stancek
     
  • Adding --sample-cpu option to be able to explicitly enable CPU sample
    type. Currently it's only enable implicitly in case the target is cpu
    related.

    It will be useful for following c2c record tool.

    Signed-off-by: Jiri Olsa
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1470074555-24889-8-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • When dealing with nested hist entries it's helpful to have a way to
    resort those nested objects.

    Adding optional callback call into output_resort function and following
    new interface function:

    typedef int (*hists__resort_cb_t)(struct hist_entry *he);

    void hists__output_resort_cb(struct hists *hists,
    struct ui_progress *prog,
    hists__resort_cb_t cb);

    Signed-off-by: Jiri Olsa
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1470074555-24889-7-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • There's no reason to keep it in separate directory now when we moved out
    the rest of the files.

    Signed-off-by: Jiri Olsa
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1470074555-24889-6-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Automatically test the bitmap_scnprintf function.

    Signed-off-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1470074555-24889-5-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Add support to perform logical and on bitmaps. Code taken from kernel's
    include/linux/bitmap.h.

    Signed-off-by: Jiri Olsa
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1470074555-24889-4-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Add support to print bitmap list. Code mostly taken from kernel's
    bitmap_list_string.

    Signed-off-by: Jiri Olsa
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1470074555-24889-3-git-send-email-jolsa@kernel.org
    [ s/bitmap_snprintf/bitmap_scnprintf/g as it is a scnprintf wrapper, having the same semantics wrt return value ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Adding bitmap_alloc function to dynamically allocate bitmap.

    Signed-off-by: Jiri Olsa
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20160802113302.GA7479@krava
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

02 Aug, 2016

6 commits

  • Signed-off-by: Namhyung Kim
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/20160802050148.3413-1-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • On my Archlinux machine, perf faild to build like below:

    CC scripts/perl/Perf-Trace-Util/Context.o
    In file included from /usr/lib/perl5/core/perl/CORE/perl.h:3905:0,
    from Context.xs:23:
    /usr/lib/perl5/core/perl/CORE/inline.h: In function :
    /usr/lib/perl5/core/perl/CORE/cop.h:612:13: warning: declaration of 'av'
    shadows a previous local [-Werror-shadow]
    AV *av =3D GvAV(PL_defgv);
    ^
    /usr/lib/perl5/core/perl/CORE/inline.h:526:5: note: in expansion of
    macro 'CX_POP_SAVEARRAY'
    CX_POP_SAVEARRAY(cx);
    ^~~~~~~~~~~~~~~~
    In file included from /usr/lib/perl5/core/perl/CORE/perl.h:5853:0,
    from Context.xs:23:
    /usr/lib/perl5/core/perl/CORE/inline.h:518:9: note:
    shadowed declaration is here
    AV *av;
    ^~

    What I did to fix is adding '-Wno-shadow' as the error message said it's
    the cause of the failure. Since it's from the perl (not perf) code
    base, we don't have the control so I just wanted to ignore the warning
    when compiling perl scripting code.

    Committer note:

    This also fixes the build on Fedora Rawhide.

    Signed-off-by: Namhyung Kim
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20160802024317.31725-1-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • If dso__build_id_filename(..., NULL, ...) returns !NULL its because it
    allocated it, so, when reaching the 'if (dso__is_kcore()) test, we
    already checked that and were just "fallbacking" to using
    dso->long_name, but without freeing filename, thus leaking it.

    Fix it by adding the dso__is_kcore() test to the 'or' group just after
    it, the one containing the full fallback code, including freeing the
    filename.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Fixes: ee205503f233 ("perf tools: Fix annotation with kcore")
    Link: http://lkml.kernel.org/n/tip-qi4rpjq8yo6myvg99kkgt0xz@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • We were just using pr_error() which makes it difficult for non stdio UIs
    to provide errors using its widgets, as they need to somehow catch what
    was passed to pr_error().

    Fix it by introducing a __strerror() interface like the ones used
    elsewhere, for instance target__strerror().

    This is just the initial step, more work will be done, but first some
    error handling bugs noticed while working on this need to be dealt with.

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

    Arnaldo Carvalho de Melo
     
  • …/kernel/git/shuah/linux-kselftest

    Pull kselftest updates from Shuah Khan:
    "This contains new tests and fixes:

    - a few fixes to existing tests

    - new media tests for testing driver unbind, and device removal paths
    while an user application is actively making system calls and
    ioctls"

    * tag 'linux-kselftest-4.8-rc1-update' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
    selftests: media_tests add a new video device test
    selftests: media_tests - Add media_device_open to .gitignore
    selftests: add media controller regression test scripts and document
    selftests: add media_device_open test
    selftests: media_device_test change it to randomize loop count
    selftests/vm: Don't mlockall MCL_CURRENT in on-fault-limit test
    selftests/vm: write strlen length instead of sizeof to nr_hugepages
    selftests/lib: set printf.sh executable

    Linus Torvalds
     
  • …kernel/git/shuah/linux-kselftest

    Pull kselftest fixes from Shuah Khan:

    - Add a new timer set-tz test case

    - Fix a bug in exec test Makefile dependency list

    * tag 'linux-kselftest-4.8-rc1-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
    selftests/exec: Makefile is a run-time dependency, add it to the install list
    kselftests: timers: Add set-tz test case

    Linus Torvalds