Skip to content

Commit ea142e5

Browse files
npigginmpe
authored andcommitted
powerpc/perf: Fix disabling BHRB and instruction sampling
When the PMU is disabled, MMCRA is not updated to disable BHRB and instruction sampling. This can lead to those features remaining enabled, which can slow down a real or emulated CPU. Fixes: 1cade52 ("powerpc/perf: BHRB control to disable BHRB logic when not used") Cc: stable@vger.kernel.org # v5.9+ Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20231018153423.298373-1-npiggin@gmail.com
1 parent f01b0ed commit ea142e5

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

arch/powerpc/perf/core-book3s.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,8 +1371,7 @@ static void power_pmu_disable(struct pmu *pmu)
13711371
/*
13721372
* Disable instruction sampling if it was enabled
13731373
*/
1374-
if (cpuhw->mmcr.mmcra & MMCRA_SAMPLE_ENABLE)
1375-
val &= ~MMCRA_SAMPLE_ENABLE;
1374+
val &= ~MMCRA_SAMPLE_ENABLE;
13761375

13771376
/* Disable BHRB via mmcra (BHRBRD) for p10 */
13781377
if (ppmu->flags & PPMU_ARCH_31)
@@ -1383,7 +1382,7 @@ static void power_pmu_disable(struct pmu *pmu)
13831382
* instruction sampling or BHRB.
13841383
*/
13851384
if (val != mmcra) {
1386-
mtspr(SPRN_MMCRA, mmcra);
1385+
mtspr(SPRN_MMCRA, val);
13871386
mb();
13881387
isync();
13891388
}

0 commit comments

Comments
 (0)