perf/Power: PERF_EVENT_IOC_ENABLE does not reenable event
authorsukadev@linux.vnet.ibm.com <sukadev@linux.vnet.ibm.com>
Thu, 24 Jan 2013 13:25:23 +0000 (13:25 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 29 Jan 2013 00:35:07 +0000 (11:35 +1100)
commitf53d168c025f27d64417a56bf129dbb39d2e1189
tree094e0912b1fa861bc7eca5958ded86b437fa9164
parent94c95cfbfe784eca5f4b96955e41bda1318605bc
perf/Power: PERF_EVENT_IOC_ENABLE does not reenable event

perf/Power: PERF_EVENT_IOC_ENABLE does not reenable event

If we disable a perf event because we exceeded the specified ->event_limit,
power_pmu_stop() sets the PERF_HES_STOPPED flag on the event.

If the application then re-enables the event using PERF_EVENT_IOC_ENABLE
ioctl, we don't ever clear this STOPPED flag. Consequently, the user space
is never notified of the event.

Following message has more background and test case.

    http://lists.eecs.utk.edu/pipermail/ptools-perfapi/2012-October/002528.html

Used the following test cases to verify that this patch works on latest PAPI.

$ papi.git/src/ctests/nonthread PAPI_TOT_CYC@5000000

$ papi.git/src/ctests/overflow_single_event

Changelog[v2]:
- [Paul Mackerras] Also clear PERF_HES_UPTODATE flag since we are
  restarting the event; cleanup comments and patch description.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/perf/core-book3s.c