aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/perf/core-book3s.c
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2014-07-23 07:12:36 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-07-28 00:11:34 -0400
commit79a4cb28a07c4e24103d00741a3dc2618532efe6 (patch)
tree388b27000174cadcbead484da5c5f8a4398f0d46 /arch/powerpc/perf/core-book3s.c
parentf929a4641b93c0a45f188022bb9675214b3070d6 (diff)
powerpc/perf: Clear all MMCR settings before calling compute_mmcr()
Because we reuse cpuhw->mmcr on each call to compute_mmcr() there's a risk that we could forget to set one of the values and use whatever value was in there previously. Currently all the implementations are careful to set all the values, but it's safer to clear them all before we call compute_mmcr(). Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/perf/core-book3s.c')
-rw-r--r--arch/powerpc/perf/core-book3s.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index fe52db2eea6a..f82c0973866f 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -1219,8 +1219,10 @@ static void power_pmu_enable(struct pmu *pmu)
1219 } 1219 }
1220 1220
1221 /* 1221 /*
1222 * Compute MMCR* values for the new set of events 1222 * Clear all MMCR settings and recompute them for the new set of events.
1223 */ 1223 */
1224 memset(cpuhw->mmcr, 0, sizeof(cpuhw->mmcr));
1225
1224 if (ppmu->compute_mmcr(cpuhw->events, cpuhw->n_events, hwc_index, 1226 if (ppmu->compute_mmcr(cpuhw->events, cpuhw->n_events, hwc_index,
1225 cpuhw->mmcr)) { 1227 cpuhw->mmcr)) {
1226 /* shouldn't ever get here */ 1228 /* shouldn't ever get here */