13 Jan, 2019

1 commit

  • commit 7ed1c1901fe52e6c5828deb155920b44b0adabb1 upstream.

    Currently a number of Makefiles break when used with toolchains that
    pass extra flags in CC and other cross-compile related variables (such
    as --sysroot).

    Thus we get this error when we use a toolchain that puts --sysroot in
    the CC var:

    ~/src/linux/tools$ make iio
    [snip]
    iio_event_monitor.c:18:10: fatal error: unistd.h: No such file or directory
    #include
    ^~~~~~~~~~

    This occurs because we clobber several env vars related to
    cross-compiling with lines like this:

    CC = $(CROSS_COMPILE)gcc

    Although this will point to a valid cross-compiler, we lose any extra
    flags that might exist in the CC variable, which can break toolchains
    that rely on them (for example, those that use --sysroot).

    This easily shows up using a Yocto SDK:

    $ . [snip]/sdk/environment-setup-cortexa8hf-neon-poky-linux-gnueabi

    $ echo $CC
    arm-poky-linux-gnueabi-gcc -march=armv7-a -mfpu=neon -mfloat-abi=hard
    -mcpu=cortex-a8
    --sysroot=[snip]/sdk/sysroots/cortexa8hf-neon-poky-linux-gnueabi

    $ echo $CROSS_COMPILE
    arm-poky-linux-gnueabi-

    $ echo ${CROSS_COMPILE}gcc
    krm-poky-linux-gnueabi-gcc

    Although arm-poky-linux-gnueabi-gcc is a cross-compiler, we've lost the
    --sysroot and other flags that enable us to find the right libraries to
    link against, so we can't find unistd.h and other libraries and headers.
    Normally with the --sysroot flag we would find unistd.h in the sdk
    directory in the sysroot:

    $ find [snip]/sdk/sysroots -path '*/usr/include/unistd.h'
    [snip]/sdk/sysroots/cortexa8hf-neon-poky-linux-gnueabi/usr/include/unistd.h

    The perf Makefile adds CC = $(CROSS_COMPILE)gcc if and only if CC is not
    already set, and it compiles correctly with the above toolchain.

    So, generalize the logic that perf uses in the common Makefile and
    remove the manual CC = $(CROSS_COMPILE)gcc lines from each Makefile.

    Note that this patch does not fix cross-compile for all the tools (some
    have other bugs), but it does fix it for all except usb and acpi, which
    still have other unrelated issues.

    I tested both with and without the patch on native and cross-build and
    there appear to be no regressions.

    Link: http://lkml.kernel.org/r/20180107214028.23771-1-martin@martingkelly.com
    Signed-off-by: Martin Kelly
    Acked-by: Mark Brown
    Cc: Tejun Heo
    Cc: Li Zefan
    Cc: Johannes Weiner
    Cc: Linus Walleij
    Cc: "K. Y. Srinivasan"
    Cc: Haiyang Zhang
    Cc: Stephen Hemminger
    Cc: Jonathan Cameron
    Cc: Pali Rohar
    Cc: Richard Purdie
    Cc: Jacek Anaszewski
    Cc: Pavel Machek
    Cc: Peter Zijlstra
    Cc: Ingo Molnar
    Cc: Arnaldo Carvalho de Melo
    Cc: Robert Moore
    Cc: Lv Zheng
    Cc: "Rafael J. Wysocki"
    Cc: Greg Kroah-Hartman
    Cc: Valentina Manea
    Cc: Shuah Khan
    Cc: Mario Limonciello
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Cc: Ignat Korchagin
    Signed-off-by: Greg Kroah-Hartman

    Martin Kelly
     

30 May, 2018

1 commit

  • [ Upstream commit c2fb54a183cfe77c6fdc9d71e2d5299c1c302a6e ]

    For libclang, some distro packages provide static libraries (.a) while
    some provide shared libraries (.so). Currently, perf code can only be
    linked with static libraries. This makes perf build possible for both
    cases.

    Signed-off-by: Sandipan Das
    Cc: Jiri Olsa
    Cc: Naveen N. Rao
    Fixes: d58ac0bf8d1e ("perf build: Add clang and llvm compile and linking support")
    Link: http://lkml.kernel.org/r/20180404180419.19056-1-sandipan@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sandipan Das
     

29 Aug, 2017

3 commits

  • Reuse 'mprotect' beautifiers for 'pkey_mprotect'.

    System wide tracing pkey_alloc, pkey_free and pkey_mprotect calls, with
    backtraces:

    # perf trace -e pkey_alloc,pkey_mprotect,pkey_free --max-stack=5
    0.000 ( 0.011 ms): pkey/7818 pkey_alloc(init_val: DISABLE_ACCESS|DISABLE_WRITE) = -1 EINVAL Invalid argument
    syscall (/usr/lib64/libc-2.25.so)
    pkey_alloc (/home/acme/c/pkey)
    0.022 ( 0.003 ms): pkey/7818 pkey_mprotect(start: 0x7f28c3890000, len: 4096, prot: READ|WRITE, pkey: -1) = 0
    syscall (/usr/lib64/libc-2.25.so)
    pkey_mprotect (/home/acme/c/pkey)
    0.030 ( 0.002 ms): pkey/7818 pkey_free(pkey: -1 ) = -1 EINVAL Invalid argument
    syscall (/usr/lib64/libc-2.25.so)
    pkey_free (/home/acme/c/pkey)

    The tools/include/uapi/asm-generic/mman-common.h file is used to find
    the access rights defines for the pkey_alloc syscall second argument.

    Since we have the detector of changes for the tools/include header files
    versus its kernel origin (include/uapi/asm-generic/mman-common.h), we'll
    get whatever new flag appears for that argument automatically.

    This method should be used in other cases where it is easy to generate
    those flags tables because the header has properly namespaced defines
    like PKEY_DISABLE_ACCESS and PKEY_DISABLE_WRITE.

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

    Arnaldo Carvalho de Melo
     
  • When building with an external FEATURES_DUMP, bpf complains
    that features dump file is not found. Fix it by passing full file path.

    Signed-off-by: David Carrillo-Cisneros
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Paul Turner
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/20170827075442.108534-7-davidcc@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    David Carrillo-Cisneros
     
  • Allow user to define flex and bison binary names by passing FLEX and
    BISON variables.

    Signed-off-by: David Carrillo-Cisneros
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Paul Turner
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/20170827075442.108534-3-davidcc@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    David Carrillo-Cisneros
     

28 Aug, 2017

1 commit

  • We can't pass --dynamic-list list into static build anymore, because
    compilers starts to scream about that. Fedora 26 started to fail build
    with following error:

    $ make LDFLAGS=-static
    ...
    /usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer equality in `/usr/lib/gcc/x86_64-redhat-linux/7/../../../../lib64/libc.a(strcmp.o
    +)' can not be used when making an executable; recompile with -fPIE and relink with -pie

    There's no sense for --dynamic-list in static build, because there's no
    .dynsym table in static binary. Consequently the traceevent plugins have
    never worked with static build, but it was quietly passed by.

    To fix this in future I think we should add support to compile plugins
    within the perf binary directly for static build.

    Reported-and-Tested-by: Arnaldo Carvalho de Melo
    Signed-off-by: Jiri Olsa
    Link: http://lkml.kernel.org/n/tip-jeg6a7ff9j9hlqn8k4gllzvv@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

12 Aug, 2017

2 commits

  • Multiple tests will be able to reuse these functions, to test things
    like perf report, 'trace', etc, using this probe.

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

    Arnaldo Carvalho de Melo
     
  • Now that we have shell tests, install them.

    Developers don't need this pass, as 'perf test' will look first at the
    in tree scripts at tools/perf/tests/shell/.

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

    Arnaldo Carvalho de Melo
     

02 Aug, 2017

5 commits

  • Also trying a new approach, using the copy of uapi/linux/perf_event.h we
    auto generate the string tables, then include it in the ioctl cmd
    beautifier.

    This way either the perf developers will add the new commands to the
    tools/ copy, like is happening with other areas of tools/include/ (bpf.h
    comes to mind), or we'll be notified when building perf that our copy
    drifted.

    E.g., looking at some of the perf ioctls issued by the 'perf test' test cases:

    # (perf trace -e perf_event_open,ioctl perf test) 2>&1 | egrep "(cmd: PERF_|perf_event_open)"
    4: Read samples using the mmap interface :
    348.811 ( 0.062 ms): perf/23351 perf_event_open(attr_uptr: 0x414a5e8, pid: 23351 (perf), group_fd: -1, flags: FD_CLOEXEC) = 3
    348.878 ( 0.039 ms): perf/23351 perf_event_open(attr_uptr: 0x414a5e8, pid: 23351 (perf), cpu: 1, group_fd: -1, flags: FD_CLOEXEC) = 4
    348.919 ( 0.036 ms): perf/23351 perf_event_open(attr_uptr: 0x414a5e8, pid: 23351 (perf), cpu: 2, group_fd: -1, flags: FD_CLOEXEC) = 5
    348.958 ( 0.036 ms): perf/23351 perf_event_open(attr_uptr: 0x414a5e8, pid: 23351 (perf), cpu: 3, group_fd: -1, flags: FD_CLOEXEC) = 6
    349.070 ( 0.046 ms): perf/23351 perf_event_open(attr_uptr: 0x414aa38, pid: 23351 (perf), group_fd: -1, flags: FD_CLOEXEC) = 7
    349.120 ( 0.037 ms): perf/23351 perf_event_open(attr_uptr: 0x414aa38, pid: 23351 (perf), cpu: 1, group_fd: -1, flags: FD_CLOEXEC) = 8
    349.161 ( 0.036 ms): perf/23351 perf_event_open(attr_uptr: 0x414aa38, pid: 23351 (perf), cpu: 2, group_fd: -1, flags: FD_CLOEXEC) = 9
    349.201 ( 0.035 ms): perf/23351 perf_event_open(attr_uptr: 0x414aa38, pid: 23351 (perf), cpu: 3, group_fd: -1, flags: FD_CLOEXEC) = 10
    349.306 ( 0.041 ms): perf/23351 perf_event_open(attr_uptr: 0x414b2d8, pid: 23351 (perf), group_fd: -1, flags: FD_CLOEXEC) = 11
    349.611 ( 0.005 ms): perf/23351 ioctl(fd: 3, cmd: PERF_ID, arg: 0x7fff025999b8) = 0
    349.619 ( 0.002 ms): perf/23351 ioctl(fd: 7, cmd: PERF_SET_OUTPUT, arg: 0x3 ) = 0
    349.623 ( 0.002 ms): perf/23351 ioctl(fd: 7, cmd: PERF_ID, arg: 0x7fff025999b8) = 0
    349.627 ( 0.002 ms): perf/23351 ioctl(fd: 11, cmd: PERF_SET_OUTPUT, arg: 0x3 ) = 0
    349.630 ( 0.001 ms): perf/23351 ioctl(fd: 11, cmd: PERF_ID, arg: 0x7fff025999b8) = 0

    7: PERF_RECORD_* events & perf_sample fields :
    647.150 ( 0.014 ms): perf/23354 perf_event_open(attr_uptr: 0x7fff02599920, pid: -1, cpu: 2, group_fd: -1, flags: FD_CLOEXEC) = 3
    647.197 ( 0.076 ms): perf/23354 perf_event_open(attr_uptr: 0x414b478, pid: -1, group_fd: -1, flags: FD_CLOEXEC) = 3
    647.289 ( 0.040 ms): perf/23354 perf_event_open(attr_uptr: 0x414b478, pid: -1, group_fd: -1, flags: FD_CLOEXEC) = 3
    647.368 ( 0.011 ms): perf/23354 perf_event_open(attr_uptr: 0x414a5e8, pid: 23355 (perf), group_fd: -1, flags: FD_CLOEXEC) = 3
    647.381 ( 0.005 ms): perf/23354 perf_event_open(attr_uptr: 0x414a5e8, pid: 23355 (perf), cpu: 1, group_fd: -1, flags: FD_CLOEXEC) = 4
    647.387 ( 0.005 ms): perf/23354 perf_event_open(attr_uptr: 0x414a5e8, pid: 23355 (perf), cpu: 2, group_fd: -1, flags: FD_CLOEXEC) = 5
    647.393 ( 0.004 ms): perf/23354 perf_event_open(attr_uptr: 0x414a5e8, pid: 23355 (perf), cpu: 3, group_fd: -1, flags: FD_CLOEXEC) = 7
    648.026 ( 0.011 ms): perf/23354 ioctl(fd: 3, cmd: PERF_ENABLE) = 0
    648.038 ( 0.002 ms): perf/23354 ioctl(fd: 4, cmd: PERF_ENABLE) = 0
    648.042 ( 0.002 ms): perf/23354 ioctl(fd: 5, cmd: PERF_ENABLE) = 0
    648.045 ( 0.002 ms): perf/23354 ioctl(fd: 7, cmd: PERF_ENABLE) = 0

    18: Breakpoint overflow signal handler :
    2772.721 ( 0.017 ms): perf/23375 perf_event_open(attr_uptr: 0x7fff02599d20, pid: -1, cpu: 3, group_fd: -1, flags: FD_CLOEXEC) = 3
    2772.748 ( 0.009 ms): perf/23375 perf_event_open(attr_uptr: 0x7fff02599e60, cpu: -1, group_fd: -1, flags: FD_CLOEXEC) = 3
    2772.768 ( 0.002 ms): perf/23375 ioctl(fd: 3, cmd: PERF_RESET) = 0
    2772.776 ( 0.008 ms): perf/23375 perf_event_open(attr_uptr: 0x7fff02599e60, cpu: -1, group_fd: -1, flags: FD_CLOEXEC) = 4
    2772.788 ( 0.002 ms): perf/23375 ioctl(fd: 4, cmd: PERF_RESET) = 0
    2772.791 ( 0.006 ms): perf/23375 perf_event_open(attr_uptr: 0x7fff02599e60, cpu: -1, group_fd: -1, flags: FD_CLOEXEC) = 5
    2772.800 ( 0.001 ms): perf/23375 ioctl(fd: 5, cmd: PERF_RESET) = 0
    2772.803 ( 0.005 ms): perf/23375 ioctl(fd: 3, cmd: PERF_ENABLE) = 0
    2772.810 ( 0.004 ms): perf/23375 ioctl(fd: 4, cmd: PERF_ENABLE) = 0
    2772.815 ( 0.004 ms): perf/23375 ioctl(fd: 5, cmd: PERF_ENABLE) = 0

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

    Arnaldo Carvalho de Melo
     
  • Also trying a new approach, using a copy of uapi/linux/vhost.h we auto
    generate the string tables, then include it in the ioctl cmd beautifier.

    This way either the KVM developers will add the new commands to the
    tools/ copy, like is happening with other areas of tools/include/ (bpf.h
    comes to mind), or we'll be notified when building perf that our copy
    drifted.

    E.g., doing syswide tracing grepping for the newly beautified VHOST
    ioctls:

    # perf trace -e ioctl 2>&1 | grep VHOST
    3873.064 ( 0.099 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: VHOST_NET_SET_BACKEND, arg: 0x7fff053dffe0) = 0
    3873.168 ( 0.019 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: VHOST_NET_SET_BACKEND, arg: 0x7fff053dffe0) = 0
    3873.226 ( 0.006 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: VHOST_GET_VRING_BASE, arg: 0x7fff053dff60) = 0
    3873.244 ( 0.002 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: VHOST_GET_VRING_BASE, arg: 0x7fff053dff60) = 0
    3873.817 ( 0.014 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: VHOST_SET_VRING_CALL, arg: 0x7fff053dff20) = 0
    3873.838 ( 0.004 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: VHOST_SET_VRING_CALL, arg: 0x7fff053dff20) = 0
    4701.372 ( 0.006 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: VHOST_SET_VRING_CALL, arg: 0x7fff053dfe20) = 0
    4701.417 ( 0.007 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: VHOST_SET_VRING_CALL, arg: 0x7fff053dfe20) = 0
    4701.563 ( 0.004 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: VHOST_SET_FEATURES, arg: 0x7fff053dfe88) = 0
    4701.571 ( 0.028 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: VHOST_SET_MEM_TABLE, arg: 0x563c7c906870) = 0
    4701.604 ( 0.003 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: VHOST_SET_VRING_NUM, arg: 0x7fff053dff00) = 0
    4701.609 ( 0.002 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: VHOST_SET_VRING_BASE, arg: 0x7fff053dff00) = 0
    4701.615 ( 0.002 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: VHOST_SET_VRING_ADDR, arg: 0x7fff053dfe70) = 0
    4701.619 ( 0.008 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: VHOST_SET_VRING_KICK, arg: 0x7fff053dfef0) = 0
    4701.634 ( 0.004 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: VHOST_SET_VRING_NUM, arg: 0x7fff053dff00) = 0
    4701.640 ( 0.002 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: VHOST_SET_VRING_BASE, arg: 0x7fff053dff00) = 0
    4701.644 ( 0.002 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: VHOST_SET_VRING_ADDR, arg: 0x7fff053dfe70) = 0
    4701.648 ( 0.009 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: VHOST_SET_VRING_KICK, arg: 0x7fff053dfef0) = 0
    4701.665 ( 0.005 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: VHOST_NET_SET_BACKEND, arg: 0x7fff053dff80) = 0
    4701.672 ( 0.004 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: VHOST_NET_SET_BACKEND, arg: 0x7fff053dff80) = 0
    ^C

    '-e ioctl' uses tracepoint filters, in time this will be replaces by
    eBPF filters hooked at the syscall tracepoints and that "grep VHOST"
    will also be done with eBPF, right at the kernel, to reduce overhead.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jason Wang
    Cc: Jiri Olsa
    Cc: "Michael S. Tsirkin"
    Cc: Namhyung Kim
    Cc: Paolo Bonzini
    Cc: Radim Krčmář
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-2gthnhpliunvakywjterrzz3@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Also trying a new approach, using a copy of uapi/linux/kvm.h we auto
    generate the string tables, then include it in the ioctl cmd beautifier.

    This way either the KVM developers will add the new commands to the
    tools/ copy, like is happening with other areas of tools/include/ (bpf.h
    comes to mind), or we'll be notified when building perf that our copy
    drifted.

    E.g., a tracing a process and its threads, but would work for system wide as
    well, just drop that '-p 21238', to see ioctls for DRM, tty, sound, etc:

    # perf trace -e ioctl -p 21238 2>&1 | grep -v KVM_RUN
    7801.536 ( 0.003 ms): CPU 0/KVM/21276 ioctl(fd: 13, cmd: KVM_IRQ_LINE_STATUS, arg: 0x7f484c6c73c0) = 0

    7801.715 ( 0.001 ms): CPU 0/KVM/21276 ioctl(fd: 13, cmd: KVM_IRQ_LINE_STATUS, arg: 0x7f484c6c73e0) = 0
    11001.051 ( 0.008 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_SIGNAL_MSI, arg: 0x563c83379d70) = 1
    11001.225 ( 0.005 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_SIGNAL_MSI, arg: 0x563c83379d70) = 1
    10750.377 (249.963 ms): CPU 0/KVM/21276 ... [continued]: ioctl()) = 0
    11011.780 ( 0.015 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_SIGNAL_MSI, arg: 0x563c83379d90) = 1
    11011.929 ( 0.005 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_SIGNAL_MSI, arg: 0x7fff053e1000) = 1
    11012.090 ( 0.004 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_SIGNAL_MSI, arg: 0x563c83379d70) = 1
    11023.127 ( 0.020 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_SIGNAL_MSI, arg: 0x563c83379d90) = 1
    11000.483 (249.807 ms): CPU 0/KVM/21276 ... [continued]: ioctl()) = 0
    25620.877 ( 0.042 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_IRQ_LINE_STATUS, arg: 0x7fff053e1080) = 0

    25621.025 ( 0.002 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_IRQ_LINE_STATUS, arg: 0x7fff053e10a0) = 0
    25500.803 (120.186 ms): CPU 0/KVM/21276 ... [continued]: ioctl()) = 0
    25621.078 ( 0.005 ms): CPU 0/KVM/21276 ioctl(fd: 13, cmd: KVM_IRQ_LINE_STATUS, arg: 0x7f484c6c73c0) = 0

    25621.346 ( 0.001 ms): CPU 0/KVM/21276 ioctl(fd: 13, cmd: KVM_IRQ_LINE_STATUS, arg: 0x7f484c6c73e0) = 0
    40456.997 ( 0.100 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: (WRITE, 0xaf, 0x30, 0x8), arg: 0x7fff053dffe0) = 0
    40457.100 ( 0.019 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: (WRITE, 0xaf, 0x30, 0x8), arg: 0x7fff053dffe0) = 0
    40457.133 ( 0.002 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: (READ|WRITE, 0xaf, 0x12, 0x8), arg: 0x7fff053dff60) = 0
    40457.139 ( 0.001 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: (READ|WRITE, 0xaf, 0x12, 0x8), arg: 0x7fff053dff60) = 0
    40458.503 ( 0.027 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_IOEVENTFD, arg: 0x7fff053dfc80) = 0
    40458.601 ( 0.030 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_IOEVENTFD, arg: 0x7fff053dfc80) = 0
    40458.649 ( 0.003 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: (WRITE, 0xaf, 0x21, 0x8), arg: 0x7fff053dff20) = 0
    40458.654 ( 0.002 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: (WRITE, 0xaf, 0x21, 0x8), arg: 0x7fff053dff20) = 0
    40458.657 ( 0.018 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_IRQFD, arg: 0x7fff053dff00 ) = 0
    40459.077 ( 0.017 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_IRQFD, arg: 0x7fff053dff00 ) = 0
    40459.123 ( 0.017 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_IOEVENTFD, arg: 0x7fff053dfd20) = 0

    40463.477 ( 0.013 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_IOEVENTFD, arg: 0x7fff053dfd20) = 0
    40464.874 ( 0.010 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_GET_VCPU_EVENTS, arg: 0x7fff053e0000) = 0
    40464.892 ( 0.048 ms): qemu-system-x8/21238 ioctl(fd: 12, cmd: KVM_CHECK_EXTENSION, arg: 0x4c ) = 1
    40464.991 ( 0.002 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_GET_CLOCK, arg: 0x7fff053e0040) = 0
    40464.962 ( 0.013 ms): CPU 0/KVM/21276 ioctl(fd: 20, cmd: KVM_GET_MSRS, arg: 0x7f484c6c7670) = 1
    44540.437 ( 0.103 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_SET_GSI_ROUTING, arg: 0x563c7c93c000) = 0
    44540.544 ( 0.008 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_IRQFD, arg: 0x7fff053dfea0 ) = 0
    44540.555 ( 0.029 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_SET_GSI_ROUTING, arg: 0x563c7c93c000) = 0
    44540.586 ( 0.003 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_IRQFD, arg: 0x7fff053dfea0 ) = 0
    44540.592 ( 0.027 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_SET_GSI_ROUTING, arg: 0x563c7c93c000) = 0
    44540.625 ( 0.005 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: (WRITE, 0xaf, 0x21, 0x8), arg: 0x7fff053dfe20) = 0
    44540.639 ( 0.018 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_SET_GSI_ROUTING, arg: 0x563c7c93c000) = 0
    44540.658 ( 0.003 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: (WRITE, 0xaf, 0x21, 0x8), arg: 0x7fff053dfe20) = 0
    44540.686 ( 0.015 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_IOEVENTFD, arg: 0x7fff053dfbe0) = 0
    44540.727 ( 0.014 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_IOEVENTFD, arg: 0x7fff053dfbe0) = 0
    44540.748 ( 0.005 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: (WRITE, 0xaf, 0, 0x8), arg: 0x7fff053dfe88) = 0
    44540.754 ( 0.026 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: (WRITE, 0xaf, 0x3, 0x8), arg: 0x563c7c906870) = 0
    44540.783 ( 0.002 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: (WRITE, 0xaf, 0x10, 0x8), arg: 0x7fff053dff00) = 0
    44540.787 ( 0.002 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: (WRITE, 0xaf, 0x12, 0x8), arg: 0x7fff053dff00) = 0
    44540.793 ( 0.002 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: (WRITE, 0xaf, 0x11, 0x28), arg: 0x7fff053dfe70) = 0
    44540.796 ( 0.010 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: (WRITE, 0xaf, 0x20, 0x8), arg: 0x7fff053dfef0) = 0
    44540.811 ( 0.002 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: (WRITE, 0xaf, 0x10, 0x8), arg: 0x7fff053dff00) = 0
    44540.814 ( 0.002 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: (WRITE, 0xaf, 0x12, 0x8), arg: 0x7fff053dff00) = 0
    44540.819 ( 0.002 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: (WRITE, 0xaf, 0x11, 0x28), arg: 0x7fff053dfe70) = 0
    44540.822 ( 0.005 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: (WRITE, 0xaf, 0x20, 0x8), arg: 0x7fff053dfef0) = 0
    44540.837 ( 0.006 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: (WRITE, 0xaf, 0x30, 0x8), arg: 0x7fff053dff80) = 0
    44540.862 ( 0.004 ms): qemu-system-x8/21238 ioctl(fd: 27, cmd: (WRITE, 0xaf, 0x30, 0x8), arg: 0x7fff053dff80) = 0
    44540.887 ( 0.014 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_IOEVENTFD, arg: 0x7fff053dfd00) = 0

    44542.756 ( 0.020 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_IOEVENTFD, arg: 0x7fff053dfd00) = 0
    44542.809 ( 0.007 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_SET_VCPU_EVENTS, arg: 0x7fff053dffb0) = 0
    44542.819 ( 0.003 ms): qemu-system-x8/21238 ioctl(fd: 12, cmd: KVM_CHECK_EXTENSION, arg: 0x4c ) = 1
    44543.016 ( 0.004 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_SET_CLOCK, arg: 0x7fff053dfff0) = 0
    44543.022 ( 0.008 ms): qemu-system-x8/21238 ioctl(fd: 20, cmd: KVM_KVMCLOCK_CTRL ) = 0
    46952.502 ( 0.010 ms): qemu-system-x8/21238 ioctl(fd: 13, cmd: KVM_SIGNAL_MSI, arg: 0x563c83379d70) = 1
    46829.292 (249.860 ms): CPU 0/KVM/21276 ... [continued]: ioctl()) = 0
    ^C
    [root@jouet linux]#

    Since there are clashes in _IOC_NR() for some cases, notably ioctls with
    PPC_ and ARM_ in its name and some that depend on some internal state to
    be valid, but use the same number as others, those were removed in the
    shell script that builds the table, tools/perf/trace/beauty/kvm_ioctl.sh.

    Since so far we're supporting only x86 in the 'cmd' ioctl arg beautifier
    in perf trace, we can leave fully supporting these ioctls for later.

    There are some more to handle here, notably the one for /dev/vhost-net, will
    come later.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Paolo Bonzini
    Cc: Radim Krčmář
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-zxhebe579n338d7qrnjoctes@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • This time we try a new approach, using a copy of uapi/sound/asound.h we
    auto generate the string tables, then include it in the ioctl cmd
    beautifier.

    This way either the sound developers will add the new commands to the
    tools/ copy, like is happening with other areas of tools/include/ (bpf.h
    comes to mind), or we'll be notified when building perf that our copy
    drifted.

    E.g.:

    # perf trace -p 22084 -e ioctl 2>&1 | head -5
    0.000 ( 0.068 ms): alsa-sink-ALC3/22084 ioctl(fd: 49, cmd: SNDRV_PCM_HWSYNC, arg: 0x557f8d7fa0f0) = 0
    0.344 ( 0.041 ms): alsa-sink-ALC3/22084 ioctl(fd: 46, cmd: SNDRV_CTL_ELEM_READ, arg: 0x7fe764018ee0) = 0
    0.403 ( 0.011 ms): alsa-sink-ALC3/22084 ioctl(fd: 49, cmd: SNDRV_PCM_HWSYNC, arg: 0x557f8d7fa0f0) = 0
    0.427 ( 0.009 ms): alsa-sink-ALC3/22084 ioctl(fd: 49, cmd: SNDRV_PCM_STATUS_EXT, arg: 0x7fe76c2e0b30) = 0
    2.461 ( 0.042 ms): alsa-sink-ALC3/22084 ioctl(fd: 49, cmd: SNDRV_PCM_HWSYNC, arg: 0x557f8d7fa0f0) = 0
    #

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

    Arnaldo Carvalho de Melo
     
  • This time we try a new approach, using uapi/drm/ copies of drm.h and
    i915_drm.h we auto generate the string tables, then include it in the
    ioctl cmd beautifier.

    This way either the DRM developers will add the new commands to the
    tools/ copy, like is happening with other areas of tools/include/ (bpf.h
    comes to mind), or we'll be notified when building perf that our copy
    drifted.

    Either way the time from a new command being added to when 'perf trace'
    gets to know it is greatly shortened, for instance:

    # strace -p 22401 -e ioctl
    ioctl(8, DRM_IOCTL_I915_GEM_BUSY, 0x7ffc934f7600) = 0
    ioctl(8, DRM_IOCTL_I915_GEM_SET_DOMAIN, 0x7ffc934f7550) = 0
    ioctl(8, DRM_IOCTL_I915_GEM_SW_FINISH, 0x7ffc934f76e0) = 0
    ioctl(8, DRM_IOCTL_I915_GEM_SW_FINISH, 0x7ffc934f7780) = 0
    ioctl(8, _IOC(_IOC_READ|_IOC_WRITE, 0x64, 0x69, 0x40), 0x7ffc934f7700) = 0
    ioctl(8, DRM_IOCTL_I915_GEM_SET_DOMAIN, 0x7ffc934f7780) = 0
    ioctl(8, DRM_IOCTL_I915_GEM_MADVISE, 0x7ffc934f76f0) = 0
    ioctl(8, DRM_IOCTL_I915_GEM_BUSY, 0x7ffc934f76c0) = 0
    ioctl(8, DRM_IOCTL_I915_GEM_MADVISE, 0x7ffc934f76b0) = 0
    ioctl(8, DRM_IOCTL_I915_GEM_SET_DOMAIN, 0x7ffc934f76d0) = 0
    ioctl(8, DRM_IOCTL_MODE_ADDFB, 0x7ffc934f7880) = 0
    ioctl(8, DRM_IOCTL_MODE_PAGE_FLIP, 0x7ffc934f77d0) = 0
    ^Cstrace: Process 22401 detached

    versus:

    # perf trace -p 22401 -e ioctl
    1010.856 (0.006 ms): gnome-shell/22401 ioctl(fd: 8, cmd: DRM_I915_GEM_BUSY, arg: 0x7ffc934f7600) = 0
    1010.865 (0.003 ms): gnome-shell/22401 ioctl(fd: 8, cmd: DRM_I915_GEM_SET_DOMAIN, arg: 0x7ffc934f7550) = 0
    1010.872 (0.002 ms): gnome-shell/22401 ioctl(fd: 8, cmd: DRM_I915_GEM_SW_FINISH, arg: 0x7ffc934f76e0) = 0
    1010.939 (0.015 ms): gnome-shell/22401 ioctl(fd: 8, cmd: DRM_I915_GEM_SW_FINISH, arg: 0x7ffc934f7780) = 0
    1010.959 (0.085 ms): gnome-shell/22401 ioctl(fd: 8, cmd: DRM_I915_GEM_EXECBUFFER2, arg: 0x7ffc934f7700) = 0
    1011.048 (0.003 ms): gnome-shell/22401 ioctl(fd: 8, cmd: DRM_I915_GEM_SET_DOMAIN, arg: 0x7ffc934f7780) = 0
    1011.056 (0.002 ms): gnome-shell/22401 ioctl(fd: 8, cmd: DRM_I915_GEM_MADVISE, arg: 0x7ffc934f76f0) = 0
    1011.060 (0.002 ms): gnome-shell/22401 ioctl(fd: 8, cmd: DRM_I915_GEM_BUSY, arg: 0x7ffc934f76c0) = 0
    1011.064 (0.003 ms): gnome-shell/22401 ioctl(fd: 8, cmd: DRM_I915_GEM_MADVISE, arg: 0x7ffc934f76b0) = 0
    1011.068 (0.002 ms): gnome-shell/22401 ioctl(fd: 8, cmd: DRM_I915_GEM_SET_DOMAIN, arg: 0x7ffc934f76d0) = 0
    1011.074 (0.009 ms): gnome-shell/22401 ioctl(fd: 8, cmd: DRM_MODE_ADDFB, arg: 0x7ffc934f7880 ) = 0
    1011.096 (0.072 ms): gnome-shell/22401 ioctl(fd: 8, cmd: DRM_MODE_PAGE_FLIP, arg: 0x7ffc934f77d0) = 0
    ^C[root@jouet linux]#

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

    Arnaldo Carvalho de Melo
     

25 Jul, 2017

2 commits

  • When libelf is disabled in the configuration, we get the following
    linker error:

    LINK libperf-jvmti.so
    ld: cannot find -lelf
    Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed

    Jiri pointed out that both librt and libelf are not really required. So
    this patch fixes the linker error by getting rid of unwanted libraries
    in the linker stage.

    Signed-off-by: Sudeep Holla
    Acked-by: David Carrillo-Cisneros
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Elena Reshetova
    Cc: Kees Kook
    Cc: Paul Turner
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Sudeep Holla
    Cc: Wang Nan
    Fixes: 209045adc2bb ("perf tools: add JVMTI agent library")
    Link: http://lkml.kernel.org/r/20170719011839.99399-5-davidcc@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Sudeep Holla
     
  • The goal is to allow users to override linking of libraries that
    were automatically added to PERFLIBS.

    EXCLUDE_EXTLIBS contains linker flags to be removed from LIBS
    while EXTRA_PERFLIBS contains linker flags to be added.

    My use case is to force certain library to be build statically,
    e.g. for libelf:

    EXCLUDE_EXTLIBS=-lelf EXTRA_PERFLIBS=path/libelf.a

    Signed-off-by: David Carrillo-Cisneros
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Elena Reshetova
    Cc: Kees Kook
    Cc: Paul Turner
    Cc: Stephane Eranian
    Cc: Sudeep Holla
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/20170719011839.99399-3-davidcc@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    David Carrillo-Cisneros
     

15 Jun, 2017

1 commit

  • With commit: 0a943cb10ce78 (tools build: Add HOSTARCH Makefile variable)
    when building for ARCH=x86_64, ARCH=x86_64 is passed to perf instead of
    ARCH=x86, so the perf build process searchs header files from
    tools/arch/x86_64/include, which doesn't exist.

    The following build failure is seen:

    In file included from util/event.c:2:0:
    tools/include/uapi/linux/mman.h:4:27: fatal error: uapi/asm/mman.h: No such file or directory
    compilation terminated.

    Fix this issue by using SRCARCH instead of ARCH in perf, just like the
    main kernel Makefile and tools/objtool's.

    Signed-off-by: Jiada Wang
    Tested-by: Arnaldo Carvalho de Melo
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Eugeniu Rosca
    Cc: Jan Stancek
    Cc: Masami Hiramatsu
    Cc: Peter Zijlstra
    Cc: Ravi Bangoria
    Cc: Rui Teng
    Cc: Sukadev Bhattiprolu
    Cc: Wang Nan
    Fixes: 0a943cb10ce7 ("tools build: Add HOSTARCH Makefile variable")
    Link: http://lkml.kernel.org/r/1491793357-14977-2-git-send-email-jiada_wang@mentor.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiada Wang
     

18 Feb, 2017

1 commit

  • Ingo reported following build failure:

    On Sat, Feb 11, 2017 at 12:12:34PM +0100, Ingo Molnar wrote:
    >
    > So I had this oldish 32-bit 15.10 Ubuntu installation around (fully updated), and
    > trying to build perf gave me:
    >
    > deimos:~/tip/tools/perf> make
    > BUILD: Doing 'make -j4' parallel build
    > make[3]: *** No rule to make target '/usr/include/x86_64-linux-gnu/sys/types.h', needed by 'fixdep.o'. Stop.
    > Makefile:42: recipe for target 'fixdep-in.o' failed
    > make[2]: *** [fixdep-in.o] Error 2
    > /home/mingo/tip/tools/build/Makefile.include:4: recipe for target 'fixdep' failed
    > make[1]: *** [fixdep] Error 2
    > Makefile:68: recipe for target 'all' failed
    > make: *** [all] Error 2
    >
    > Now this got a bit better after I did a 'make mrproper' in the kernel tree:
    >
    > deimos:~/tip/tools/perf> make
    > BUILD: Doing 'make -j4' parallel build
    > HOSTCC fixdep.o
    > /home/mingo/tip/tools/build/fixdep: 1: /home/mingo/tip/tools/build/fixdep: Syntax error: "(" unexpected
    > /home/mingo/tip/tools/build/Makefile.build:101: recipe for target 'fixdep.o' failed
    > make[3]: *** [fixdep.o] Error 2
    > Makefile:42: recipe for target 'fixdep-in.o' failed
    > make[2]: *** [fixdep-in.o] Error 2
    > /home/mingo/tip/tools/build/Makefile.include:4: recipe for target 'fixdep' failed
    > make[1]: *** [fixdep] Error 2
    > Makefile:68: recipe for target 'all' failed
    > make: *** [all] Error 2
    >
    > After some digging it turns out that my 'fixdep' binary was 64-bit:
    >
    > deimos:~/tip/tools/perf> file /home/mingo/tip/tools/build/fixdep
    > /home/mingo/tip/tools/build/fixdep: ELF 64-bit LSB executable, x86-64, version 1
    > (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux
    > 2.6.32, BuildID[sha1]=d527f736b57b5ba47210fbcb562a3b52867d21c1, not stripped
    >
    > But it did not get cleaned out by 'make clean'.
    >
    > Only after I did a 'make clean' in tools/ itself, did it get built properly.

    It shows we don't clean up properly the fixdep objects, so adding
    special rule for that.

    Signed-off-by: Jiri Olsa
    Reported-by: Ingo Molnar
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1487340058-10496-2-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

12 Jan, 2017

1 commit

  • The install command for libperf-jvmti.so does not check if libdir exists
    before installing. This means that when the install command is run:

    install libperf-jvmti.so '/tmp/test_root/usr/lib64';

    libperf-jvmti.so will get installed to /usr/lib64 as a file and break
    further installation. Fix this by ensuring the directory gets created
    first.

    See https://bugzilla.redhat.com/show_bug.cgi?id=1410296

    Signed-off-by: Laura Abbott
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Peter Zijlstra
    Fixes: d4dfdf00d43e ("perf jvmti: Plug compilation into perf build")
    Link: http://lkml.kernel.org/r/1483741088-13543-1-git-send-email-labbott@redhat.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Laura Abbott
     

05 Jan, 2017

1 commit

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

    Pull perf/urgent fixes and one improvement from Arnaldo Carvalho de Melo:

    Fixes:

    - Fix prev/next_prio formatting for deadline tasks in libtraceevent (Daniel Bristot de Oliveira)

    - Robustify reading of build-ids from /sys/kernel/note (Arnaldo Carvalho de Melo)

    - Fix building some sample/bpf in Alpine Linux 3.4 (Arnaldo Carvalho de Melo)

    - Fix 'make install-bin' to install libtraceevent plugins (Arnaldo Carvalho de Melo)

    - Fix 'perf record --switch-output' documentation and comment (Jiri Olsa)

    - Fix 'perf probe' for cross arch probing (Masami Hiramatsu)

    Improvement:

    - Show total scheduling time in 'perf sched timehist' (Namhyumg Kim)

    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

    Ingo Molnar
     

04 Jan, 2017

1 commit


24 Dec, 2016

1 commit

  • Pull perf fixes from Ingo Molnar:
    "On the kernel side there's two x86 PMU driver fixes and a uprobes fix,
    plus on the tooling side there's a number of fixes and some late
    updates"

    * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (36 commits)
    perf sched timehist: Fix invalid period calculation
    perf sched timehist: Remove hardcoded 'comm_width' check at print_summary
    perf sched timehist: Enlarge default 'comm_width'
    perf sched timehist: Honour 'comm_width' when aligning the headers
    perf/x86: Fix overlap counter scheduling bug
    perf/x86/pebs: Fix handling of PEBS buffer overflows
    samples/bpf: Move open_raw_sock to separate header
    samples/bpf: Remove perf_event_open() declaration
    samples/bpf: Be consistent with bpf_load_program bpf_insn parameter
    tools lib bpf: Add bpf_prog_{attach,detach}
    samples/bpf: Switch over to libbpf
    perf diff: Do not overwrite valid build id
    perf annotate: Don't throw error for zero length symbols
    perf bench futex: Fix lock-pi help string
    perf trace: Check if MAP_32BIT is defined (again)
    samples/bpf: Make perf_event_read() static
    uprobes: Fix uprobes on MIPS, allow for a cache flush after ixol breakpoint creation
    samples/bpf: Make samples more libbpf-centric
    tools lib bpf: Add flags to bpf_create_map()
    tools lib bpf: use __u32 from linux/types.h
    ...

    Linus Torvalds
     

18 Dec, 2016

1 commit

  • Pull kbuild updates from Michal Marek:

    - prototypes for x86 asm-exported symbols (Adam Borowski) and a warning
    about missing CRCs (Nick Piggin)

    - asm-exports fix for LTO (Nicolas Pitre)

    - thin archives improvements (Nick Piggin)

    - linker script fix for CONFIG_LD_DEAD_CODE_DATA_ELIMINATION (Nick
    Piggin)

    - genksyms support for __builtin_va_list keyword

    - misc minor fixes

    * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
    x86/kbuild: enable modversions for symbols exported from asm
    kbuild: fix scripts/adjust_autoksyms.sh* for the no modules case
    scripts/kallsyms: remove last remnants of --page-offset option
    make use of make variable CURDIR instead of calling pwd
    kbuild: cmd_export_list: tighten the sed script
    kbuild: minor improvement for thin archives build
    kbuild: modpost warn if export version crc is missing
    kbuild: keep data tables through dead code elimination
    kbuild: improve linker compatibility with lib-ksyms.o build
    genksyms: Regenerate parser
    kbuild/genksyms: handle va_list type
    kbuild: thin archives for multi-y targets
    kbuild: kallsyms allow 3-pass generation if symbols size has changed

    Linus Torvalds
     

16 Dec, 2016

1 commit

  • To make it nicer and easily maintainable.

    Also moving the check into fixdep sub make, so its output is not
    scattered around the build output.

    Removing extra $$ from mman*.h checks.

    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/1481030331-31944-5-git-send-email-jolsa@kernel.org
    [ Use /bin/sh, and 'function check() {' -> 'check () {' to make it work with busybox, in Alpine Linux, for instance ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

11 Dec, 2016

1 commit


07 Dec, 2016

3 commits

  • Because there's no need for them in fixdep build.

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

    Jiri Olsa
     
  • The fixdep tool needs to be built before everything else, because it fixes
    every object dependency file.

    We handle this currently by making all objects to depend on fixdep, which is
    error prone and is easily forgotten when new object is added.

    Instead of this, this patch force fixdep tool to be built as the first target
    in the separate make session. This way we don't need to handle extra fixdep
    dependencies and we are certain there's no fixdep race with any parallel make
    job.

    Committer notes:

    Testing it:

    Before:

    $ rm -rf /tmp/build/perf/ ; mkdir -p /tmp/build/perf ; make -k O=/tmp/build/perf -C tools/perf install-bin
    make: Entering directory '/home/acme/git/linux/tools/perf'
    BUILD: Doing 'make -j4' parallel build

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

    GEN /tmp/build/perf/common-cmds.h
    HOSTCC /tmp/build/perf/fixdep.o
    HOSTLD /tmp/build/perf/fixdep-in.o
    LINK /tmp/build/perf/fixdep
    MKDIR /tmp/build/perf/pmu-events/
    HOSTCC /tmp/build/perf/pmu-events/json.o
    MKDIR /tmp/build/perf/pmu-events/
    HOSTCC /tmp/build/perf/pmu-events/jsmn.o
    HOSTCC /tmp/build/perf/pmu-events/jevents.o
    HOSTLD /tmp/build/perf/pmu-events/jevents-in.o
    PERF_VERSION = 4.9.rc8.g868cd5
    CC /tmp/build/perf/perf-read-vdso32

    After:

    $ rm -rf /tmp/build/perf/ ; mkdir -p /tmp/build/perf ; make -k O=/tmp/build/perf -C tools/perf install-bin
    make: Entering directory '/home/acme/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: [ on ]
    ... dwarf_getlocations: [ on ]
    ... glibc: [ on ]
    ... gtk2: [ on ]
    ... libaudit: [ on ]
    ... libbfd: [ on ]
    ... libelf: [ on ]
    ... libnuma: [ on ]
    ... numa_num_possible_cpus: [ on ]
    ... libperl: [ on ]
    ... libpython: [ on ]
    ... libslang: [ on ]
    ... libcrypto: [ on ]
    ... libunwind: [ on ]
    ... libdw-dwarf-unwind: [ on ]
    ... zlib: [ on ]
    ... lzma: [ on ]
    ... get_cpuid: [ on ]
    ... bpf: [ on ]

    GEN /tmp/build/perf/common-cmds.h
    MKDIR /tmp/build/perf/fd/
    CC /tmp/build/perf/fd/array.o
    LD /tmp/build/perf/fd/libapi-in.o
    MKDIR /tmp/build/perf/fs/
    CC /tmp/build/perf/event-parse.o
    CC /tmp/build/perf/fs/fs.o
    PERF_VERSION = 4.9.rc8.g57a92f
    CC /tmp/build/perf/event-plugin.o
    MKDIR /tmp/build/perf/fs/
    CC /tmp/build/perf/fs/tracing_path.o

    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/1481030331-31944-3-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • An upcoming fixdep fix needs all targets at the same area, so they'll
    fit under a signal condition block.

    Moving PERF-VERSION-FILE target into rules section.

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

    Jiri Olsa
     

06 Dec, 2016

4 commits

  • Adding some missing non config targets that were for some reason
    omitted.

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

    Jiri Olsa
     
  • Following fixdep fix needs all targets at the same area, so they'll fit
    under signal condition block.

    Moving python/perf.so target into rules section and intentionally
    removing the perl script related comment.

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

    Jiri Olsa
     
  • The upcoming fixdep fix needs all targets at the same area, so they'll
    fit under a signal condition block.

    Move install-gtk target into the rules section.

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

    Jiri Olsa
     
  • Add necessary c++ flags and link libraries to support builtin clang and
    LLVM. Add all llvm and clang libraries, so don't need to worry about
    clang changes its libraries setting. However, linking perf would take
    much longer than usual.

    Signed-off-by: Wang Nan
    Cc: Alexei Starovoitov
    Cc: He Kuang
    Cc: Jiri Olsa
    Cc: Joe Stringer
    Cc: Zefan Li
    Cc: pi3orama@163.com
    Link: http://lkml.kernel.org/r/20161126070354.141764-10-wangnan0@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Wang Nan
     

14 Nov, 2016

1 commit

  • Compile jvmti agent as part of the perf build. The agent library is
    called libperf-jvmti.so and is installed in default place together with
    other files:

    $ make libperf-jvmti.so
    BUILD: Doing 'make -j4' parallel build
    ...
    CC jvmti/libjvmti.o
    CC jvmti/jvmti_agent.o
    LD jvmti/jvmti-in.o
    LINK libperf-jvmti.so

    $ make DESTDIR=/tmp/krava/ install-bin
    ...
    $ find /tmp/krava/ | grep libperf
    /tmp/krava/lib64/libperf-jvmti.so
    /tmp/krava/lib64/libperf-gtk.so

    Signed-off-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Tested-by: Stephane Eranian
    Cc: Andi Kleen
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: William Cohen
    Link: http://lkml.kernel.org/r/1478093749-5602-4-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

28 Oct, 2016

1 commit

  • Ignore export.h and EXPORT_SYMBOL in:

    784d5699eddc ("x86: move exports to actual definitions")

    We're not dragging this stuff, not useful in tools/

    This silences the following warnings while building perf:

    Warning: tools/arch/x86/lib/memcpy_64.S differs from kernel
    Warning: tools/arch/x86/lib/memset_64.S differs from kernel

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

    Arnaldo Carvalho de Melo
     

04 Oct, 2016

1 commit

  • This is a modified version of an earlier patch by Andi Kleen.

    We expect architectures to create JSON files describing the performance
    monitoring (PMU) events that each CPU model/family of the architecture
    supports.

    Following is an example of the JSON file entry for an x86 event:

    [
    ...
    {
    "EventCode": "0x00",
    "UMask": "0x01",
    "EventName": "INST_RETIRED.ANY",
    "BriefDescription": "Instructions retired from execution.",
    "PublicDescription": "Instructions retired from execution.",
    "Counter": "Fixed counter 1",
    "CounterHTOff": "Fixed counter 1",
    "SampleAfterValue": "2000003",
    "SampleAfterValue": "2000003",
    "MSRIndex": "0",
    "MSRValue": "0",
    "TakenAlone": "0",
    "CounterMask": "0",
    "Invert": "0",
    "AnyThread": "0",
    "EdgeDetect": "0",
    "PEBS": "0",
    "PRECISE_STORE": "0",
    "Errata": "null",
    "Offcore": "0"
    },
    ...

    ]

    All the PMU events supported by a CPU model/family must be grouped into
    "topics" such as "Pipelining", "Floating-point", "Virtual-memory" etc.

    All events belonging to a topic must be placed in a separate JSON file
    (eg: "Pipelining.json") and all the topic JSON files for a CPU model must
    be in a separate directory.

    Eg: for the CPU model "Silvermont_core":

    $ ls tools/perf/pmu-events/arch/x86/Silvermont_core
    Floating-point.json
    Memory.json
    Other.json
    Pipelining.json
    Virtualmemory.json

    Finally, to allow multiple CPU models to share a single set of JSON files,
    architectures must provide a mapping between a model and its set of events:

    $ grep Silvermont tools/perf/pmu-events/arch/x86/mapfile.csv
    GenuineIntel-6-4D,V13,Silvermont_core,core
    GenuineIntel-6-4C,V13,Silvermont_core,core

    which maps each CPU, identified by [vendor, family, model, version, type]
    to a directory of JSON files. Thus two (or more) CPU models support the
    set of PMU events listed in the directory.

    tools/perf/pmu-events/arch/x86/Silvermont_core/

    Given this organization of files, the program, jevents:

    - locates all JSON files for each CPU-model of the architecture,

    - parses all JSON files for the CPU-model and generates a C-style
    "PMU-events table" (pmu-events.c) for the model

    - locates a mapfile for the architecture

    - builds a global table, mapping each model of CPU to the corresponding
    PMU-events table.

    The 'pmu-events.c' is generated when building perf and added to libperf.a.
    The global table pmu_events_map[] table in this pmu-events.c will be used
    in perf in a follow-on patch.

    If the architecture does not have any JSON files or there is an error in
    processing them, an empty mapping file is created. This would allow the
    build of perf to proceed even if we are not able to provide aliases for
    events.

    The parser for JSON files allows parsing Intel style JSON event files. This
    allows to use an Intel event list directly with perf. The Intel event lists
    can be quite large and are too big to store in unswappable kernel memory.

    The conversion from JSON to C-style is straight forward. The parser knows
    (very little) Intel specific information, and can be easily extended to
    handle fields for other CPUs.

    The parser code is partially shared with an independent parsing library,
    which is 2-clause BSD licensed. To avoid any conflicts I marked those
    files as BSD licensed too. As part of perf they become GPLv2.

    Committer notes:

    Fixes:

    1) Limit maxfds to 512 to avoid nftd() segfaulting on alloca() with a
    big rlim_max, as in docker containers - acme

    2) Make jevents a hostprog, supporting cross compilation - jolsa

    3) Use HOSTCC for jevents final step - acme

    4) Define _GNU_SOURCE for asprintf, as we can't use CC's EXTRA_CFLAGS,
    that has to have --sysroot on the Android NDK 24 - acme

    5) Removed $(srctree)/tools/perf/pmu-events/pmu-events.c from the
    'clean' target, it is generated on $(OUTPUT)pmu-events/pmu-events.c,
    which is already taken care of in the original patch - acme

    Signed-off-by: Andi Kleen
    Signed-off-by: Jiri Olsa
    Signed-off-by: Sukadev Bhattiprolu
    Tested-by: Arnaldo Carvalho de Melo
    Acked-by: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: Madhavan Srinivasan
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: http://lkml.kernel.org/r/1473978296-20712-3-git-send-email-sukadev@linux.vnet.ibm.com
    Link: http://lkml.kernel.org/r/20160927141846.GA6589@krava
    Signed-off-by: Arnaldo Carvalho de Melo

    Andi Kleen
     

14 Sep, 2016

1 commit

  • As with other cloned headers, compare the newly introduced mman related
    headers against their source copy in kernel tree.

    Signed-off-by: Wang Nan
    Cc: Zefan Li
    Cc: pi3orama@163.com
    Link: http://lkml.kernel.org/r/1473684871-209320-4-git-send-email-wangnan0@huawei.com
    [ Added -I to ignore the uapi/ difference ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Wang Nan
     

24 Aug, 2016

2 commits

  • It is a requirement from the perf TODO list[1]:

    ''The feature tests should be performed only when a file that needs those
    tests, or at least only when some .c or .h file will be rebuilt. An
    initial step would be for 'make install-doc' not to run the feature
    tests, there it is not needed at all.''

    By adding 'install-doc' to the NON_CONFIG_TARGETS, it will skip running
    the feature tests for such target. The Auto-detecting system features
    list will not be displayed:

    $ make install-doc
    BUILD: Doing 'make -j2' parallel build
    SUBDIR Documentation
    make[2]: Nothing to be done for 'install'.

    [1] https://perf.wiki.kernel.org/index.php/Todo

    Signed-off-by: Rui Teng
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1470818948-17784-1-git-send-email-rui.teng@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Rui Teng
     
  • Directly accessing kernel files is not allowed anymore. As such making
    file coresight-pmu.h accessible by the perf tools and complain if this
    copy strays from the one found in the main kernel tree.

    Signed-off-by: Mathieu Poirier
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Cc: Vince Weaver
    Link: http://lkml.kernel.org/r/1470932464-726-2-git-send-email-mathieu.poirier@linaro.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Mathieu Poirier
     

03 Aug, 2016

1 commit

  • 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
     

19 Jul, 2016

2 commits