1. 16 Jan, 2015 11 commits
    • Namhyung Kim's avatar
      perf tools: Fix segfault for symbol annotation on TUI · 813ccd15
      Namhyung Kim authored
      Currently the symbol structure is allocated with symbol_conf.priv_size
      to carry sideband information like annotation, map browser on TUI and
      sort-by-name tree node.  So retrieving these information from symbol
      needs to care about the details of such placement.
      
      However the annotation code just assumes that the symbol is placed after
      the struct annotation.  But actually there's other info between them.
      So accessing those struct will lead to an undefined behavior (usually a
      crash) after they write their info to the same location.
      
      To reproduce the problem, please follow the steps below:
      
        1. run perf report (TUI of course) with -v option
        2. open map browser (by pressing right arrow key for any entry)
        3. search any function (by pressing '/' key and input whatever..)
        4. return to the hist browser (by pressing 'q' or left arrow key)
        5. open annotation window for the same entry (by pressing 'a' key)
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1421234288-22758-1-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      813ccd15
    • Wang Nan's avatar
      perf test: Fix dwarf unwind using libunwind. · b93b0967
      Wang Nan authored
      Perf tool fails to unwind user stack if the event raises in a shared
      object. This patch improves tests/dwarf-unwind.c to demonstrate the
      problem by utilizing commonly used glibc function "bsearch". If perf is
      not statically linked, the testcase will try to unwind a mixed call
      trace.
      
      By debugging libunwind I found that there is a bug in unwind-libunwind:
      it always passes 0 as segbase to libunwind, cause libunwind unable to
      locate debug_frame entry fir first level ip address (I add some more
      debugging output into libunwind to make things clear):
      
                     >_Uarm_dwarf_find_debug_frame: start_ip = 10be98, end_ip = 10c2a4
                     >_Uarm_dwarf_find_debug_frame: found debug_frame table `/lib/libc-2.18.so': segbase=0x0, len=7, gp=0x0, table_data=0x449388
                     >_Uarm_dwarf_search_unwind_table: call lookup:ip = b6cd3bcc, segbase = 0, rel_ip = b6cd3bcc
                     >lookup: e->start_ip_offset = bcf18 (rel_ip = b6cd3bcc)
                     >lookup: e->start_ip_offset = 6d314 (rel_ip = b6cd3bcc)
                     >lookup: e->start_ip_offset = 33d0c (rel_ip = b6cd3bcc)
                      ...
                     >lookup: e->start_ip_offset = 15d0c (rel_ip = b6cd3bcc)
                     >lookup: e->start_ip_offset = 15c40 (rel_ip = b6cd3bcc)
       >_Uarm_dwarf_search_unwind_table: IP b6cd3bcc inside range b6c12000-b6d4c000, but no explicit unwind info found
                      >put_rs_cache: unmasking signals/interrupts and releasing lock
                     >_Uarm_dwarf_step: returning -10
       >_Uarm_step: dwarf_step()=-10
      
      This patch passes map->start as segbase to dwarf_find_debug_frame(), so
      di will be initialized correctly.
      
      In addition, dso and executable are different when setting segbase. This
      patch first check whether the elf is executable, and pass segbase only
      for shared object.
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Li Zefan <lizefan@huawei.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1421203007-75799-1-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b93b0967
    • Vineet Gupta's avatar
      perf tools: Avoid build splat for syscall numbers with uclibc · ea1fe3a8
      Vineet Gupta authored
      This is due to duplicated unistd inclusion (via uClibc headers + kernel headers)
      Also seen on ARM uClibc based tools
      
         ------- ARC build ---------->8-------------
      
        CC       util/evlist.o
      In file included from
      ~/arc/k.org/arch/arc/include/uapi/asm/unistd.h:25:0,
                       from util/../perf-sys.h:10,
                       from util/../perf.h:15,
                       from util/event.h:7,
                       from util/event.c:3:
      ~/arc/k.org/include/uapi/asm-generic/unistd.h:906:0:
      warning: "__NR_fcntl64" redefined [enabled by default]
       #define __NR_fcntl64 __NR3264_fcntl
       ^
      In file included from
      ~/arc/gnu/INSTALL_1412-arc-2014.12-rc1/arc-snps-linux-uclibc/sysroot/usr/include/sys/syscall.h:24:0,
                       from util/../perf-sys.h:6,
         ----------------->8-------------------
      
         ------- ARM build ---------->8-------------
      
        CC FPIC  plugin_scsi.o
      In file included from util/../perf-sys.h:9:0,
                       from util/../perf.h:15,
                       from util/cache.h:7,
                       from perf.c:12:
      ~/arc/k.org/arch/arm/include/uapi/asm/unistd.h:28:0:
      warning: "__NR_restart_syscall" redefined [enabled by default]
      In file included from
      ~/buildroot/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/sys/syscall.h:25:0,
                       from util/../perf-sys.h:6,
                       from util/../perf.h:15,
                       from util/cache.h:7,
                       from perf.c:12:
      ~/buildroot/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/bits/sysnum.h:17:0:
      note: this is the location of the previous definition
         ----------------->8-------------------
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Cc: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1421156604-30603-4-git-send-email-vgupta@synopsys.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ea1fe3a8
    • Vineet Gupta's avatar
      perf tools: Elide strlcpy warning with uclibc · a83d869f
      Vineet Gupta authored
         ----------------->8------------------
        CC       bench/sched-pipe.o
      In file included from builtin-annotate.c:13:0:
      util/cache.h:76:15: warning: redundant redeclaration of 'strlcpy'
      [-Wredundant-decls]
       extern size_t strlcpy(char *dest, const char *src, size_t size);
                     ^
      In file included from util/util.h:55:0,
                       from builtin.h:4,
                       from builtin-annotate.c:8:
      ~/vineetg/arc/gnu/INSTALL_1412-arc-2014.12-rc1/arc-snps-linux-uclibc/sysroot/usr/include/string.h:396:15:
      note: previous declaration of 'strlcpy' was here
       extern size_t strlcpy(char *__restrict dst, const char *__restrict src,
         ----------------->8------------------
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Cc: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1421156604-30603-3-git-send-email-vgupta@synopsys.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a83d869f
    • Alexey Brodkin's avatar
      perf tools: Fix statfs.f_type data type mismatch build error with uclibc · db1806ed
      Alexey Brodkin authored
      ARC Linux uses the no legacy syscalls abi and corresponding uClibc headers
      statfs defines f_type to be U32 which causes perf build breakage
      
      http://git.uclibc.org/uClibc/tree/libc/sysdeps/linux/common-generic/bits/statfs.h
      
        ----------->8---------------
          CC       fs/fs.o
        fs/fs.c: In function 'fs__valid_mount':
        fs/fs.c:82:24: error: comparison between signed and unsigned integer
        expressions [-Werror=sign-compare]
          else if (st_fs.f_type != magic)
                                ^
        cc1: all warnings being treated as errors
        ----------->8---------------
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Cody P Schafer <dev@codyps.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Vineet Gupta <Vineet.Gupta1@synopsys.com>
      Link: http://lkml.kernel.org/r/1420888254-17504-2-git-send-email-vgupta@synopsys.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      db1806ed
    • Arnaldo Carvalho de Melo's avatar
      tools: Remove bitops/hweight usage of bits in tools/perf · 25cd480e
      Arnaldo Carvalho de Melo authored
      We need to use lib/hweight.c for that, just like we do for lib/rbtree.c,
      so tools need to link hweight.o. For now do it directly, but we need to
      have a tools/lib/lk.a or .so that collects these goodies...
      Reported-by: default avatarJan Beulich <JBeulich@suse.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-a1e91dx3apzqw5kbdt7ut21s@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      25cd480e
    • Namhyung Kim's avatar
      perf machine: Fix __machine__findnew_thread() error path · 260d819e
      Namhyung Kim authored
      When thread__init_map_groups() fails, a new thread should be removed
      from the rbtree since it's gonna be freed.  Also update last match cache
      only if the function succeeded.
      Reported-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1420763892-15535-1-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      260d819e
    • Namhyung Kim's avatar
      perf tools: Fix building error in x86_64 when dwarf unwind is on · c6e5e9fb
      Namhyung Kim authored
      When build with 'make ARCH=x86' and dwarf unwind is on, there is a
      compiling error:
      
         CC       /home/wn/perf/arch/x86/util/unwind-libdw.o
         CC       /home/wn/perf/arch/x86/tests/regs_load.o
       arch/x86/tests/regs_load.S: Assembler messages:
       arch/x86/tests/regs_load.S:65: Error: operand type mismatch for `push'
       arch/x86/tests/regs_load.S:72: Error: operand type mismatch for `pop'
       make[1]: *** [/home/wn/perf/arch/x86/tests/regs_load.o] Error 1
       make[1]: INTERNAL: Exiting with 25 jobserver tokens available; should be 24!
       make: *** [all] Error 2
       ...
      
      Which is caused by incorrectly undefine macro HAVE_ARCH_X86_64_SUPPORT.
      'config/Makefile.arch' tests __x86_64__ only when 'ARCH=x86_64'.
      However, when building x86_64 kernel, ARCH=x86 is valid and commonly
      used. Build systems, such as yocto, uses x86_64 compiler with 'ARCH=x86'
      to build x86_64 perf, which causes mismatching.
      
      As __LP64__ is defined for x86_64 as well, we can consolidate the
      __x86_64__ check to the __LP64__ check and get rid of the IS_X86_64
      IMHO.
      
      (This patch is made by Namhyung Kim when replying my v1 patch:
      
      https://lkml.org/lkml/2015/1/7/17
      
      I modified the code to remove dependency on RAW_ARCH:
      
      https://lkml.org/lkml/2015/1/7/865
      
      Namhyung Kim didn't provide his SOB in his original email. I add
      mine only for my modification.)
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Li Zefan <lizefan@huawei.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/1421029255-23039-1-git-send-email-wangnan0@huawei.com
      [ Namhyung provided his S-o-B on a followup to this patch thread on lkml ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c6e5e9fb
    • Namhyung Kim's avatar
      perf probe: Propagate error code when write(2) failed · 7949ba1f
      Namhyung Kim authored
      When it failed to write probe commands to the probe_event file in
      debugfs, it needs to propagate the error code properly.  Current code
      blindly uses the return value of the write(2) so it always uses
      -1 (-EPERM) and it might confuse users.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1420886028-15135-4-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7949ba1f
    • Kan Liang's avatar
      perf/x86/intel: Fix bug for "cycles:p" and "cycles:pp" on SLM · 33636732
      Kan Liang authored
      cycles:p and cycles:pp do not work on SLM since commit:
      
         86a04461 ("perf/x86: Revamp PEBS event selection")
      
      UOPS_RETIRED.ALL is not a PEBS capable event, so it should not be used
      to count cycle number.
      
      Actually SLM calls intel_pebs_aliases_core2() which uses INST_RETIRED.ANY_P
      to count the number of cycles. It's a PEBS capable event. But inv and
      cmask must be set to count cycles.
      
      Considering SLM allows all events as PEBS with no flags, only
      INST_RETIRED.ANY_P, inv=1, cmask=16 needs to handled specially.
      Signed-off-by: default avatarKan Liang <kan.liang@intel.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1421084541-31639-1-git-send-email-kan.liang@intel.com
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      33636732
    • Stephane Eranian's avatar
      perf/rapl: Fix sysfs_show() initialization for RAPL PMU · 433678bd
      Stephane Eranian authored
      This patch fixes a problem with the initialization of the
      sysfs_show() routine for the RAPL PMU.
      
      The current code was wrongly relying on the EVENT_ATTR_STR()
      macro which uses the events_sysfs_show() function in the x86
      PMU code. That function itself was relying on the x86_pmu data
      structure. Yet RAPL and the core PMU (x86_pmu) have nothing to
      do with each other. They should therefore not interact with
      each other.
      
      The x86_pmu structure is initialized at boot time based on
      the host CPU model. When the host CPU is not supported, the
      x86_pmu remains uninitialized and some of the callbacks it
      contains are NULL.
      
      The false dependency with x86_pmu could potentially cause crashes
      in case the x86_pmu is not initialized while the RAPL PMU is. This
      may, for instance, be the case in virtualized environments.
      
      This patch fixes the problem by using a private sysfs_show()
      routine for exporting the RAPL PMU events.
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20150113225953.GA21525@thinkpad
      Cc: vincent.weaver@maine.edu
      Cc: jolsa@redhat.com
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      433678bd
  2. 15 Jan, 2015 1 commit
    • Linus Torvalds's avatar
      Merge branch 'thermal-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux · f800c25b
      Linus Torvalds authored
      Pull thermal fixes from Zhang Rui:
       "Specifics:
      
         - bogus type qualifier fix in OF thermal code.
         - Minor fixes on imx and rcar thermal drivers.
         - Update TI SoC thermal maintainer entry.
         - Updated documentation of OF cpufreq cooling register"
      
      * 'thermal-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux:
        thermal: rcar: Spelling/grammar: s/drier use .../driver uses ...s/
        thermal: rcar: change type of ctemp in rcar_thermal_update_temp()
        thermal: rcar: fix ENR register value
        Documentation: thermal: document of_cpufreq_cooling_register()
        Thermal: imx: add clk disable/enable for suspend/resume
        MAINTAINERS: update ti-soc-thermal status
        MAINTAINERS: Add linux-omap to list of reviewers for TI Thermal
        thermal: of: Remove bogus type qualifier for of_thermal_get_trip_points()
      f800c25b
  3. 14 Jan, 2015 18 commits
  4. 13 Jan, 2015 10 commits