OpenCloudOS-Kernel/arch/powerpc/perf
Anshuman Khandual b4d6c06c8d powerpc/perf: Configure BHRB filter before enabling PMU interrupts
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: Anshuman Khandual <khandual@linux.vnet.ibm.com>
[mpe: Fixed up whitespace and cleaned up changelog]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-02-11 11:24:50 +11:00
..
Makefile powerpc/perf: Add e6500 PMU driver 2013-08-07 18:38:04 -05:00
bhrb.S powerpc/perf: Add basic assembly code to read BHRB entries on POWER8 2013-04-26 16:11:11 +10:00
callchain.c powerpc/perf: Use perf_instruction_pointer in callchains 2012-07-10 19:18:46 +10:00
core-book3s.c powerpc/perf: Configure BHRB filter before enabling PMU interrupts 2014-02-11 11:24:50 +11:00
core-fsl-emb.c powerpc/perf: add 2 additional performance monitor counters for e6500 core 2013-08-07 18:38:03 -05:00
e500-pmu.c powerpc/perf: Add stalled-cycles events 2013-01-10 17:00:56 +11:00
e6500-pmu.c powerpc/perf: Add e6500 PMU driver 2013-08-07 18:38:04 -05:00
mpc7450-pmu.c
power4-pmu.c powerpc/perf: Fix instruction address sampling on 970 and Power4 2012-03-28 11:33:24 +11:00
power5+-pmu.c powerpc/perf: Add an explict flag indicating presence of SLOT field 2013-04-26 16:11:07 +10:00
power5-pmu.c powerpc/perf: Add an explict flag indicating presence of SLOT field 2013-04-26 16:11:07 +10:00
power6-pmu.c
power7-events-list.h perf tools: Make Power7 events available for perf 2013-07-12 13:46:09 -03:00
power7-pmu.c perf tools: Make Power7 events available for perf 2013-07-12 13:46:09 -03:00
power8-pmu.c powerpc/perf: Add Power8 cache & TLB events 2014-02-11 11:24:48 +11:00
ppc970-pmu.c powerpc/perf: Fix instruction address sampling on 970 and Power4 2012-03-28 11:33:24 +11:00