powerpc/perf: Don't enable if we have zero events
authorMichael Ellerman <michael@ellerman.id.au>
Fri, 28 Jun 2013 08:15:14 +0000 (18:15 +1000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 1 Jul 2013 01:50:03 +0000 (11:50 +1000)
In power_pmu_enable() we still enable the PMU even if we have zero
events. This should have no effect but doesn't make much sense. Instead
just return after telling the hypervisor that we are not using the PMCs.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
CC: <stable@vger.kernel.org> [v3.10]
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/perf/core-book3s.c

index 1bb26d586e3c7a3e55d9dcd07cfa6d051e9b7984..c91dc43e04de2d9ae11d0c23b3e5e177a11fc0c0 100644 (file)
@@ -926,6 +926,11 @@ static void power_pmu_enable(struct pmu *pmu)
        if (!cpuhw->disabled)
                goto out;
 
+       if (cpuhw->n_events == 0) {
+               ppc_set_pmu_inuse(0);
+               goto out;
+       }
+
        cpuhw->disabled = 0;
 
        /*
@@ -937,8 +942,6 @@ static void power_pmu_enable(struct pmu *pmu)
        if (!cpuhw->n_added) {
                mtspr(SPRN_MMCRA, cpuhw->mmcr[2] & ~MMCRA_SAMPLE_ENABLE);
                mtspr(SPRN_MMCR1, cpuhw->mmcr[1]);
-               if (cpuhw->n_events == 0)
-                       ppc_set_pmu_inuse(0);
                goto out_enable;
        }
 
This page took 0.028991 seconds and 5 git commands to generate.