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: [email protected] # v5.9+ Signed-off-by: Nicholas Piggin <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://msgid.link/[email protected]
1 parent f01b0ed commit ea142e5

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

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)