1. 15 Dec, 2016 19 commits
    • Joe Stringer's avatar
      samples/bpf: Make samples more libbpf-centric · d40fc181
      Joe Stringer authored
      Switch all of the sample code to use the function names from
      tools/lib/bpf so that they're consistent with that, and to declare their
      own log buffers. This allow the next commit to be purely devoted to
      getting rid of the duplicate library in samples/bpf.
      
      Committer notes:
      
      Testing it:
      
      On a fedora rawhide container, with clang/llvm 3.9, sharing the host
      linux kernel git tree:
      
        # make O=/tmp/build/linux/ headers_install
        # make O=/tmp/build/linux -C samples/bpf/
      
      Since I forgot to make it privileged, just tested it outside the
      container, using what it generated:
      
        # uname -a
        Linux jouet 4.9.0-rc8+ #1 SMP Mon Dec 12 11:20:49 BRT 2016 x86_64 x86_64 x86_64 GNU/Linux
        # cd /var/lib/docker/devicemapper/mnt/c43e09a53ff56c86a07baf79847f00e2cc2a17a1e2220e1adbf8cbc62734feda/rootfs/tmp/build/linux/samples/bpf/
        # ls -la offwaketime
        -rwxr-xr-x. 1 root root 24200 Dec 15 12:19 offwaketime
        # file offwaketime
        offwaketime: 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]=c940d3f127d5e66cdd680e42d885cb0b64f8a0e4, not stripped
        # readelf -SW offwaketime_kern.o  | grep PROGBITS
        [ 2] .text             PROGBITS        0000000000000000 000040 000000 00  AX  0   0  4
        [ 3] kprobe/try_to_wake_up PROGBITS        0000000000000000 000040 0000d8 00  AX  0   0  8
        [ 5] tracepoint/sched/sched_switch PROGBITS        0000000000000000 000118 000318 00  AX  0   0  8
        [ 7] maps              PROGBITS        0000000000000000 000430 000050 00  WA  0   0  4
        [ 8] license           PROGBITS        0000000000000000 000480 000004 00  WA  0   0  1
        [ 9] version           PROGBITS        0000000000000000 000484 000004 00  WA  0   0  4
        # ./offwaketime | head -5
        swapper/1;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule;__schedule;-;---;; 106
        CPU 0/KVM;entry_SYSCALL_64_fastpath;sys_ioctl;do_vfs_ioctl;kvm_vcpu_ioctl;kvm_arch_vcpu_ioctl_run;kvm_vcpu_block;schedule;__schedule;-;try_to_wake_up;swake_up_locked;swake_up;apic_timer_expired;apic_timer_fn;__hrtimer_run_queues;hrtimer_interrupt;local_apic_timer_interrupt;smp_apic_timer_interrupt;__irqentry_text_start;cpuidle_enter;call_cpuidle;cpu_startup_entry;start_secondary;;swapper/3 2
        Compositor;entry_SYSCALL_64_fastpath;sys_futex;do_futex;futex_wait;futex_wait_queue_me;schedule;__schedule;-;try_to_wake_up;futex_requeue;do_futex;sys_futex;entry_SYSCALL_64_fastpath;;SoftwareVsyncTh 5
        firefox;entry_SYSCALL_64_fastpath;sys_poll;do_sys_poll;poll_schedule_timeout;schedule_hrtimeout_range;schedule_hrtimeout_range_clock;schedule;__schedule;-;try_to_wake_up;pollwake;__wake_up_common;__wake_up_sync_key;pipe_write;__vfs_write;vfs_write;sys_write;entry_SYSCALL_64_fastpath;;Timer 13
        JS Helper;entry_SYSCALL_64_fastpath;sys_futex;do_futex;futex_wait;futex_wait_queue_me;schedule;__schedule;-;try_to_wake_up;do_futex;sys_futex;entry_SYSCALL_64_fastpath;;firefox 2
        #
      Signed-off-by: default avatarJoe Stringer <joe@ovn.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexei Starovoitov <ast@fb.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Wang Nan <wangnan0@huawei.com>
      Cc: netdev@vger.kernel.org
      Link: http://lkml.kernel.org/r/20161214224342.12858-2-joe@ovn.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d40fc181
    • Joe Stringer's avatar
      tools lib bpf: Add flags to bpf_create_map() · a5580c7f
      Joe Stringer authored
      Commit 6c905981 ("bpf: pre-allocate hash map elements") introduces
      map_flags to bpf_attr for BPF_MAP_CREATE command. Expose this new
      parameter in libbpf.
      
      By exposing it, users can access flags such as whether or not to
      preallocate the map.
      Signed-off-by: default avatarJoe Stringer <joe@ovn.org>
      Acked-by: default avatarWang Nan <wangnan0@huawei.com>
      Cc: Alexei Starovoitov <ast@fb.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Link: http://lkml.kernel.org/r/20161209024620.31660-4-joe@ovn.org
      [ Added clarifying comment made by Wang Nan ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a5580c7f
    • Joe Stringer's avatar
      tools lib bpf: use __u32 from linux/types.h · 83d994d0
      Joe Stringer authored
      Fixes the following issue when building without access to 'u32' type:
      
      ./tools/lib/bpf/bpf.h:27:23: error: unknown type name ‘u32’
      Signed-off-by: default avatarJoe Stringer <joe@ovn.org>
      Acked-by: default avatarWang Nan <wangnan0@huawei.com>
      Cc: Alexei Starovoitov <ast@fb.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Link: http://lkml.kernel.org/r/20161209024620.31660-3-joe@ovn.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      83d994d0
    • Joe Stringer's avatar
      tools lib bpf: Sync {tools,}/include/uapi/linux/bpf.h · 0cb34dc2
      Joe Stringer authored
      The tools version of this header is out of date; update it to the latest
      version from the kernel headers.
      Signed-off-by: default avatarJoe Stringer <joe@ovn.org>
      Acked-by: default avatarWang Nan <wangnan0@huawei.com>
      Cc: Alexei Starovoitov <ast@fb.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Link: http://lkml.kernel.org/r/20161209024620.31660-2-joe@ovn.org
      [ Sync it harder, after merging with what was in net-next via perf/urgent via torvalds/master to get BPG_PROG_(AT|DE)TACH, etc ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0cb34dc2
    • Ravi Bangoria's avatar
      perf annotate: Fix jump target outside of function address range · e216874c
      Ravi Bangoria authored
      If jump target is outside of function range, perf is not handling it
      correctly. Especially when target address is lesser than function start
      address, target offset will be negative. But, target address declared to
      be unsigned, converts negative number into 2's complement. See below
      example. Here target of 'jumpq' instruction at 34cf8 is 34ac0 which is
      lesser than function start address(34cf0).
      
              34ac0 - 34cf0 = -0x230 = 0xfffffffffffffdd0
      
      Objdump output:
      
        0000000000034cf0 <__sigaction>:
        __GI___sigaction():
          34cf0: lea    -0x20(%rdi),%eax
          34cf3: cmp    -bashx1,%eax
          34cf6: jbe    34d00 <__sigaction+0x10>
          34cf8: jmpq   34ac0 <__GI___libc_sigaction>
          34cfd: nopl   (%rax)
          34d00: mov    0x386161(%rip),%rax        # 3bae68 <_DYNAMIC+0x2e8>
          34d07: movl   -bashx16,%fs:(%rax)
          34d0e: mov    -bashxffffffff,%eax
          34d13: retq
      
      perf annotate before applying patch:
      
        __GI___sigaction  /usr/lib64/libc-2.22.so
                 lea    -0x20(%rdi),%eax
                 cmp    -bashx1,%eax
              v  jbe    10
              v  jmpq   fffffffffffffdd0
                 nop
          10:    mov    _DYNAMIC+0x2e8,%rax
                 movl   -bashx16,%fs:(%rax)
                 mov    -bashxffffffff,%eax
                 retq
      
      perf annotate after applying patch:
      
        __GI___sigaction  /usr/lib64/libc-2.22.so
                 lea    -0x20(%rdi),%eax
                 cmp    -bashx1,%eax
              v  jbe    10
              ^  jmpq   34ac0 <__GI___libc_sigaction>
                 nop
          10:    mov    _DYNAMIC+0x2e8,%rax
                 movl   -bashx16,%fs:(%rax)
                 mov    -bashxffffffff,%eax
                 retq
      Signed-off-by: default avatarRavi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Chris Riyder <chris.ryder@arm.com>
      Cc: Kim Phillips <kim.phillips@arm.com>
      Cc: Markus Trippelsdorf <markus@trippelsdorf.de>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: http://lkml.kernel.org/r/1480953407-7605-3-git-send-email-ravi.bangoria@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e216874c
    • Ravi Bangoria's avatar
      perf annotate: Support jump instruction with target as second operand · 3ee2eb6d
      Ravi Bangoria authored
      Architectures like PowerPC have jump instructions that includes a target
      address as a second operand. For example, 'bne cr7,0xc0000000000f6154'.
      Add support for such instruction in perf annotate.
      
      objdump o/p:
        c0000000000f6140:   ld     r9,1032(r31)
        c0000000000f6144:   cmpdi  cr7,r9,0
        c0000000000f6148:   bne    cr7,0xc0000000000f6154
        c0000000000f614c:   ld     r9,2312(r30)
        c0000000000f6150:   std    r9,1032(r31)
        c0000000000f6154:   ld     r9,88(r31)
      
      Corresponding perf annotate o/p:
      
      Before patch:
               ld     r9,1032(r31)
               cmpdi  cr7,r9,0
            v  bne    3ffffffffff09f2c
               ld     r9,2312(r30)
               std    r9,1032(r31)
        74:    ld     r9,88(r31)
      
      After patch:
               ld     r9,1032(r31)
               cmpdi  cr7,r9,0
            v  bne    74
               ld     r9,2312(r30)
               std    r9,1032(r31)
        74:    ld     r9,88(r31)
      Signed-off-by: default avatarRavi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Chris Riyder <chris.ryder@arm.com>
      Cc: Kim Phillips <kim.phillips@arm.com>
      Cc: Markus Trippelsdorf <markus@trippelsdorf.de>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: http://lkml.kernel.org/r/1480953407-7605-2-git-send-email-ravi.bangoria@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3ee2eb6d
    • Jiri Olsa's avatar
      perf record: Force ignore_missing_thread for uid option · 23dc4f15
      Jiri Olsa authored
      Enable perf_evsel::ignore_missing_thread for -u option to ignore
      complete failure if any of the user's processes die between its
      enumeration and time we open the event.
      
      Committer notes:
      
      While doing a 'make -j4 allmodconfig' we sometimes get into the race:
      
      Before:
      
        # perf record -u acme
        Error:
        The sys_perf_event_open() syscall returned with 3 (No such process) for event (cycles:ppp).
        /bin/dmesg may provide additional information.
        No CONFIG_PERF_EVENTS=y kernel support configured?
        #
      
      After:
      
        [root@jouet ~]# perf record -u acme
        WARNING: Ignored open failure for pid 9888
        WARNING: Ignored open failure for pid 18059
        [root@jouet ~]#
      
      Which is an improvement, with the races not preventing the remaining threads
      for the specified user from being monitored, but the message probably needs
      further clarification.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1481538943-21874-6-git-send-email-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      23dc4f15
    • Jiri Olsa's avatar
      perf evsel: Allow to ignore missing pid · a359c17a
      Jiri Olsa authored
      Adding perf_evsel::ignore_missing_cpu_thread bool.
      
      When set true, it allows perf to ignore error of missing pid of perf
      event syscall.
      
      We remove missing thread id from the thread_map, so the rest of the
      processing like ioctl and mmap won't get disturbed with -1 fd.
      
      The reason for supporting this is to ease up monitoring group of pids,
      that 'disappear' before perf opens their event. This currently leads
      perf to report error and exit and makes perf record's -u option unusable
      under certain setup.
      
      With this change we will allow this race and ignore such failure with
      following warning:
      
        WARNING: Ignored open failure for pid 8605
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20161213074622.GA3084@kravaSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a359c17a
    • Jiri Olsa's avatar
      perf thread_map: Add thread_map__remove function · 38af91f0
      Jiri Olsa authored
      Add thread_map__remove function to remove thread from thread map.
      
      Add automated test also.
      
      Committer notes:
      
      Testing it:
      
        # perf test "Remove thread map"
        39: Remove thread map                          : Ok
        # perf test -v "Remove thread map"
        39: Remove thread map                          :
        --- start ---
        test child forked, pid 4483
        2 threads: 4482, 4483
        1 thread: 4483
        0 thread:
        test child finished with 0
        ---- end ----
        Remove thread map: Ok
        #
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1481538943-21874-4-git-send-email-jolsa@kernel.org
      [ Added stdlib.h, to get the free() declaration ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      38af91f0
    • Jiri Olsa's avatar
      perf evsel: Use variable instead of repeating lengthy FD macro · 83c2e4f3
      Jiri Olsa authored
      It's more readable and will ease up following patches.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1481538943-21874-3-git-send-email-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      83c2e4f3
    • Jiri Olsa's avatar
      perf mem: Fix --all-user/--all-kernel options · 631ac41b
      Jiri Olsa authored
      Removing extra '--' prefix.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Fixes: ad16511b ("perf mem: Add -U/-K (--all-user/--all-kernel) options")
      Link: http://lkml.kernel.org/r/1481538943-21874-2-git-send-email-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      631ac41b
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Remove some needless __maybe_unused · 7e6a7998
      Arnaldo Carvalho de Melo authored
      I.e. those parameters/functions _are_ used, so ditch that misleading attribute.
      
      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: http://lkml.kernel.org/n/tip-13cqtjh0yojg5gzvpq1zzpl0@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7e6a7998
    • Namhyung Kim's avatar
      perf sched timehist: Show callchains for idle stat · ba957ebb
      Namhyung Kim authored
      When --idle-hist option is used with --summary, it now shows idle stats
      with callchains like below:
      
        Idle stats by callchain:
        CPU  0:   902.195 msec
        Idle time (msec)    Count Callchains
        ----------------  ------- --------------------------------------------------
                 370.589       69 futex_wait_queue_me <- futex_wait <- do_futex <- sys_futex <- entry_SYSCALL_64_fastpath
                 178.799       17 worker_thread <- kthread <- ret_from_fork
                 128.352       17 schedule_timeout <- rcu_gp_kthread <- kthread <- ret_from_fork
                 125.111       19 schedule_hrtimeout_range_clock <- schedule_hrtimeout_range <- poll_schedule_timeout <- do_select <- core_sys_select
                  71.599       50 schedule_hrtimeout_range_clock <- schedule_hrtimeout_range <- poll_schedule_timeout <- do_sys_poll <- sys_poll
                  23.146        1 rcu_gp_kthread <- kthread <- ret_from_fork
                   4.510        1 schedule_hrtimeout_range_clock <- schedule_hrtimeout_range <- ep_poll <- sys_epoll_wait <- do_syscall_64
                   0.085        1 schedule_hrtimeout_range_clock <- schedule_hrtimeout_range <- poll_schedule_timeout <- do_sys_poll <- do_restart_poll
        ...
      
      Committer notes:
      
      Extra testing:
      
        # uname -a
        Linux jouet 4.8.8-300.fc25.x86_64 #1 SMP Tue Nov 15 18:10:06 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
      
      1) Run 'perf sched record -g'
      
      2) Run 'perf sched timehist --idle --summary'
      
      <SNIP>
        Idle stats by callchain:
        CPU  0: 13456.840 msec
        Idle time (msec) Count Callchains
        ---------------- ----- --------------------------------------------------
                5386.637  3283 schedule_hrtimeout_range_clock <- schedule_hrtimeout_range <- poll_schedule_timeout <- do_sys_poll <- sys_poll
                2750.238  2299 futex_wait_queue_me <- futex_wait <- do_futex <- sys_futex <- do_syscall_64
                1275.672  1287 schedule_hrtimeout_range_clock <- schedule_hrtimeout_range <- ep_poll <- sys_epoll_wait <- entry_SYSCALL_64_fastpath
                 936.322   452 worker_thread <- kthread <- ret_from_fork
                 741.311   385 rcu_nocb_kthread <- kthread <- ret_from_fork
                 729.385   248 schedule_hrtimeout_range_clock <- schedule_hrtimeout_range <- poll_schedule_timeout <- do_sys_poll <- sys_ppoll
                 365.386   229 irq_thread <- kthread <- ret_from_fork
                 338.934   265 futex_wait_queue_me <- futex_wait <- do_futex <- sys_futex <- entry_SYSCALL_64_fastpath
                 219.488   201 schedule_timeout <- rcu_gp_kthread <- kthread <- ret_from_fork
                 186.839   410 schedule_hrtimeout_range_clock <- schedule_hrtimeout_range <- ep_poll <- sys_epoll_wait <- do_syscall_64
                 142.541    59 kvm_vcpu_block <- kvm_arch_vcpu_ioctl_run <- kvm_vcpu_ioctl <- do_vfs_ioctl <- sys_ioctl
                  83.887    92 smpboot_thread_fn <- kthread <- ret_from_fork
                  62.722    96 do_exit <- do_group_exit <- 0x2a5594 <- entry_SYSCALL_64_fastpath
                  47.894    83 pipe_wait <- pipe_read <- __vfs_read <- vfs_read <- sys_read
                  46.554    61 rcu_gp_kthread <- kthread <- ret_from_fork
                  34.337    21 schedule_timeout <- intel_fbc_work_fn <- process_one_work <- worker_thread <- kthread
                  29.521    14 schedule_hrtimeout_range_clock <- schedule_hrtimeout_range <- poll_schedule_timeout <- do_select <- core_sys_select
                  20.274    10 schedule_timeout <- io_schedule_timeout <- bit_wait_io <- __wait_on_bit <- out_of_line_wait_on_bit
                  15.085    55 schedule_timeout <- unix_stream_read_generic <- unix_stream_recvmsg <- sock_recvmsg <- SYSC_recvfrom
      <SNIP>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: default avatarDavid Ahern <dsahern@gmail.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20161208144755.16673-7-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ba957ebb
    • Namhyung Kim's avatar
      perf sched timehist: Add -I/--idle-hist option · 07235f84
      Namhyung Kim authored
      The --idle-hist option is to analyze system idle state so which process
      makes cpu to go idle.  If this option is specified, non-idle events will
      be skipped and processes switching to/from idle will be shown.
      
      This option is mostly useful when used with --summary(-only) option.  In
      the idle-time summary view, idle time is accounted to previous thread
      which is run before idle task.
      
      The example output looks like following:
      
        Idle-time summary
                        comm parent sched-out idle-time min-idle avg-idle max-idle stddev migrations
                                      (count)    (msec)   (msec)   (msec)   (msec)      %
        --------------------------------------------------------------------------------------------
              rcu_preempt[7]      2        95   550.872    0.011    5.798   23.146   7.63      0
             migration/1[16]      2         1    15.558   15.558   15.558   15.558   0.00      0
              khugepaged[39]      2         1     3.062    3.062    3.062    3.062   0.00      0
           kworker/0:1H[124]      2         2     4.728    0.611    2.364    4.116  74.12      0
        systemd-journal[167]      1         1     4.510    4.510    4.510    4.510   0.00      0
          kworker/u16:3[558]      2        13    74.737    0.080    5.749   12.960  21.96      0
         irq/34-iwlwifi[628]      2        21   118.403    0.032    5.638   23.990  24.00      0
          kworker/u17:0[673]      2         1     3.523    3.523    3.523    3.523   0.00      0
            dbus-daemon[722]      1         1     6.743    6.743    6.743    6.743   0.00      0
                ifplugd[741]      1         1    58.826   58.826   58.826   58.826   0.00      0
        wpa_supplicant[1490]      1         1    13.302   13.302   13.302   13.302   0.00      0
           wpa_actiond[1492]      1         2     4.064    0.168    2.032    3.896  91.72      0
               dockerd[1500]      1         1     0.055    0.055    0.055    0.055   0.00      0
        ...
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: default avatarDavid Ahern <dsahern@gmail.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20161208144755.16673-6-namhyung@kernel.org
      Link: http://lkml.kernel.org/r/20161213080632.19099-2-namhyung@kernel.org
      [ Merged fix sent by Namhyumg, as posted in the second Link: tag ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      07235f84
    • Namhyung Kim's avatar
      perf sched timehist: Skip non-idle events when necessary · a4b2b6f5
      Namhyung Kim authored
      Sometimes it only focuses on idle-related events like upcoming idle-hist
      feature.  In this case we don't want to see other event to reduce noise.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarDavid Ahern <dsahern@gmail.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20161208144755.16673-5-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a4b2b6f5
    • Namhyung Kim's avatar
      perf sched timehist: Save callchain when entering idle · 699b5b92
      Namhyung Kim authored
      In order to investigate the idleness reason, it is necessary to keep the
      callchains when entering idle.  This can be identified by the
      sched:sched_switch event having the next_pid field as 0.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarDavid Ahern <dsahern@gmail.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20161208144755.16673-4-namhyung@kernel.org
      Link: http://lkml.kernel.org/r/20161213080632.19099-1-namhyung@kernel.org
      [ Merged fix from Namhyung, see second Link: tag ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      699b5b92
    • Namhyung Kim's avatar
      perf sched timehist: Introduce struct idle_time_data · 3bc2fa9c
      Namhyung Kim authored
      The struct idle_time_data is to keep idle stats with callchains entering
      to the idle task.  The normal thread_runtime calculation is done
      transparently since it extends the struct thread_runtime.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarDavid Ahern <dsahern@gmail.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20161208144755.16673-3-namhyung@kernel.org
      [ Align struct field names ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3bc2fa9c
    • Namhyung Kim's avatar
      perf sched timehist: Split is_idle_sample() · 96039c7c
      Namhyung Kim authored
      The is_idle_sample() function actually does more than determining
      whether sample come from idle task.  Split the callchain part into
      save_task_callchain() to make it clearer.
      
      Also checking prev_pid from trace data looks preferred than just
      checking sample->pid since it's possible, although rare, to have invalid
      0 pid/tid on scheduling an exiting task.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarDavid Ahern <dsahern@gmail.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20161208144755.16673-2-namhyung@kernel.org
      [ Remove some needless () in some return statements ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      96039c7c
    • Jiri Olsa's avatar
      perf tools: Move headers check into bash script · aeafd623
      Jiri Olsa authored
      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: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      aeafd623
  2. 13 Dec, 2016 21 commits