Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Sep 19, 2018
  2. Sep 17, 2018
    • Daniel Borkmann's avatar
      tls: fix currently broken MSG_PEEK behavior · 50c6b58a
      Daniel Borkmann authored
      In kTLS MSG_PEEK behavior is currently failing, strace example:
      
        [pid  2430] socket(AF_INET, SOCK_STREAM, IPPROTO_IP) = 3
        [pid  2430] socket(AF_INET, SOCK_STREAM, IPPROTO_IP) = 4
        [pid  2430] bind(4, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
        [pid  2430] listen(4, 10)               = 0
        [pid  2430] getsockname(4, {sa_family=AF_INET, sin_port=htons(38855), sin_addr=inet_addr("0.0.0.0")}, [16]) = 0
        [pid  2430] connect(3, {sa_family=AF_INET, sin_port=htons(38855), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
        [pid  2430] setsockopt(3, SOL_TCP, 0x1f /* TCP_??? */, [7564404], 4) = 0
        [pid  2430] setsockopt(3, 0x11a /* SOL_?? */, 1, "\3\0033\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 40) = 0
        [pid  2430] accept(4, {sa_family=AF_INET, sin_port=htons(49636), sin_addr=inet_addr("127.0.0.1")}, [16]) = 5
        [pid  2430] setsockopt(5, SOL_TCP, 0x1f /* TCP_??? */, [7564404], 4) = 0
        [pid  2430] setsockopt(5, 0x11...
      50c6b58a
  3. Sep 12, 2018
  4. Sep 11, 2018
    • Adrian Hunter's avatar
      perf tools: Fix maps__find_symbol_by_name() · 03db8b58
      Adrian Hunter authored
      Commit 1c5aae77
      
       ("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: default avatarBjörn Töpel <bjorn.topel@intel.com>
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: default avatarBjörn Töpel <bjorn.topel@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: stable@vger.kernel.org
      Fixes: 1c5aae77 ("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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      03db8b58
    • Arnaldo Carvalho de Melo's avatar
      tools headers uapi: Update tools's copy of linux/if_link.h · 5db48a8d
      Arnaldo Carvalho de Melo authored
      To get the changes in:
      
      	3e7a50ce ("net: report min and max mtu network device settings")
      	2756f68c ("net: bridge: add support for backup port")
      	a25717d2 ("xdp: support simultaneous driver and hw XDP attachment")
      	4f91da26 ("xdp: add per mode attributes for attached programs")
      	f203b76d ("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 <adrian.hunter@intel.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Jakub Kicinski <jakub.kicinski@netronome.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Cc: Steffen Klassert <steffen.klassert@secunet.com>
      Cc: Stephen Hemminger <stephen@networkplumber.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-xd9ztioa894zemv8ag8kg64u@git.kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5db48a8d
    • Arnaldo Carvalho de Melo's avatar
      tools headers uapi: Update tools's copy of linux/vhost.h · 7f28785c
      Arnaldo Carvalho de Melo authored
      To get the changes in:
      
      	c48300c9 ("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 <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-35x71oei2hdui9u0tarpimbq@git.kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7f28785c
    • Arnaldo Carvalho de Melo's avatar
      tools headers uapi: Update tools's copies of kvm headers · 0210c156
      Arnaldo Carvalho de Melo authored
      To get the changes in:
      
      	a4499382 ("KVM: s390: Add huge page enablement control")
      	8fcc4b59 ("kvm: nVMX: Introduce KVM_CAP_NESTED_STATE")
      	be26b3a7 ("arm64: KVM: export the capability to set guest SError syndrome")
      	b7b27fac ("arm/arm64: KVM: Add KVM_GET/SET_VCPU_EVENTS")
      	b0960b95 ("KVM: arm: Add 32bit get/set events support")
      	a3da7b4a ("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 <adrian.hunter@intel.com>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Cornelia Huck <cohuck@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Dongjiu Geng <gengdongjiu@huawei.com>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: James Morse <james.morse@arm.com>
      Cc: Janosch Frank <frankja@linux.ibm.com>
      Cc: Jim Mattson <jmattson@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-2vvwh2o19orn56di0ksrtgzr@git.kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0210c156
    • Arnaldo Carvalho de Melo's avatar
      tools headers uapi: Update tools's copy of drm/drm.h · 434ea1bf
      Arnaldo Carvalho de Melo authored
      To get the changes in:
      
      	d67b6a20 ("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 <adrian.hunter@intel.com>
      Cc: Brian Starkey <brian.starkey@arm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Eric Anholt <eric@anholt.net>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Liviu Dudau <liviu.dudau@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sean Paul <seanpaul@chromium.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-n7qib1bac6mc6w9oke7r4qdc@git.kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      434ea1bf
    • Arnaldo Carvalho de Melo's avatar
      tools headers uapi: Update tools's copy of asm-generic/unistd.h · f9e6e435
      Arnaldo Carvalho de Melo authored
      To get the changes in:
      
      	db7a2d18 ("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 <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kim Phillips <kim.phillips@arm.com>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
      Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Link: https://lkml.kernel.org/n/tip-vt7k2itnitp1t9p3dp7qeb08@git.kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f9e6e435
    • Arnaldo Carvalho de Melo's avatar
      tools headers uapi: Update tools's copy of linux/perf_event.h · 0ee03d93
      Arnaldo Carvalho de Melo authored
      To get the changes in:
      
      	09121255 ("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 <peterz@infradead.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-2vvwh2o19orn56di0ksrtgzr@git.kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0ee03d93
  5. Sep 10, 2018
  6. Sep 07, 2018
  7. Sep 06, 2018
  8. Sep 05, 2018
  9. Sep 04, 2018
  10. Sep 02, 2018
  11. Sep 01, 2018
  12. Aug 30, 2018
    • Kim Phillips's avatar
      perf annotate: Fix parsing aarch64 branch instructions after objdump update · 4e67b2a5
      Kim Phillips authored
      Starting with binutils 2.28, aarch64 objdump adds comments to the
      disassembly output to show the alternative names of a condition code
      [1].
      
      It is assumed that commas in objdump comments could occur in other
      arches now or in the future, so this fix is arch-independent.
      
      The fix could have been done with arm64 specific jump__parse and
      jump__scnprintf functions, but the jump__scnprintf instruction would
      have to have its comment character be a literal, since the scnprintf
      functions cannot receive a struct arch easily.
      
      This inconvenience also applies to the generic jump__scnprintf, which is
      why we add a raw_comment pointer to struct ins_operands, so the __parse
      function assigns it to be re-used by its corresponding __scnprintf
      function.
      
      Example differences in 'perf annotate --stdio2' output on an aarch64
      perf.data file:
      
      BEFORE: → b.cs   ffff200008133d1c <unwind_frame+0x18c>  // b.hs, dffff7ecc47b
      AFTER : ↓ b.cs   18c
      
      BEFORE: → b.cc   ffff200008d8d9cc <get_alloc_profile+0x31c>  // b.lo, b.ul, dffff727295b
      AFTER : ↓ b.cc   31c
      
      The branch target labels 18c and 31c also now appear in the output:
      
      BEFORE:        add    x26, x29, #0x80
      AFTER : 18c:   add    x26, x29, #0x80
      
      BEFORE:        add    x21, x21, #0x8
      AFTER : 31c:   add    x21, x21, #0x8
      
      The Fixes: tag below is added so stable branches will get the update; it
      doesn't necessarily mean that commit was broken at the time, rather it
      didn't withstand the aarch64 objdump update.
      
      Tested no difference in output for sample x86_64, power arch perf.data files.
      
      [1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=bb7eff5206e4795ac79c177a80fe9f4630aaf730
      
      
      
      Signed-off-by: default avatarKim Phillips <kim.phillips@arm.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Anton Blanchard <anton@samba.org>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Fixes: b13bbeee ("perf annotate: Fix branch instruction with multiple operands")
      Link: http://lkml.kernel.org/r/20180827125340.a2f7e291901d17cea05daba4@arm.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4e67b2a5
    • Sandipan Das's avatar
      perf probe powerpc: Ignore SyS symbols irrespective of endianness · fa694160
      Sandipan Das authored
      
      This makes sure that the SyS symbols are ignored for any powerpc system,
      not just the big endian ones.
      
      Reported-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Signed-off-by: default avatarSandipan Das <sandipan@linux.ibm.com>
      Reviewed-by: default avatarKamalesh Babulal <kamalesh@linux.vnet.ibm.com>
      Acked-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
      Fixes: fb6d5942 ("perf probe ppc: Use the right prefix when ignoring SyS symbols on ppc")
      Link: http://lkml.kernel.org/r/20180828090848.1914-1-sandipan@linux.ibm.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fa694160
    • Chris Phlipot's avatar
      perf event-parse: Use fixed size string for comms · c9f23d2b
      Chris Phlipot authored
      
      Some implementations of libc do not support the 'm' width modifier as
      part of the scanf string format specifier. This can cause the parsing to
      fail.  Since the parser never checks if the scanf parsing was
      successesful, this can result in a crash.
      
      Change the comm string to be allocated as a fixed size instead of
      dynamically using 'm' scanf width modifier. This can be safely done
      since comm size is limited to 16 bytes by TASK_COMM_LEN within the
      kernel.
      
      This change prevents perf from crashing when linked against bionic as
      well as reduces the total number of heap allocations and frees invoked
      while accomplishing the same task.
      
      Signed-off-by: default avatarChris Phlipot <cphlipot0@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20180830021950.15563-1-cphlipot0@gmail.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c9f23d2b
    • Chris Phlipot's avatar
      perf util: Fix bad memory access in trace info. · a72f6426
      Chris Phlipot authored
      
      In the write to the output_fd in the error condition of
      record_saved_cmdline(), we are writing 8 bytes from a memory location on
      the stack that contains a primitive that is only 4 bytes in size.
      Change the primitive to 8 bytes in size to match the size of the write
      in order to avoid reading unknown memory from the stack.
      
      Signed-off-by: default avatarChris Phlipot <cphlipot0@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20180829061954.18871-1-cphlipot0@gmail.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a72f6426
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Streamline bpf examples and headers installation · dad2762a
      Arnaldo Carvalho de Melo authored
      We were emitting 4 lines, two of them misleading:
      
        make: Entering directory '/home/acme/git/perf/tools/perf'
        <SNIP>
          INSTALL  lib
          INSTALL  include/bpf
          INSTALL  lib
          INSTALL  examples/bpf
        <SNIP>
        make: Leaving directory '/home/acme/git/perf/tools/perf'
      
      Make it more compact by showing just two lines:
      
        make: Entering directory '/home/acme/git/perf/tools/perf'
          INSTALL  bpf-headers
          INSTALL  bpf-examples
        make: Leaving directory '/home/acme/git/perf/tools/perf'
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-0nvkyciqdkrgy829lony5925@git.kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      dad2762a
    • Hisao Tanabe's avatar
      perf evsel: Fix potential null pointer dereference in perf_evsel__new_idx() · fd8d2702
      Hisao Tanabe authored
      
      If evsel is NULL, we should return NULL to avoid a NULL pointer
      dereference a bit later in the code.
      
      Signed-off-by: default avatarHisao Tanabe <xtanabe@gmail.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Fixes: 03e0a7df ("perf tools: Introduce bpf-output event")
      LPU-Reference: 20180824154556.23428-1-xtanabe@gmail.com
      Link: https://lkml.kernel.org/n/tip-e5plzjhx6595a5yjaf22jss3@git.kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fd8d2702
    • Kim Phillips's avatar
      perf arm64: Fix include path for asm-generic/unistd.h · 5ab1de93
      Kim Phillips authored
      The new syscall table support for arm64 mistakenly used the system's
      asm-generic/unistd.h file when processing the
      tools/arch/arm64/include/uapi/asm/unistd.h file's include directive:
      
      	#include <asm-generic/unistd.h>
      
      See "Committer notes" section of commit 2b588243
      
       "perf arm64:
      Generate system call table from asm/unistd.h" for more details.
      
      This patch removes the committer's temporary workaround, and instructs
      the host compiler to search the build tree's include path for the right
      copy of the unistd.h file, instead of the one on the system's
      /usr/include path.
      
      It thus fixes the committer's test that cross-builds an arm64 perf on an
      x86 platform running Ubuntu 14.04.5 LTS with an old toolchain:
      
      $ tools/perf/arch/arm64/entry/syscalls/mksyscalltbl /gcc-linaro-5.4.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc gcc `pwd`/tools tools/arch/arm64/include/uapi/asm/unistd.h | grep bpf
      	[280] = "bpf",
      
      Signed-off-by: default avatarKim Phillips <kim.phillips@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
      Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
      Fixes: 2b588243 ("perf arm64: Generate system call table from asm/unistd.h")
      Link: http://lkml.kernel.org/r/20180806172800.bbcec3cfcc51e2facc978bf2@arm.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5ab1de93
    • Jiri Olsa's avatar
      perf tests: Add breakpoint modify tests · 9b3579fc
      Jiri Olsa authored
      
      Adding to tests that aims on kernel breakpoint modification bugs.
      
      First test creates HW breakpoint, tries to change it and checks it was
      properly changed. It aims on kernel issue that prevents HW breakpoint to
      be changed via ptrace interface.
      
      The first test forks, the child sets itself as ptrace tracee and waits
      in signal for parent to trace it, then it calls bp_1 and quits.
      
      The parent does following steps:
      
       - creates a new breakpoint (id 0) for bp_2 function
       - changes that breakpoint to bp_1 function
       - waits for the breakpoint to hit and checks
         it has proper rip of bp_1 function
      
      This test aims on an issue in kernel preventing to change disabled
      breakpoints
      
      Second test mimics the first one except for few steps
      in the parent:
       - creates a new breakpoint (id 0) for bp_1 function
       - changes that breakpoint to bogus (-1) address
       - waits for the breakpoint to hit and checks
         it has proper rip of bp_1 function
      
      This test aims on an issue in kernel disabling enabled
      breakpoint after unsuccesful change.
      
      Committer testing:
      
        # uname -a
        Linux jouet 4.18.0-rc8-00002-g1236568ee3cb #12 SMP Tue Aug 7 14:08:26 -03 2018 x86_64 x86_64 x86_64 GNU/Linux
        # perf test -v "bp modify"
        62: x86 bp modify                                         :
        --- start ---
        test child forked, pid 25671
        in bp_1
        tracee exited prematurely 2
        FAILED arch/x86/tests/bp-modify.c:209 modify test 1 failed
      
        test child finished with -1
        ---- end ----
        x86 bp modify: FAILED!
        #
      
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Milind Chabbi <chabbi.milind@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20180827091228.2878-2-jolsa@kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9b3579fc
    • Martin Liška's avatar
      perf annotate: Properly interpret indirect call · 1dc27f63
      Martin Liška authored
      
      The patch changes the parsing of:
      
      	callq  *0x8(%rbx)
      
      from:
      
        0.26 │     → callq  *8
      
      to:
      
        0.26 │     → callq  *0x8(%rbx)
      
      in this case an address is followed by a register, thus one can't parse
      only the address.
      
      Committer testing:
      
      1) run 'perf record sleep 10'
      2) before applying the patch, run:
      
           perf annotate --stdio2 > /tmp/before
      
      3) after applying the patch, run:
      
           perf annotate --stdio2 > /tmp/after
      
      4) diff /tmp/before /tmp/after:
        --- /tmp/before 2018-08-28 11:16:03.238384143 -0300
        +++ /tmp/after  2018-08-28 11:15:39.335341042 -0300
        @@ -13274,7 +13274,7 @@
                      ↓ jle    128
                        hash_value = hash_table->hash_func (key);
                        mov    0x8(%rsp),%rdi
        -  0.91       → callq  *30
        +  0.91       → callq  *0x30(%r12)
                        mov    $0x2,%r8d
                        cmp    $0x2,%eax
                        node_hash = hash_table->hashes[node_index];
        @@ -13848,7 +13848,7 @@
                         mov    %r14,%rdi
                         sub    %rbx,%r13
                         mov    %r13,%rdx
        -              → callq  *38
        +              → callq  *0x38(%r15)
                         cmp    %rax,%r13
           1.91        ↓ je     240
                  1b4:   mov    $0xffffffff,%r13d
        @@ -14026,7 +14026,7 @@
                         mov    %rcx,-0x500(%rbp)
                         mov    %r15,%rsi
                         mov    %r14,%rdi
        -              → callq  *38
        +              → callq  *0x38(%rax)
                         mov    -0x500(%rbp),%rcx
                         cmp    %rax,%rcx
                       ↓ jne    9b0
      <SNIP tons of other such cases>
      
      Signed-off-by: default avatarMartin Liška <mliska@suse.cz>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: default avatarKim Phillips <kim.phillips@arm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/bd1f3932-be2b-85f9-7582-111ee0a43b07@suse.cz
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1dc27f63
    • Stefan Raspl's avatar
      tools/kvm_stat: re-animate display of dead guests · c012a0f2
      Stefan Raspl authored
      
      When filtering by guest (interactive commands 'p'/'g'), and the respective
      guest was destroyed, detect when the guest is up again through the guest
      name if possible.
      I.e. when displaying events for a specific guest, it is not necessary
      anymore to restart kvm_stat in case the guest is restarted.
      
      Signed-off-by: default avatarStefan Raspl <raspl@linux.ibm.com>
      Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
      c012a0f2
    • Stefan Raspl's avatar
      tools/kvm_stat: indicate dead guests as such · 404517e4
      Stefan Raspl authored
      
      For destroyed guests, kvm_stat essentially freezes with the last data
      displayed. This is acceptable for users, in case they want to inspect the
      final data. But it looks a bit irritating. Therefore, detect this situation
      and display a respective indicator in the header.
      
      Signed-off-by: default avatarStefan Raspl <raspl@linux.ibm.com>
      Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
      404517e4
    • Stefan Raspl's avatar
      tools/kvm_stat: handle guest removals more gracefully · 29c39f38
      Stefan Raspl authored
      
      When running with the DebugFS provider, removal of a guest can result in a
      negative CurAvg/s, which looks rather confusing.
      If so, suppress the body refresh and print a message instead.
      To reproduce, have at least one guest A completely booted. Then start
      another guest B (which generates a huge amount of events), then destroy B.
      On the next refresh, kvm_stat should display a whole lot of negative values
      in the CurAvg/s column.
      
      Signed-off-by: default avatarStefan Raspl <raspl@linux.ibm.com>
      Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
      29c39f38
    • Stefan Raspl's avatar
      tools/kvm_stat: don't reset stats when setting PID filter for debugfs · 0db8b310
      Stefan Raspl authored
      When setting a PID filter in debugfs, we unnecessarily reset the
      statistics, although there is no reason to do so. This behavior was
      merely introduced with commit 9f114a03
      
       "tools/kvm_stat: add
      interactive command 'r'", most likely to mimic the behavior of
      the tracepoints provider in this respect. However, there are plenty
      of differences between the two providers, so there is no reason not
      to take advantage of the possibility to filter by PID without
      resetting the statistics.
      
      Signed-off-by: default avatarStefan Raspl <raspl@linux.ibm.com>
      Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
      0db8b310
    • Stefan Raspl's avatar
      tools/kvm_stat: fix updates for dead guests · 710ab11a
      Stefan Raspl authored
      
      With pid filtering active, when a guest is removed e.g. via virsh shutdown,
      successive updates produce garbage.
      Therefore, we add code to detect this case and prevent further body updates.
      Note that when displaying the help dialog via 'h' in this case, once we exit
      we're stuck with the 'Collecting data...' message till we remove the filter.
      
      Signed-off-by: default avatarStefan Raspl <raspl@linux.ibm.com>
      Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
      710ab11a
    • Stefan Raspl's avatar
      tools/kvm_stat: fix handling of invalid paths in debugfs provider · 617c66b9
      Stefan Raspl authored
      
      When filtering by guest, kvm_stat displays garbage when the guest is
      destroyed - see sample output below.
      We add code to remove the invalid paths from the providers, so at least
      no more garbage is displayed.
      Here's a sample output to illustrate:
      
        kvm statistics - pid 13986 (foo)
      
         Event                                         Total %Total CurAvg/s
         diagnose_258                                     -2    0.0        0
         deliver_program_interruption                     -3    0.0        0
         diagnose_308                                     -4    0.0        0
         halt_poll_invalid                               -91    0.0       -6
         deliver_service_signal                         -244    0.0      -16
         halt_successful_poll                           -250    0.1      -17
         exit_pei                                       -285    0.1      -19
         exit_external_request                          -312    0.1      -21
         diagnose_9c                                    -328    0.1      -22
         userspace_handled                              -713    0.1      -47
         halt_attempted_poll                            -939    0.2      -62
         deliver_emergency_signal                      -3126    0.6     -208
         halt_wakeup                                   -7199    1.5     -481
         exit_wait_state                               -7379    1.5     -493
         diagnose_500                                 -56499   11.5    -3757
         exit_null                                    -85491   17.4    -5685
         diagnose_44                                 -133300   27.1    -8874
         exit_instruction                            -195898   39.8   -13037
         Total                                       -492063
      
      Signed-off-by: default avatarStefan Raspl <raspl@linux.vnet.ibm.com>
      Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
      617c66b9
    • Stefan Raspl's avatar
      tools/kvm_stat: fix python3 issues · 58f33cfe
      Stefan Raspl authored
      
      Python3 returns a float for a regular division - switch to a division
      operator that returns an integer.
      Furthermore, filters return a generator object instead of the actual
      list - wrap result in yet another list, which makes it still work in
      both, Python2 and 3.
      
      Signed-off-by: default avatarStefan Raspl <raspl@linux.ibm.com>
      Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
      58f33cfe