1. 23 7月, 2014 1 次提交
  2. 11 7月, 2014 3 次提交
    • A
      powerpc/perf: Never program book3s PMCs with values >= 0x80000000 · f5602941
      Anton Blanchard 提交于
      We are seeing a lot of PMU warnings on POWER8:
      
          Can't find PMC that caused IRQ
      
      Looking closer, the active PMC is 0 at this point and we took a PMU
      exception on the transition from negative to 0. Some versions of POWER8
      have an issue where they edge detect and not level detect PMC overflows.
      
      A number of places program the PMC with (0x80000000 - period_left),
      where period_left can be negative. We can either fix all of these or
      just ensure that period_left is always >= 1.
      
      This patch takes the second option.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NAnton Blanchard <anton@samba.org>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      f5602941
    • J
      powerpc/perf: Clear MMCR2 when enabling PMU · b50a6c58
      Joel Stanley 提交于
      On POWER8 when switching to a KVM guest we set bits in MMCR2 to freeze
      the PMU counters. Aside from on boot they are then never reset,
      resulting in stuck perf counters for any user in the guest or host.
      
      We now set MMCR2 to 0 whenever enabling the PMU, which provides a sane
      state for perf to use the PMU counters under either the guest or the
      host.
      
      This was manifesting as a bug with ppc64_cpu --frequency:
      
          $ sudo ppc64_cpu --frequency
          WARNING: couldn't run on cpu 0
          WARNING: couldn't run on cpu 8
            ...
          WARNING: couldn't run on cpu 144
          WARNING: couldn't run on cpu 152
          min:    18446744073.710 GHz (cpu -1)
          max:    0.000 GHz (cpu -1)
          avg:    0.000 GHz
      
      The command uses a perf counter to measure CPU cycles over a fixed
      amount of time, in order to approximate the frequency of the machine.
      The counters were returning zero once a guest was started, regardless of
      weather it was still running or had been shut down.
      
      By dumping the value of MMCR2, it was observed that once a guest is
      running MMCR2 is set to 1s - which stops counters from running:
      
          $ sudo sh -c 'echo p > /proc/sysrq-trigger'
          CPU: 0 PMU registers, ppmu = POWER8 n_counters = 6
          PMC1:  5b635e38 PMC2: 00000000 PMC3: 00000000 PMC4: 00000000
          PMC5:  1bf5a646 PMC6: 5793d378 PMC7: deadbeef PMC8: deadbeef
          MMCR0: 0000000080000000 MMCR1: 000000001e000000 MMCRA: 0000040000000000
          MMCR2: fffffffffffffc00 EBBHR: 0000000000000000
          EBBRR: 0000000000000000 BESCR: 0000000000000000
          SIAR:  00000000000a51cc SDAR:  c00000000fc40000 SIER:  0000000001000000
      
      This is done unconditionally in book3s_hv_interrupts.S upon entering the
      guest, and the original value is only save/restored if the host has
      indicated it was using the PMU. This is okay, however the user of the
      PMU needs to ensure that it is in a defined state when it starts using
      it.
      
      Fixes: e05b9b9e ("powerpc/perf: Power8 PMU support")
      Cc: stable@vger.kernel.org
      Signed-off-by: NJoel Stanley <joel@jms.id.au>
      Acked-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      b50a6c58
    • J
      powerpc/perf: Add PPMU_ARCH_207S define · 4d9690dd
      Joel Stanley 提交于
      Instead of separate bits for every POWER8 PMU feature, have a single one
      for v2.07 of the architecture.
      
      This saves us adding a MMCR2 define for a future patch.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NJoel Stanley <joel@jms.id.au>
      Acked-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      4d9690dd
  3. 28 4月, 2014 6 次提交
  4. 24 3月, 2014 16 次提交
  5. 11 2月, 2014 2 次提交
    • A
      powerpc/perf: Configure BHRB filter before enabling PMU interrupts · b4d6c06c
      Anshuman Khandual 提交于
      Right now the config_bhrb() PMU specific call happens after
      write_mmcr0(), which actually enables the PMU for event counting and
      interrupts. So there is a small window of time where the PMU and BHRB
      runs without the required HW branch filter (if any) enabled in BHRB.
      
      This can cause some of the branch samples to be collected through BHRB
      without any filter applied and hence affects the correctness of
      the results. This patch moves the BHRB config function call before
      enabling interrupts.
      
      Here are some data points captured via trace prints which depicts how we
      could get PMU interrupts with BHRB filter NOT enabled with a standard
      perf record command line (asking for branch record information as well).
      
          $ perf record -j any_call ls
      
      Before the patch:-
      
          ls-1962  [003] d...  2065.299590: .perf_event_interrupt: MMCRA: 40000000000
          ls-1962  [003] d...  2065.299603: .perf_event_interrupt: MMCRA: 40000000000
          ...
      
          All the PMU interrupts before this point did not have the requested
          HW branch filter enabled in the MMCRA.
      
          ls-1962  [003] d...  2065.299647: .perf_event_interrupt: MMCRA: 40040000000
          ls-1962  [003] d...  2065.299662: .perf_event_interrupt: MMCRA: 40040000000
      
      After the patch:-
      
          ls-1850  [008] d...   190.311828: .perf_event_interrupt: MMCRA: 40040000000
          ls-1850  [008] d...   190.311848: .perf_event_interrupt: MMCRA: 40040000000
      
          All the PMU interrupts have the requested HW BHRB branch filter
          enabled in MMCRA.
      Signed-off-by: NAnshuman Khandual <khandual@linux.vnet.ibm.com>
      [mpe: Fixed up whitespace and cleaned up changelog]
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      b4d6c06c
    • M
  6. 03 10月, 2013 1 次提交
  7. 14 8月, 2013 1 次提交
  8. 08 8月, 2013 3 次提交
  9. 01 8月, 2013 1 次提交
  10. 24 7月, 2013 3 次提交
  11. 13 7月, 2013 1 次提交
    • R
      perf tools: Make Power7 events available for perf · cfe0d8ba
      Runzhen Wang 提交于
      Power7 supports over 530 different perf events but only a small subset
      of these can be specified by name, for the remaining events, we must
      specify them by their raw code:
      
              perf stat -e r2003c <application>
      
      This patch makes all the POWER7 events available in sysfs.  So we can
      instead specify these as:
      
              perf stat -e 'cpu/PM_CMPLU_STALL_DFU/' <application>
      
      where PM_CMPLU_STALL_DFU is the r2003c in previous example.
      
      Before this patch is applied, the size of power7-pmu.o is:
      
      $ size arch/powerpc/perf/power7-pmu.o
         text	   data	    bss	    dec	    hex	filename
         3073	   2720	      0	   5793	   16a1	arch/powerpc/perf/power7-pmu.o
      
      and after the patch is applied, it is:
      
      $ size arch/powerpc/perf/power7-pmu.o
         text	   data	    bss	    dec	    hex	filename
        15950	  31112	      0	  47062	   b7d6	arch/powerpc/perf/power7-pmu.o
      
      For the run time overhead, I use two scripts, one is "event_name.sh",
      which contains 50 event names, it looks like:
      
       # ./perf record  -e 'cpu/PM_CMPLU_STALL_DFU/' -e .....  /bin/sleep 1
      
      the other one is named "event_code.sh" which use corresponding  events
      raw
      code instead of events names, it looks like:
      
       # ./perf record -e r2003c -e ......  /bin/sleep 1
      
      below is the result.
      
      Using events name:
      
      [root@localhost perf]# time ./event_name.sh
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.002 MB perf.data (~102 samples) ]
      
      real	0m1.192s
      user	0m0.028s
      sys	0m0.106s
      
      Using events raw code:
      
      [root@localhost perf]# time ./event_code.sh
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.003 MB perf.data (~112 samples) ]
      
      real	0m1.198s
      user	0m0.028s
      sys	0m0.105s
      Signed-off-by: NRunzhen Wang <runzhen@linux.vnet.ibm.com>
      Acked-by: NMichael Ellerman <michael@ellerman.id.au>
      Cc: icycoder@gmail.com
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: Michael Ellerman <michael@ellerman.id.au>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Runzhen Wang <runzhew@clemson.edu>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/1372407297-6996-3-git-send-email-runzhen@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      cfe0d8ba
  12. 09 7月, 2013 1 次提交
  13. 01 7月, 2013 1 次提交