Commit 79a4cb28 authored by Michael Ellerman's avatar Michael Ellerman Committed by Benjamin Herrenschmidt

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: default avatarMichael Ellerman <mpe@ellerman.id.au>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent f929a464
...@@ -1219,8 +1219,10 @@ static void power_pmu_enable(struct pmu *pmu) ...@@ -1219,8 +1219,10 @@ static void power_pmu_enable(struct pmu *pmu)
} }
/* /*
* Compute MMCR* values for the new set of events * Clear all MMCR settings and recompute them for the new set of events.
*/ */
memset(cpuhw->mmcr, 0, sizeof(cpuhw->mmcr));
if (ppmu->compute_mmcr(cpuhw->events, cpuhw->n_events, hwc_index, if (ppmu->compute_mmcr(cpuhw->events, cpuhw->n_events, hwc_index,
cpuhw->mmcr)) { cpuhw->mmcr)) {
/* shouldn't ever get here */ /* shouldn't ever get here */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment