perf/powerpc: reset event hw state when adding it to the PMU
authorAlexandru-Cezar Sardan <alexandru.sardan@freescale.com>
Thu, 26 Jun 2014 08:58:58 +0000 (11:58 +0300)
committerScott Wood <scottwood@freescale.com>
Fri, 30 Jan 2015 05:44:18 +0000 (23:44 -0600)
When adding an event to the PMU with PERF_EF_START the STOPPED and UPTODATE
flags need to be cleared in the hw.event status variable because they are
preventing the update of the event count on overflow interrupt.

Signed-off-by: Alexandru-Cezar Sardan <alexandru.sardan@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
arch/powerpc/perf/core-fsl-emb.c

index e9fe904b653804e33ec15a0a71f2510a5431f62e..5d747b4cb8ee1803c93b2b72fa17450e102c7fda 100644 (file)
@@ -330,9 +330,11 @@ static int fsl_emb_pmu_add(struct perf_event *event, int flags)
        }
        local64_set(&event->hw.prev_count, val);
 
-       if (!(flags & PERF_EF_START)) {
+       if (unlikely(!(flags & PERF_EF_START))) {
                event->hw.state = PERF_HES_STOPPED | PERF_HES_UPTODATE;
                val = 0;
+       } else {
+               event->hw.state &= ~(PERF_HES_STOPPED | PERF_HES_UPTODATE);
        }
 
        write_pmc(i, val);