]> git.baikalelectronics.ru Git - kernel.git/commit
perf_event: Fix broken calc_timer_values()
authorEric B Munson <emunson@mgebm.net>
Thu, 23 Jun 2011 20:34:38 +0000 (16:34 -0400)
committerIngo Molnar <mingo@elte.hu>
Wed, 31 Aug 2011 13:56:29 +0000 (15:56 +0200)
commit54d44da0ba94961b505de7c9a893c7c676fdb2ee
tree7e61573e73b80d65d29b259c7d1a228038a4439e
parente964ae8b88f422b9c5100a47b8d1d22a0098ccbe
perf_event: Fix broken calc_timer_values()

We detected a serious issue with PERF_SAMPLE_READ and
timing information when events were being multiplexing.

Samples would have time_running > time_enabled. That
was easy to reproduce with a libpfm4 example (ran 3
times to cause multiplexing on Core 2):

 $ syst_smpl -e uops_retired:freq=1 &
 $ syst_smpl -e uops_retired:freq=1 &
 $ syst_smpl -e uops_retired:freq=1 &
 IIP:0x0000000040062d ... PERIOD:2355332948 ENA=40144625315 RUN=60014875184
 syst_smpl: WARNING: time_running > time_enabled
63277537998 uops_retired:freq=1 , scaled

The bug was not present in kernel up to (and including) 3.0. It turns
out the bug was introduced by the following commit:

commit c12816f28d10760116faaba589aafe806b8e76f1

    events: Move lockless timer calculation into helper function

The parameters of the function got reversed yet the call sites
were not updated to reflect the change. That lead to time_running
and time_enabled being swapped. That had no effect when there was
no multiplexing because in that case time_running = time_enabled
but it would show up in any other scenario.

Signed-off-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20110829124112.GA4828@quad
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/events/core.c