diff options
author | sukadev@linux.vnet.ibm.com <sukadev@linux.vnet.ibm.com> | 2013-01-24 08:25:23 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-01-28 19:35:07 -0500 |
commit | f53d168c025f27d64417a56bf129dbb39d2e1189 (patch) | |
tree | 094e0912b1fa861bc7eca5958ded86b437fa9164 /arch | |
parent | 94c95cfbfe784eca5f4b96955e41bda1318605bc (diff) |
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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/perf/core-book3s.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c index 89bd59365c07..069f92b31992 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c | |||
@@ -880,8 +880,16 @@ static int power_pmu_add(struct perf_event *event, int ef_flags) | |||
880 | cpuhw->events[n0] = event->hw.config; | 880 | cpuhw->events[n0] = event->hw.config; |
881 | cpuhw->flags[n0] = event->hw.event_base; | 881 | cpuhw->flags[n0] = event->hw.event_base; |
882 | 882 | ||
883 | /* | ||
884 | * This event may have been disabled/stopped in record_and_restart() | ||
885 | * because we exceeded the ->event_limit. If re-starting the event, | ||
886 | * clear the ->hw.state (STOPPED and UPTODATE flags), so the user | ||
887 | * notification is re-enabled. | ||
888 | */ | ||
883 | if (!(ef_flags & PERF_EF_START)) | 889 | if (!(ef_flags & PERF_EF_START)) |
884 | event->hw.state = PERF_HES_STOPPED | PERF_HES_UPTODATE; | 890 | event->hw.state = PERF_HES_STOPPED | PERF_HES_UPTODATE; |
891 | else | ||
892 | event->hw.state = 0; | ||
885 | 893 | ||
886 | /* | 894 | /* |
887 | * If group events scheduling transaction was started, | 895 | * If group events scheduling transaction was started, |