1. 13 9月, 2017 29 次提交
  2. 12 9月, 2017 11 次提交
    • M
      perf stat: Wait for the correct child · dfc9eec7
      Milian Wolff 提交于
      When packaging the perf userland application into an AppImage, the
      wait() call in perf stat returned too early. It turned out that some
      other child process exited, but not the one perf stat launched:
      
        $ sudo strace -e fork,execve,clone,wait4 -f ./perf-x86_64.AppImage stat sleep 1
        execve("./perf-git.3a73b7f9-x86_64.AppImage", ["./perf-git.3a73b7f9-x86_64.AppIm"..., "stat", "sleep", "1"], 0x7ffec1bbf050 /* 18 vars */) = 0
        clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f6a6e7efe50) = 3912
        strace: Process 3912 attached
        [pid  3912] clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f6a6e7efe50) = 3914
        strace: Process 3914 attached
        [pid  3912] +++ exited with 0 +++
        [pid  3911] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3912, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
        [pid  3914] clone(strace: Process 3915 attached
        child_stack=0x7f6a6d9fefb0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f6a6d9ff9d0, tls=0x7f6a6d9ff700, child_tidptr=0x7f6a6d9ff9d0) = 3915
        [pid  3911] execve("/tmp/.mount_perf-g6VYMpl/AppRun", ["./perf-git.3a73b7f9-x86_64.AppIm"..., "stat", "sleep", "1"], 0x14aab70 /* 21 vars */) = 0
        [pid  3911] clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f4ae113c4d0) = 3916
        strace: Process 3916 attached
        [pid  3911] wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 3912
        [pid  3916] execve("/usr/libexec/perf-core/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/tmp/./sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/home/milian/.bin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/usr/lib/icecream/libexec/icecc/bin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/ssd2/milian/projects/compiled/other/bin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/home/milian/.bin/kf5/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/ssd2/milian/projects/compiled/kf5/bin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/home/milian/projects/compiled/other/bin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/home/milian/projects/compiled/kf5/bin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/usr/local/sbin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/usr/local/bin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/usr/bin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */
         Performance counter stats for 'sleep 1':
      
             <not counted>	task-clock
             <not counted>	context-switches
             <not counted>	cpu-migrations
             <not counted>	page-faults
             <not counted>	cycles
             <not counted>	instructions
             <not counted>      branches
             <not counted>      branch-misses
      
               0.000047194 seconds time elapsed
      
        [pid  3916] --- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=3911, si_uid=0} ---
        [pid  3916] +++ killed by SIGTERM +++
        [pid  3911] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED, si_pid=3916, si_uid=0, si_status=SIGTERM, si_utime=0, si_stime=0} ---
        [pid  3915] --- SIGPIPE {si_signo=SIGPIPE, si_code=SI_USER, si_pid=3914, si_uid=0} ---
        [pid  3911] +++ exited with 0 +++
        [pid  3915] --- SIGHUP {si_signo=SIGHUP, si_code=SI_USER, si_pid=3914, si_uid=0} ---
        [pid  3915] +++ exited with 0 +++
        +++ exited with 0 +++
      
      This patch uses waitpid instead to ensure the call waits for the
      debuggee application launched by 'perf stat'. This fixes 'perf stat'
      when launched from an AppImage:
      
        $ ./perf-x86_64.AppImage stat sleep 1
      
         Performance counter stats for 'sleep 1':
      
                0.357235      task-clock (msec)         #    0.000 CPUs utilized
                       1      context-switches          #    0.003 M/sec
                       0      cpu-migrations            #    0.000 K/sec
                      50      page-faults               #    0.140 M/sec
                 1269602      cycles                    #    3.554 GHz
                  654278      instructions              #    0.52  insn per cycle
                  129963      branches                  #  363.803 M/sec
                    7082      branch-misses             #    5.45% of all branches
      
             1.000633420 seconds time elapsed
      Signed-off-by: NMilian Wolff <milian.wolff@kdab.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/20170912152523.4497-1-milian.wolff@kdab.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      dfc9eec7
    • M
      perf tools: Support running perf binaries with a dash in their name · 3192f1ed
      Milian Wolff 提交于
      Previously the part behind "perf-" was interpreted as an internal perf
      command. If the suffix could not be handled, the execution was stopped.
      This makes it impossible to launch perf binaries that got renamed to
      have the `perf-` prefix. This is e.g. the case for appimages (e.g.
      "perf-x86_64.AppImage"), but would also apply to all other scenarios
      where users symlink or rename perf themselves:
      
      Status quo with the broken behavior:
      
        $ ln -s ./perf ./perf-custom-suffix
        $ ./perf-custom-suffix list
        cannot handle custom-suffix internally$
      
      Also note the missing newline at the end of the error message.
      
      With this patch applied, the above works properly:
      
        $ ./perf-custom-suffix list
      
        List of pre-defined events (to be used in -e):
        ...
      Signed-off-by: NMilian Wolff <milian.wolff@kdab.com>
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Yao Jin <yao.jin@linux.intel.com>
      Link: http://lkml.kernel.org/r/20170911111422.31903-1-milian.wolff@kdab.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3192f1ed
    • T
      perf config: Check not only section->from_system_config but also item's · cba225d6
      Taeung Song 提交于
      Currently section->from_system_config is being checked multiple times.
      item->from_system_config should be checked instead, when iterating thru
      the items in a section. Fix it.
      Signed-off-by: NTaeung Song <treeze.taeung@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/1504754325-9724-1-git-send-email-treeze.taeung@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      cba225d6
    • J
      perf ui progress: Fix progress update · a82bfd04
      Jiri Olsa 提交于
      We currently update the 'next' variable only with a single step value.
      But it's possible the 'adv' update is bigger than single 'step' value.
      This would leave 'next' value under counted and force unnecessary
      ui_progress__ops->update calls.
      
      Calculate the amount of steps we need for 'adv' update and increase the
      'next' with that amounts of steps.
      Signed-off-by: NJiri 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/20170908120510.22515-3-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a82bfd04
    • J
      perf ui progress: Make sure we always define step value · 4d286c89
      Jiri Olsa 提交于
      Unlikely, but we could have ui_progress__init being called with total <
      16, which would set the next and step variables to 0. That would force
      unnecessary ui_progress__ops->update calls because 'next' would never
      raise.
      
      Forcing the next and step values to be always > 0.
      Signed-off-by: NJiri 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/20170908120510.22515-2-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4d286c89
    • J
      perf tools: Open perf.data with O_CLOEXEC flag · cd6379eb
      Jiri Olsa 提交于
      Do not carry the perf.data file descriptor into the workload process and
      close it when perf executes the workload.
      Signed-off-by: NJiri 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/20170908084621.31595-2-jolsa@kernel.org
      [ Add definitions for O_CLOEXEC for older systems ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      cd6379eb
    • J
      tools lib api: Fix make DEBUG=1 build · 58b79186
      Jiri Olsa 提交于
      Do not use -D_FORTIFY_SOURCE=2 for DEBUG build as it seems to mess up
      with debuginfo, which results in bad gdb experience.
      
      We already do that for tools/perf/.
      Signed-off-by: NJiri 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/20170908084621.31595-1-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      58b79186
    • M
      perf tests: Fix compile when libunwind's unwind.h is available · df90cc41
      Milian Wolff 提交于
      When cross compiling perf and I want to link against a self-compiled
      libunwind, I usually make the custom path where the libunwind headers
      exist visible by adding the libunwind prefix to the include path when
      compiling perf, i.e.:
      
      ~~~~~
      $ ls $HOME/projects/compiled/other/include/
      libunwind-coredump.h  libunwind.h         libunwind-x86_64.h
      libunwind-common.h  libunwind-dynamic.h   libunwind-ptrace.h
      unwind.h
      $ make EXTRA_CFLAGS="-I$HOME/projects/compiled/other/include/
      ~~~~~~
      
      Note the `unwind.h` header from libunwind which leads to compile
      errors when compiling tests/dwarf-unwind.c, since it shadows perf's
      util/unwind.h:
      
      ~~~~~
      tests/dwarf-unwind.c:41:32: error: ‘struct unwind_entry’ declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
       static int unwind_entry(struct unwind_entry *entry, void *arg)
                                      ^~~~~~~~~~~~
      tests/dwarf-unwind.c: In function ‘unwind_entry’:
      tests/dwarf-unwind.c:44:22: error: dereferencing pointer to incomplete type ‘struct unwind_entry’
        char *symbol = entry->sym ? entry->sym->name : NULL;
                            ^~
      tests/dwarf-unwind.c: In function ‘unwind_thread’:
      tests/dwarf-unwind.c:92:8: error: implicit declaration of function ‘unwind__get_entries’; did you mean ‘unwind_entry’? [-Werror=implicit-function-declaration]
        err = unwind__get_entries(unwind_entry, &cnt, thread,
              ^~~~~~~~~~~~~~~~~~~
              unwind_entry
      tests/dwarf-unwind.c:92:8: error: nested extern declaration of ‘unwind__get_entries’ [-Werror=nested-externs]
      ~~~~~~
      
      Fix this compile error by specificing an explicit include of perf's
      unwind.h in the util folder.
      Signed-off-by: NMilian Wolff <milian.wolff@kdab.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Yao Jin <yao.jin@linux.intel.com>
      Link: http://lkml.kernel.org/r/20170906150209.12579-1-milian.wolff@kdab.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      df90cc41
    • A
      tools include linux: Guard against redefinition of some macros · 259d4077
      Arnaldo Carvalho de Melo 提交于
      When cross building to android r15c (and older versions) on Fedora 26
      we notice these:
      
      /opt/android-ndk-r15c/platforms/android-24/arch-arm/usr/include/sys/cdefs.h:332:0: note: this is the location of the previous definition
      
      For __aligned, __packed and __noreturn, so guard those with ifdefs to
      avoid drowning useful warnings in these.
      
      Cc: Adrian Hunter <adrian.hunter@intel.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-d7w3fa9c22dtmrwbedos6ie1@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      259d4077
    • L
      Merge branch 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm · 8fac2f96
      Linus Torvalds 提交于
      Pull ARM updates from Russell King:
       "Low priority fixes and updates for ARM:
      
         - add some missing includes
      
         - efficiency improvements in system call entry code when tracing is
           enabled
      
         - ensure ARMv6+ is always built as EABI
      
         - export save_stack_trace_tsk()
      
         - fix fatal signal handling during mm fault
      
         - build translation table base address register from scratch
      
         - appropriately align the .data section to a word boundary where we
           rely on that data being word aligned"
      
      * 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm:
        ARM: 8691/1: Export save_stack_trace_tsk()
        ARM: 8692/1: mm: abort uaccess retries upon fatal signal
        ARM: 8690/1: lpae: build TTB control register value from scratch in v7_ttb_setup
        ARM: align .data section
        ARM: always enable AEABI for ARMv6+
        ARM: avoid saving and restoring registers unnecessarily
        ARM: move PC value into r9
        ARM: obtain thread info structure later
        ARM: use aliases for registers in entry-common
        ARM: 8689/1: scu: add missing errno include
        ARM: 8688/1: pm: add missing types include
      8fac2f96
    • L
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · 260d1658
      Linus Torvalds 提交于
      Pull more s390 updates from Martin Schwidefsky:
       "The second patch set for the 4.14 merge window:
      
         - Convert the dasd device driver to the blk-mq interface.
      
         - Provide three zcrypt interfaces for vfio_ap. These will be required
           for KVM guest access to the crypto cards attached via the AP bus.
      
         - A couple of memory management bug fixes."
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        s390/dasd: blk-mq conversion
        s390/mm: use a single lock for the fields in mm_context_t
        s390/mm: fix race on mm->context.flush_mm
        s390/mm: fix local TLB flushing vs. detach of an mm address space
        s390/zcrypt: externalize AP queue interrupt control
        s390/zcrypt: externalize AP config info query
        s390/zcrypt: externalize test AP queue
        s390/mm: use VM_BUG_ON in crst_table_[upgrade|downgrade]
      260d1658