20 Sep, 2018

1 commit

  • There isn't subcommand `version` when typing `perf help`.

    Before :

    $ perf help | grep version
    usage: perf [--version] [--help] [OPTIONS] COMMAND [ARGS]

    So add perf-version in command-list.txt for listing it when typing `perf
    help`.

    After :

    $ perf help | grep version

    usage: perf [--version] [--help] [OPTIONS] COMMAND [ARGS]
    version display the version of perf binary

    Signed-off-by: Sangwon Hong
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Jin Yao
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Link: http://lkml.kernel.org/r/20180919074911.41931-1-qpakzk@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Sangwon Hong
     

19 Sep, 2018

14 commits

  • When building in ClearLinux using 'make PYTHON=python3' with gcc 8.2.1
    it fails with:

    GEN /tmp/build/perf/python/perf.so
    In file included from /usr/include/python3.7m/Python.h:126,
    from /git/linux/tools/perf/util/python.c:2:
    /usr/include/python3.7m/import.h:58:24: error: redundant redeclaration of ‘_PyImport_AddModuleObject’ [-Werror=redundant-decls]
    PyAPI_FUNC(PyObject *) _PyImport_AddModuleObject(PyObject *, PyObject *);
    ^~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/python3.7m/import.h:47:24: note: previous declaration of ‘_PyImport_AddModuleObject’ was here
    PyAPI_FUNC(PyObject *) _PyImport_AddModuleObject(PyObject *name,
    ^~~~~~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    error: command 'gcc' failed with exit status 1

    And indeed there is a redundant declaration in that Python.h file, one
    with parameter names and the other without, so just add
    -Wno-error=redundant-decls to the python setup instructions.

    Now perf builds with gcc in ClearLinux with the following Dockerfile:

    # docker.io/acmel/linux-perf-tools-build-clearlinux:latest
    FROM docker.io/clearlinux:latest
    MAINTAINER Arnaldo Carvalho de Melo
    RUN swupd update && \
    swupd bundle-add sysadmin-basic-dev
    RUN mkdir -m 777 -p /git /tmp/build/perf /tmp/build/objtool /tmp/build/linux && \
    groupadd -r perfbuilder && \
    useradd -m -r -g perfbuilder perfbuilder && \
    chown -R perfbuilder.perfbuilder /tmp/build/ /git/
    USER perfbuilder
    COPY rx_and_build.sh /
    ENV EXTRA_MAKE_ARGS=PYTHON=python3
    ENTRYPOINT ["/rx_and_build.sh"]

    Now to figure out why the build fails with clang, that is present in the
    above container as detected by the rx_and_build.sh script:

    clang version 6.0.1 (tags/RELEASE_601/final)
    Target: x86_64-unknown-linux-gnu
    Thread model: posix
    InstalledDir: /usr/sbin
    make: Entering directory '/git/linux/tools/perf'
    BUILD: Doing 'make -j4' parallel build
    HOSTCC /tmp/build/perf/fixdep.o
    HOSTLD /tmp/build/perf/fixdep-in.o
    LINK /tmp/build/perf/fixdep

    Auto-detecting system features:
    ... dwarf: [ OFF ]
    ... dwarf_getlocations: [ OFF ]
    ... glibc: [ OFF ]
    ... gtk2: [ OFF ]
    ... libaudit: [ OFF ]
    ... libbfd: [ OFF ]
    ... libelf: [ OFF ]
    ... libnuma: [ OFF ]
    ... numa_num_possible_cpus: [ OFF ]
    ... libperl: [ OFF ]
    ... libpython: [ OFF ]
    ... libslang: [ OFF ]
    ... libcrypto: [ OFF ]
    ... libunwind: [ OFF ]
    ... libdw-dwarf-unwind: [ OFF ]
    ... zlib: [ OFF ]
    ... lzma: [ OFF ]
    ... get_cpuid: [ OFF ]
    ... bpf: [ OFF ]

    Makefile.config:331: *** No gnu/libc-version.h found, please install glibc-dev[el]. Stop.
    make[1]: *** [Makefile.perf:206: sub-make] Error 2
    make: *** [Makefile:70: all] Error 2
    make: Leaving directory '/git/linux/tools/perf'

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

    Arnaldo Carvalho de Melo
     
  • Building the perf CTF converter fails with gcc 4.8.4 on Ubuntu 14.04
    with the following error:

    error: missing initializer for field ‘fd’ of ‘struct perf_data_file’
    [-Werror=missing-field-initializers]

    Per 4b838b0db4e9 ("perf tools: Add compression id into 'struct
    kmod_path'") and the ensuing discussion on the mailing list, it appears
    that this affects other distributions and gcc versions.

    Signed-off-by: Jeremie Galarneau
    Cc: Alexander Shishkin
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20180829201648.19588-1-jeremie.galarneau@efficios.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Jérémie Galarneau
     
  • It will be used outside of util object in following patches.

    Committer note:

    We need to have the header with the definition for loff_t in util.h
    since we now use it in the copyfile_offset() signature.

    Also move that prototype closer to the other copyfile_ prefixed
    functions.

    Signed-off-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Alexey Budankov
    Cc: Andi Kleen
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20180913125450.21342-10-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • The struct perf_mmap map argument will hold the file pointer to write
    the data to.

    Signed-off-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Alexey Budankov
    Cc: Andi Kleen
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20180913125450.21342-5-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • The perf_mmap struct will hold a file pointer to write the mmap's
    contents, so we need to propagate it down the stack to record__write
    callers instead of its member the auxtrace_mmap struct.

    Signed-off-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Alexey Budankov
    Cc: Andi Kleen
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20180913125450.21342-4-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Now that we keep a perf_tool pointer inside perf_session, there's no need
    to have a perf_tool argument in the event_op3 callback. Remove it.

    Signed-off-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Alexey Budankov
    Cc: Andi Kleen
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20180913125450.21342-3-jolsa@kernel.org
    [ Fix the builtin-inject.c build for !HAVE_AUXTRACE_SUPPORT ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Now that we keep a perf_tool pointer inside perf_session, there's no
    need to have a perf_tool argument in the event_op2 callback. Remove it.

    Signed-off-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Alexey Budankov
    Cc: Andi Kleen
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20180913125450.21342-2-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Use PTR_ERR_OR_ZERO() in bpf__setup_stdout() return code instead of open
    coded equivalent.

    Signed-off-by: Ding Xiang
    Cc: Alexander Shishkin
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1536284082-23466-2-git-send-email-dingxiang@cmss.chinamobile.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Ding Xiang
     
  • Add PTR_ERR_OR_ZERO, so that tools can use it, just like the kernel.

    Signed-off-by: Ding Xiang
    Cc: Alexander Shishkin
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1536284082-23466-1-git-send-email-dingxiang@cmss.chinamobile.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Ding Xiang
     
  • Stephane reported a possible issue in the ordered events code, which
    could lead to allocating more memory than guarded by max_alloc_size.

    He also suggested the fix to properly check that the new size is below
    the max_alloc_size limit.

    Reported-by: Stephane Eranian
    Suggested-by: Stephane Eranian
    Signed-off-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20180907102455.7030-2-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • When ordering events, we use preallocated buffers to store separate
    events. Those buffers currently don't have their own struct, but since
    they are basically an array of 'struct ordered_event' objects, we use
    the first event to hold buffers data - list head, that holds all buffers
    together:

    struct ordered_events {
    ...
    struct ordered_event *buffer;
    ...
    };

    struct ordered_event {
    u64 timestamp;
    u64 file_offset;
    union perf_event *event;
    struct list_head list;
    };

    This is quite convoluted and error prone as demonstrated by free-ing
    issue discovered and fixed by Stephane in here [1].

    This patch adds the 'struct ordered_events_buffer' object, that holds
    the buffer data and frees it up properly.

    [1] - https://marc.info/?l=linux-kernel&m=153376761329335&w=2

    Reported-by: Stephane Eranian
    Signed-off-by: Jiri Olsa
    Tested-by: Stephane Eranian
    Acked-by: Namhyung Kim
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: David Ahern
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20180907102455.7030-1-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • We don't have a 'perf test' entry available to test the watchpoint
    functionality.

    Add a simple set of tests:

    - Read only watchpoint
    - Write only watchpoint
    - Read / Write watchpoint
    - Runtime watchpoint modification

    Ex.: on powerpc:

    $ sudo perf test 22
    22: Watchpoint :
    22.1: Read Only Watchpoint : Ok
    22.2: Write Only Watchpoint : Ok
    22.3: Read / Write Watchpoint : Ok
    22.4: Modify Watchpoint : Ok

    Signed-off-by: Ravi Bangoria
    Acked-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: Hendrik Brueckner
    Cc: Kate Stewart
    Cc: Kim Phillips
    Cc: Namhyung Kim
    Cc: Naveen N. Rao
    Cc: Sandipan Das
    Cc: Thomas Gleixner
    Cc: Thomas Richter
    Link: http://lkml.kernel.org/r/20180912061229.22832-1-ravi.bangoria@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Ravi Bangoria
     
  • It has been pointed out to me many times that it is useful to be able to
    switch off AUX records to save the bandwidth for records that actually
    matter, for example, in AUX overwrite mode.

    The usefulness of PERF_RECORD_AUX is in some of its flags, like the
    TRUNCATED flag that tells the decoder where exactly gaps in the trace
    are. The OVERWRITE flag, on the other hand will be set on every single
    record in overwrite mode. However, a PERF_RECORD_AUX[flags=OVERWRITE] is
    generated on every target task's sched_out, which over time adds up to a
    lot of useless information.

    If any folks out there have userspace that depends on a constant stream
    of OVERWRITE records for a good reason, they'll have to let us know.

    Signed-off-by: Alexander Shishkin
    Acked-by: Ingo Molnar
    Acked-by: Peter Zijlstra
    Acked-by: Will Deacon
    Cc: Adrian Hunter
    Cc: Markus T Metzger
    Link: http://lkml.kernel.org/r/20180404145323.28651-1-alexander.shishkin@linux.intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Alexander Shishkin
     
  • To pick up fixes.

    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

18 Sep, 2018

2 commits

  • The dependency for the man page rule using asciidoctor incorrectly
    specifies a source file in $(OUTPUT). When building out-of-tree, the
    source file is not found, resulting in a fall-back to the following rule
    which uses xmlto.

    Signed-off-by: Ben Hutchings
    Cc: Alexander Shishkin
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20180916151704.GF4765@decadent.org.uk
    Fixes: ffef80ecf89f ("perf Documentation: Support for asciidoctor")
    Signed-off-by: Arnaldo Carvalho de Melo

    Ben Hutchings
     
  • Same problem that got fixed in a similar fashion in tools/perf/ in
    c8b5f2c96d1b ("tools: Introduce str_error_r()"), fix it in the same
    way, licensing needs to be sorted out to libbpf to use libapi, so,
    for this simple case, just get the same wrapper in tools/lib/bpf.

    This makes libbpf and its users (bpftool, selftests, perf) to build
    again in Alpine Linux 3.[45678] and edge.

    Acked-by: Alexei Starovoitov
    Cc: Adrian Hunter
    Cc: Daniel Borkmann
    Cc: David Ahern
    Cc: Hendrik Brueckner
    Cc: Jakub Kicinski
    Cc: Jiri Olsa
    Cc: Martin KaFai Lau
    Cc: Namhyung Kim
    Cc: Quentin Monnet
    Cc: Thomas Richter
    Cc: Wang Nan
    Cc: Yonghong Song
    Fixes: 1ce6a9fc1549 ("bpf: fix build error in libbpf with EXTRA_CFLAGS="-Wp, -D_FORTIFY_SOURCE=2 -O2"")
    Link: https://lkml.kernel.org/r/20180917151636.GA21790@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

13 Sep, 2018

2 commits

  • 'pt_cap_group' is written to in pt_pmu_hw_init() and not modified after.
    This makes it a suitable candidate for annotating as __ro_after_init.

    Signed-off-by: Zubin Mithra
    Reviewed-by: Guenter Roeck
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: keescook@chromium.org
    Link: http://lkml.kernel.org/r/20180912164510.23444-1-zsm@chromium.org
    Signed-off-by: Ingo Molnar

    Zubin Mithra
     
  • …linux/kernel/git/acme/linux into perf/urgent

    Pull perf/urgent fixes from Arnaldo Carvalho de Melo:

    - Fix finding a symbol by name when multiple maps use the same backing DSO,
    so we must first see if that symbol name is in the DSO, then see if it is
    inside the range of addresses for that specific map (Adrian Hunter)

    - Update the tools copies of UAPI headers, which silences the warnings
    emitted when building the tools and in some cases, like for the new
    KVM ioctls, results in 'perf trace' being able to translate that
    ioctl number to a string (Arnaldo Carvalho de Melo)

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

    Ingo Molnar
     

12 Sep, 2018

9 commits

  • Instead of calling BUG_ON(), if we find a kprobe in use on free kprobe
    list, just remove it from the list and keep it on kprobe hash list
    as same as other in-use kprobes.

    Signed-off-by: Masami Hiramatsu
    Cc: Anil S Keshavamurthy
    Cc: David S . Miller
    Cc: Linus Torvalds
    Cc: Naveen N . Rao
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/153666126882.21306.10738207224288507996.stgit@devbox
    Signed-off-by: Ingo Molnar

    Masami Hiramatsu
     
  • Make reuse_unused_kprobe() to return error code if
    it fails to reuse unused kprobe for optprobe instead
    of calling BUG_ON().

    Signed-off-by: Masami Hiramatsu
    Cc: Anil S Keshavamurthy
    Cc: David S . Miller
    Cc: Linus Torvalds
    Cc: Naveen N . Rao
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/153666124040.21306.14150398706331307654.stgit@devbox
    Signed-off-by: Ingo Molnar

    Masami Hiramatsu
     
  • Since reuse_unused_kprobe() is called when the given kprobe
    is unused, checking it inside again with BUG_ON() is
    pointless. Remove it.

    Signed-off-by: Masami Hiramatsu
    Cc: Anil S Keshavamurthy
    Cc: David S . Miller
    Cc: Linus Torvalds
    Cc: Naveen N . Rao
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/153666121154.21306.17540752948574483565.stgit@devbox
    Signed-off-by: Ingo Molnar

    Masami Hiramatsu
     
  • Before calling add_new_kprobe(), aggr_probe's GONE
    flag and kprobe GONE flag are cleared. We don't need
    to worry about that flag at this point.

    Signed-off-by: Masami Hiramatsu
    Cc: Anil S Keshavamurthy
    Cc: David S . Miller
    Cc: Linus Torvalds
    Cc: Naveen N . Rao
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/153666118298.21306.4915366706875652652.stgit@devbox
    Signed-off-by: Ingo Molnar

    Masami Hiramatsu
     
  • All aggr_probes at this line are already disarmed by
    disable_kprobe() or checked by kprobe_disarmed().

    So this BUG_ON() is pointless, remove it.

    Signed-off-by: Masami Hiramatsu
    Cc: Anil S Keshavamurthy
    Cc: David S . Miller
    Cc: Linus Torvalds
    Cc: Naveen N . Rao
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/153666115463.21306.8799008438116029806.stgit@devbox
    Signed-off-by: Ingo Molnar

    Masami Hiramatsu
     
  • Commit 1c5aae7710bb ("perf machine: Create maps for x86 PTI entry
    trampolines") revealed a problem with maps__find_symbol_by_name() that
    resulted in probes not being found e.g.

    $ sudo perf probe xsk_mmap
    xsk_mmap is out of .text, skip it.
    Probe point 'xsk_mmap' not found.
    Error: Failed to add events.

    maps__find_symbol_by_name() can optionally return the map of the found
    symbol. It can get the map wrong because, in fact, the symbol is found
    on the map's dso, not allowing for the possibility that the dso has more
    than one map. Fix by always checking the map contains the symbol.

    Reported-by: Björn Töpel
    Signed-off-by: Adrian Hunter
    Tested-by: Björn Töpel
    Cc: Jiri Olsa
    Cc: stable@vger.kernel.org
    Fixes: 1c5aae7710bb ("perf machine: Create maps for x86 PTI entry trampolines")
    Link: http://lkml.kernel.org/r/20180907085116.25782-1-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     
  • To get the changes in:

    3e7a50ceb11e ("net: report min and max mtu network device settings")
    2756f68c3149 ("net: bridge: add support for backup port")
    a25717d2b604 ("xdp: support simultaneous driver and hw XDP attachment")
    4f91da26c811 ("xdp: add per mode attributes for attached programs")
    f203b76d7809 ("xfrm: Add virtual xfrm interfaces")

    Silencing this libbpf build warning:

    Warning: Kernel ABI header at 'tools/include/uapi/linux/if_link.h' differs from latest version at 'include/uapi/linux/if_link.h'

    Cc: Adrian Hunter
    Cc: Daniel Borkmann
    Cc: David Ahern
    Cc: David S. Miller
    Cc: Jakub Kicinski
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Nikolay Aleksandrov
    Cc: Steffen Klassert
    Cc: Stephen Hemminger
    Cc: Wang Nan
    Link: https://lkml.kernel.org/n/tip-xd9ztioa894zemv8ag8kg64u@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • To get the changes in:

    c48300c92ad9 ("vhost: fix VHOST_GET_BACKEND_FEATURES ioctl request definition")

    This makes 'perf trace' and other tools in the future using its
    beautifiers in a libbeauty.so library be able to translate these new
    ioctl to strings:

    $ tools/perf/trace/beauty/vhost_virtio_ioctl.sh > /tmp/after
    $ diff -u /tmp/before /tmp/after
    --- /tmp/before 2018-09-11 13:10:57.923038244 -0300
    +++ /tmp/after 2018-09-11 13:11:20.329012685 -0300
    @@ -15,6 +15,7 @@
    [0x22] = "SET_VRING_ERR",
    [0x23] = "SET_VRING_BUSYLOOP_TIMEOUT",
    [0x24] = "GET_VRING_BUSYLOOP_TIMEOUT",
    + [0x25] = "SET_BACKEND_FEATURES",
    [0x30] = "NET_SET_BACKEND",
    [0x40] = "SCSI_SET_ENDPOINT",
    [0x41] = "SCSI_CLEAR_ENDPOINT",
    @@ -27,4 +28,5 @@
    static const char *vhost_virtio_ioctl_read_cmds[] = {
    [0x00] = "GET_FEATURES",
    [0x12] = "GET_VRING_BASE",
    + [0x26] = "GET_BACKEND_FEATURES",
    };
    $

    We'll also use this to be able to express syscall filters using symbolic
    these symbolic names, something like:

    # perf trace --all-cpus -e ioctl(cmd=*GET_FEATURES)

    This silences the following warning during perf's build:

    Warning: Kernel ABI header at 'tools/include/uapi/linux/vhost.h' differs from latest version at 'include/uapi/linux/vhost.h'
    diff -u tools/include/uapi/linux/vhost.h include/uapi/linux/vhost.h

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: David S. Miller
    Cc: Gleb Fotengauer-Malinovskiy
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: https://lkml.kernel.org/n/tip-35x71oei2hdui9u0tarpimbq@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • To get the changes in:

    a449938297e5 ("KVM: s390: Add huge page enablement control")
    8fcc4b5923af ("kvm: nVMX: Introduce KVM_CAP_NESTED_STATE")
    be26b3a73413 ("arm64: KVM: export the capability to set guest SError syndrome")
    b7b27facc7b5 ("arm/arm64: KVM: Add KVM_GET/SET_VCPU_EVENTS")
    b0960b9569db ("KVM: arm: Add 32bit get/set events support")
    a3da7b4a3be5 ("KVM: s390: add etoken support for guests")

    This makes 'perf trace' automagically get aware of these new ioctls:

    $ cp include/uapi/linux/kvm.h tools/include/uapi/linux/kvm.h
    $ tools/perf/trace/beauty/kvm_ioctl.sh > /tmp/after
    $ diff -u /tmp/before /tmp/after
    --- /tmp/before 2018-09-11 11:18:29.173207586 -0300
    +++ /tmp/after 2018-09-11 11:18:38.488200446 -0300
    @@ -84,6 +84,8 @@
    [0xbb] = "MEMORY_ENCRYPT_REG_REGION",
    [0xbc] = "MEMORY_ENCRYPT_UNREG_REGION",
    [0xbd] = "HYPERV_EVENTFD",
    + [0xbe] = "GET_NESTED_STATE",
    + [0xbf] = "SET_NESTED_STATE",
    [0xe0] = "CREATE_DEVICE",
    [0xe1] = "SET_DEVICE_ATTR",
    [0xe2] = "G

    And cures the following warning during perf's build:

    Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
    diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h

    Cc: Adrian Hunter
    Cc: Christian Borntraeger
    Cc: Cornelia Huck
    Cc: David Ahern
    Cc: David Hildenbrand
    Cc: Dongjiu Geng
    Cc: Eduardo Habkost
    Cc: James Morse
    Cc: Janosch Frank
    Cc: Jim Mattson
    Cc: Jiri Olsa
    Cc: Marc Zyngier
    Cc: Namhyung Kim
    Cc: Paolo Bonzini
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: https://lkml.kernel.org/n/tip-2vvwh2o19orn56di0ksrtgzr@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

11 Sep, 2018

3 commits

  • To get the changes in:

    d67b6a206507 ("drm: writeback: Add client capability for exposing writeback connectors")

    This is for an argument to a DRM ioctl, which is not being prettyfied in
    the 'perf trace' DRM ioctl beautifier, but will now that syscalls are
    starting to have pointer arguments augmented via BPF.

    This time around this just cures the following warning during perf's
    build:

    Warning: Kernel ABI header at 'tools/include/uapi/drm/drm.h' differs from latest version at 'include/uapi/drm/drm.h'
    diff -u tools/include/uapi/drm/drm.h include/uapi/drm/drm.h

    Cc: Adrian Hunter
    Cc: Brian Starkey
    Cc: David Ahern
    Cc: Eric Anholt
    Cc: Jiri Olsa
    Cc: Liviu Dudau
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Sean Paul
    Cc: Wang Nan
    Link: https://lkml.kernel.org/n/tip-n7qib1bac6mc6w9oke7r4qdc@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • To get the changes in:

    db7a2d1809a5 ("asm-generic: unistd.h: Wire up sys_rseq")

    That wires up the new 'rsec' system call, which will automagically
    support that syscall in the syscall table used by 'perf trace' on
    arm/arm64.

    This cures the following warning during perf's build:

    Warning: Kernel ABI header at 'tools/include/uapi/asm-generic/unistd.h' differs from latest version at 'include/uapi/asm-generic/unistd.h'
    diff -u tools/include/uapi/asm-generic/unistd.h include/uapi/asm-generic/unistd.h

    Cc: Adrian Hunter
    Cc: Alexander Shishkin
    Cc: Arnd Bergmann
    Cc: David Ahern
    Cc: Hendrik Brueckner
    Cc: Jiri Olsa
    Cc: Kim Phillips
    Cc: Mathieu Desnoyers
    Cc: Michael Ellerman
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Ravi Bangoria
    Cc: Thomas Richter
    Cc: Wang Nan
    Cc: Will Deacon
    Link: https://lkml.kernel.org/n/tip-vt7k2itnitp1t9p3dp7qeb08@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • To get the changes in:

    09121255c784 ("perf/UAPI: Clearly mark __PERF_SAMPLE_CALLCHAIN_EARLY as internal use")

    This cures the following warning during perf's build:

    Warning: Kernel ABI header at 'tools/include/uapi/linux/perf_event.h' differs from latest version at 'include/uapi/linux/perf_event.h'
    diff -u tools/include/uapi/linux/perf_event.h include/uapi/linux/perf_event.h

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

    Arnaldo Carvalho de Melo
     

10 Sep, 2018

6 commits

  • x86_pmu_{format,events,attr,caps}_group is written to in
    init_hw_perf_events and not modified after. This makes them suitable
    candidates for annotating as __ro_after_init.

    Signed-off-by: Zubin Mithra
    Reviewed-by: Kees Cook
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: acme@kernel.org
    Cc: alexander.shishkin@linux.intel.com
    Cc: groeck@chromium.org
    Link: http://lkml.kernel.org/r/20180810154314.96710-1-zsm@chromium.org
    Signed-off-by: Ingo Molnar

    Zubin Mithra
     
  • Perf can record user stack data in response to a synchronous request, such
    as a tracepoint firing. If this happens under set_fs(KERNEL_DS), then we
    end up reading user stack data using __copy_from_user_inatomic() under
    set_fs(KERNEL_DS). I think this conflicts with the intention of using
    set_fs(KERNEL_DS). And it is explicitly forbidden by hardware on ARM64
    when both CONFIG_ARM64_UAO and CONFIG_ARM64_PAN are used.

    So fix this by forcing USER_DS when recording user stack data.

    Signed-off-by: Yabin Cui
    Acked-by: Peter Zijlstra (Intel)
    Cc:
    Cc: Alexander Shishkin
    Cc: Arnaldo Carvalho de Melo
    Cc: Jiri Olsa
    Cc: Linus Torvalds
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Fixes: 88b0193d9418 ("perf/callchain: Force USER_DS when invoking perf_callchain_user()")
    Link: http://lkml.kernel.org/r/20180823225935.27035-1-yabinc@google.com
    Signed-off-by: Ingo Molnar

    Yabin Cui
     
  • Vince noted that commit:

    6cbc304f2f36 ("perf/x86/intel: Fix unwind errors from PEBS entries (mk-II)")

    'leaked' __PERF_SAMPLE_CALLCHAIN_EARLY into the UAPI namespace. And
    while sys_perf_event_open() will error out if you try to use it, it is
    exposed.

    Clearly mark it for internal use only to avoid any confusion.

    Requested-by: Vince Weaver
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • Problem: perf did not show branch predicted/mispredicted bit in brstack.

    Output of perf -F brstack for profile collected

    Before:

    0x4fdbcd/0x4fdc03/-/-/-/0
    0x45f4c1/0x4fdba0/-/-/-/0
    0x45f544/0x45f4bb/-/-/-/0
    0x45f555/0x45f53c/-/-/-/0
    0x7f66901cc24b/0x45f555/-/-/-/0
    0x7f66901cc22e/0x7f66901cc23d/-/-/-/0
    0x7f66901cc1ff/0x7f66901cc20f/-/-/-/0
    0x7f66901cc1e8/0x7f66901cc1fc/-/-/-/0

    After:

    0x4fdbcd/0x4fdc03/P/-/-/0
    0x45f4c1/0x4fdba0/P/-/-/0
    0x45f544/0x45f4bb/P/-/-/0
    0x45f555/0x45f53c/P/-/-/0
    0x7f66901cc24b/0x45f555/P/-/-/0
    0x7f66901cc22e/0x7f66901cc23d/P/-/-/0
    0x7f66901cc1ff/0x7f66901cc20f/P/-/-/0
    0x7f66901cc1e8/0x7f66901cc1fc/P/-/-/0

    Cause:

    As mentioned in Software Development Manual vol 3, 17.4.8.1,
    IA32_PERF_CAPABILITIES[5:0] indicates the format of the address that is
    stored in the LBR stack. Knights Landing reports 1 (LBR_FORMAT_LIP) as
    its format. Despite that, registers containing FROM address of the branch,
    do have MISPREDICT bit but because of the format indicated in
    IA32_PERF_CAPABILITIES[5:0], LBR did not read MISPREDICT bit.

    Solution:

    Teach LBR about above Knights Landing quirk and make it read MISPREDICT bit.

    Signed-off-by: Jacek Tomaka
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/20180802013830.10600-1-jacekt@dugeo.com
    Signed-off-by: Ingo Molnar

    Jacek Tomaka
     
  • Signed-off-by: Ingo Molnar

    Ingo Molnar
     
  • …linux/kernel/git/acme/linux into perf/urgent

    Pull perf/urgent fixes from Arnaldo Carvalho de Melo:

    Kernel:

    - Modify breakpoint fixes (Jiri Olsa)

    perf annotate:

    - Fix parsing aarch64 branch instructions after objdump update (Kim Phillips)

    - Fix parsing indirect calls in 'perf annotate' (Martin Liška)

    perf probe:

    - Ignore SyS symbols irrespective of endianness on PowerPC (Sandipan Das)

    perf trace:

    - Fix include path for asm-generic/unistd.h on arm64 (Kim Phillips)

    Core libraries:

    - Fix potential null pointer dereference in perf_evsel__new_idx() (Hisao Tanabe)

    - Use fixed size string for comms instead of scanf("%m"), that is
    not present in the bionic libc and leads to a crash (Chris Phlipot)

    - Fix bad memory access in trace info on 32-bit systems, we were reading
    8 bytes from a 4-byte long variable when saving the command line in the
    perf.data file. (Chris Phlipot)

    Build system:

    - Streamline bpf examples and headers installation, clarifying
    some install messages. (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 Sep, 2018

3 commits

  • Pull x86 fixes from Thomas Gleixner:
    "A set of fixes for x86:

    - Prevent multiplication result truncation on 32bit. Introduced with
    the early timestamp reworrk.

    - Ensure microcode revision storage to be consistent under all
    circumstances

    - Prevent write tearing of PTEs

    - Prevent confusion of user and kernel reegisters when dumping fatal
    signals verbosely

    - Make an error return value in a failure path of the vector
    allocation negative. Returning EINVAL might the caller assume
    success and causes further wreckage.

    - A trivial kernel doc warning fix"

    * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86/mm: Use WRITE_ONCE() when setting PTEs
    x86/apic/vector: Make error return value negative
    x86/process: Don't mix user/kernel regs in 64bit __show_regs()
    x86/tsc: Prevent result truncation on 32bit
    x86: Fix kernel-doc atomic.h warnings
    x86/microcode: Update the new microcode revision unconditionally
    x86/microcode: Make sure boot_cpu_data.microcode is up-to-date

    Linus Torvalds
     
  • Pull timekeeping fixes from Thomas Gleixner:
    "Two fixes for timekeeping:

    - Revert to the previous kthread based update, which is unfortunately
    required due to lock ordering issues. The removal caused boot
    failures on old Core2 machines. Add a proper comment why the thread
    needs to stay to prevent accidental removal in the future.

    - Fix a silly typo in a function declaration"

    * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    clocksource: Revert "Remove kthread"
    timekeeping: Fix declaration of read_persistent_wall_and_boot_offset()

    Linus Torvalds
     
  • Pull irqchip fix from Thomas Gleixner:
    "A single fix to prevent allocating excessive memory in the GIC/ITS
    driver.

    While the subject of the patch might suggest otherwise this is a real
    fix as some SoCs exceed the memory allocation limits and fail to boot"

    * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    irqchip/gic-v3-its: Cap lpi_id_bits to reduce memory footprint

    Linus Torvalds