Skip to content
Snippets Groups Projects
  1. Oct 10, 2015
  2. Sep 26, 2015
    • Len Brown's avatar
      tools/power turbosat: update version number · af71b980
      Len Brown authored
      
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
      af71b980
    • Len Brown's avatar
      tools/power turbostat: SKL: Adjust for TSC difference from base frequency · a2b7b749
      Len Brown authored
      
      On a Skylake with 1500MHz base frequency,
      the TSC runs at 1512MHz.
      
      This is because the TSC is no longer in the n*100 MHz BCLK domain,
      but is now in the m*24MHz crystal clock domain. (24 MHz * 63 = 1512 MHz)
      
      This adds error to several calculations in turbostat,
      unless the TSC sample sizes are adjusted for this difference.
      
      Note that calculations in the time domain are immune
      from this issue, as the timing sub-system has already
      calibrated the TSC against a known wall clock.
      
      AVG_MHz = APERF_delta/measurement_interval
      
      	need no adjustment.  APERF_delta is in the BCLK domain,
      	and measurement_interval is in the time domain.
      
      TSC_MHz  =  TSC_delta/measurement_interval
      
      	needs no adjustment -- as we really do want to report
      	the actual measured TSC delta here, and measurement_interval
      	is in the accurate time domain.
      
      %Busy = MPERF_delta/TSC_delta
      
      	needs adjustment to use TSC_BCLK_DOMAIN_delta.
      	TSC_BCLK_DOMAIN_delta = TSC_delta * base_hz / tsc_hz
      
      Bzy_MHz = TSC_delta/APERF_delta/MPERF_delta/measurement_interval
      
      	need adjustment as above.
      
      No other metrics in turbostat need to be adjusted.
      
      Before:
      
           CPU Avg_MHz   %Busy Bzy_MHz TSC_MHz
             -     550   24.84    2216    1512
             0    2191   98.73    2219    1514
             2       0    0.01    2130    1512
             1       9    0.43    2016    1512
             3       2    0.08    2016    1512
      
      After:
      
           CPU Avg_MHz   %Busy Bzy_MHz TSC_MHz
             -     550   25.05    2198    1512
             0    2190   99.62    2199    1512
             2       0    0.01    2152    1512
             1       9    0.46    2000    1512
             3       2    0.10    2000    1512
      
      Note that in this example, the "Before" Bzy_MHz
      was reported as exceeding the 2200 max turbo rate.
      Also, even a pinned spin loop would not be reported
      as over 99% busy.
      
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
      a2b7b749
    • Hubert Chrzaniuk's avatar
      tools/power turbostat: KNL workaround for %Busy and Avg_MHz · b2b34dfe
      Hubert Chrzaniuk authored
      
      KNL increments APERF and MPERF every 1024 clocks.
      This is compliant with the architecture specification,
      which requires that only the ratio of APERF/MPERF need be valid.
      
      However, turbostat takes advantage of the fact that these
      two MSRs increment every un-halted clock
      at the actual and base frequency:
      
      AVG_MHz = APERF_delta/measurement_interval
      
      %Busy = MPERF_delta/TSC_delta
      
      This quirk is needed for these calculations to also work on KNL,
      which would otherwise show a value 1024x smaller than expected.
      
      Signed-off-by: default avatarHubert Chrzaniuk <hubert.chrzaniuk@intel.com>
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
      b2b34dfe
    • Len Brown's avatar
      tools/power turbostat: IVB Xeon: fix --debug regression · 756357b8
      Len Brown authored
      
      Staring in Linux-4.3-rc1,
      commit 6fb3143b ("tools/power turbostat: dump CONFIG_TDP")
      touches MSR 0x648, which is not supported on IVB-Xeon.
      This results in "turbostat --debug" exiting on those systems:
      
      turbostat: /dev/cpu/2/msr offset 0x648 read failed: Input/output error
      
      Remove IVB-Xeon from the list of machines supporting with that MSR.
      
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
      756357b8
  3. Sep 25, 2015
  4. Sep 22, 2015
  5. Sep 18, 2015
    • Mark Rutland's avatar
      perf record: Avoid infinite loop at buildid processing with no samples · 381c02f6
      Mark Rutland authored
      
      If a session contains no events, we can get stuck in an infinite loop in
      __perf_session__process_events, with a non-zero file_size and data_offset, but
      a zero data_size.
      
      In this case, we can mmap the entirety of the file (consisting of the file and
      attribute headers), and fetch_mmaped_event will correctly refuse to read any
      (unmapped and non-existent) event headers. This causes
      __perf_session__process_events to unmap the file and retry with the exact same
      parameters, getting stuck in an infinite loop.
      
      This has been observed to result in an exit-time hang when counting
      rare/unschedulable events with perf record, and can be triggered artificially
      with the script below:
      
        ----
        #!/bin/sh
        printf "REPRO: launching perf\n";
        ./perf record -e software/config=9/ sleep 1 &
        PERF_PID=$!;
        sleep 0.002;
        kill -2 $PERF_PID;
        printf "REPRO: waiting for perf (%d) to exit...\n" "$PERF_PID";
        wait $PERF_PID;
        printf "REPRO: perf exited\n";
        ----
      
      To avoid this, have __perf_session__process_events bail out early when
      the file has no data (i.e. it has no events).
      
      Commiter note:
      
      I only managed to reproduce this when setting
      /proc/sys/kernel/kptr_restrict to '1' and changing the code to
      purposefully not process any samples and no synthesized samples, i.e.
      kptr_restrict prevents 'record' from synthesizing the kernel mmaps for
      vmlinux + modules and since it is a workload started from perf, we don't
      synthesize mmap/comm records for existing threads.
      
      Adrian Hunter managed to reproduce it in his environment tho.
      
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@kernel.org>
      Tested-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1442423929-12253-1-git-send-email-mark.rutland@arm.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      381c02f6
  6. Sep 17, 2015
    • Peter Senna Tschudin's avatar
      perf tools: Bool functions shouldn't return -1 · bf644563
      Peter Senna Tschudin authored
      
      Returning a negative value for a boolean function seem to have the
      undesired effect of returning true. Replace -1 by false in a
      bool-returning function.
      
      The diff of the .s file before and after the change (for x86_64):
      
        3907c3907
        < 	movl	$1, %ebx
        ---
        > 	xorl	%ebx, %ebx
      
      while if -1 is replaced by true, the diff is empty.
      
      This issue was found by the following Coccinelle semantic patch:
      
        <smpl>
        @@
        identifier f;
        constant C;
        typedef bool;
        @@
        bool f (...){
        <+...
        * return -C;
        ...+>
        }
        </smpl>
      
      Signed-off-by: default avatarPeter Senna Tschudin <peter.senna@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Matt Fleming <matt.fleming@intel.com>
      Cc: Milos Vyletel <milos@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Link: http://lkml.kernel.org/r/1442484533-19742-1-git-send-email-peter.senna@gmail.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bf644563
    • Arnaldo Carvalho de Melo's avatar
      tools build: Add test for presence of __get_cpuid() gcc builtin · b0063dbf
      Arnaldo Carvalho de Melo authored
      The auxtrace code needed by Intel PT uses the __get_cpuid() gcc builtin,
      that is not present in old systems, breaking the build.
      
      Add a test to check for that builtin and disable AUXTRACE in those
      systems.
      
        [acme@rhel5 linux]$  make NO_LIBPERL=1 -C tools/perf O=/tmp/build/perf install-bin
        make: Entering directory `/home/acme/git/linux/tools/perf'
          BUILD:   Doing 'make -j2' parallel build
      
        Auto-detecting system features:
        <SNIP>
        ...                          lzma: [ on  ]
        ...                     get_cpuid: [ OFF ]
        <SNIP>
        config/Makefile:630: Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc
          MKDIR    /tmp/build/perf/util/
        <SNIP>
      
      This fixes the build on old systems such as RHEL/CentOS 5.11.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Victor Kamensky <victor.kamensky@linaro.org>
      Cc: Vinson Lee <vlee@twopensource.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-d4puslul0jltoodzpx9r4sje@git.kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b0063dbf
    • Arnaldo Carvalho de Melo's avatar
      tools build: Add test for presence of numa_num_possible_cpus() in libnuma · f8ac8606
      Arnaldo Carvalho de Melo authored
      The existing numa test checks only if numa.h and numa_available() are
      present, but that can be satisfied with an old libnuma that is not
      enough for the 'perf bench numa' entry, so add a test to check for that:
      
        [acme@rhel5 linux]$  make NO_AUXTRACE=1 NO_LIBPERL=1 -C tools/perf O=/tmp/build/perf install-bin
        make: Entering directory `/home/acme/git/linux/tools/perf'
          BUILD:   Doing 'make -j2' parallel build
      
        Auto-detecting system features:
        ...                        libelf: [ on  ]
        ...                       libnuma: [ on  ]
        ...        numa_num_possible_cpus: [ OFF ]
        ...                       libperl: [ on  ]
      
        <SNIP>
        config/Makefile:577: Old numa library found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev >= 2.0.8
          INSTALL  binaries
        <SNIP>
      
      This fixes the build on old systems such as RHEL/CentOS 5.11.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Victor Kamensky <victor.kamensky@linaro.org>
      Cc: Vinson Lee <vlee@twopensource.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-zqriqkezppi2de2iyjin1tnc@git.kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f8ac8606
    • Arnaldo Carvalho de Melo's avatar
      Revert "perf symbols: Fix mismatched declarations for elf_getphdrnum" · 179f36dd
      Arnaldo Carvalho de Melo authored
      
      This reverts commit f785f235.
      
      We have a test to check if elf_getphdrnum() is present, so, if it fails,
      we'll get:
      
        [acme@rhel5 linux]$ cat /tmp/build/perf/feature/test-libelf-getphdrnum.make.output
        cc1: warnings being treated as errors
        test-libelf-getphdrnum.c: In function ‘main’:
        test-libelf-getphdrnum.c:7: warning: implicit declaration of function ‘elf_getphdrnum’
        [acme@rhel5 linux]$
      
      And this block will not be compiled:
      
        #ifndef HAVE_ELF_GETPHDRNUM_SUPPORT
        static int elf_getphdrnum(Elf *elf, size_t *dst)
        ...
        #endif
      
      So, if elf_getphdrnum() is being defined somewhere, there is a problem
      with the test that is not detecting that function, go fix it.
      
      Reported-by: default avatarVinson Lee <vlee@twopensource.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Victor Kamensky <victor.kamensky@linaro.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-qn459fal6acvcvm50i8zxx9k@git.kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      179f36dd
    • Heiko Carstens's avatar
  7. Sep 16, 2015
  8. Sep 15, 2015
  9. Sep 14, 2015
Loading