Re: [RFC][PATCH 07/12] perf: Simplify/fix perf_event_enable() event scheduling

From: Peter Zijlstra
Date: Tue Mar 08 2016 - 05:26:38 EST


On Tue, Mar 08, 2016 at 10:04:17AM +0000, James Morse wrote:

> [0]
> https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c

I so hate LTP, you can't compile the test cases in isolate and running
'make' doesn't work.

> [2]
> ----------------------------------------
> x86_64, v4.2
> nanook@trouble-every-day:~$ ./perf_event_open02 -v
> at iteration:0 value:3001278671 time_enabled:378865967 time_running:378865967
> at iteration:1 value:3001294516 time_enabled:379206798 time_running:379206798
> at iteration:2 value:3001304264 time_enabled:379741658 time_running:379741658
> at iteration:3 value:2247456463 time_enabled:381782350 time_running:285882994
> perf_event_open02 0 TINFO : overall task clock: 382444297
> perf_event_open02 0 TINFO : hw sum: 9004576323, task clock sum: 1146042829
> hw counters: 1276985606 1284698955 1291658694 1294253771 1293189575 1285360592
> 1278429130
> task clock counters: 162510606 163544930 164439727 164730880 164600624 163538072
> 162677990
> perf_event_open02 0 TINFO : ratio: 3.00
> perf_event_open02 1 TPASS : test passed
> ----------------------------------------
> x86_64, v4.5-rc5:
> nanook@trouble-every-day:~$ ./perf_event_open02 -v
> at iteration:0 value:3001332678 time_enabled:379409484 time_running:379408991
> perf_event_open02 0 TINFO : overall task clock: 381025905
> perf_event_open02 0 TINFO : hw sum: 9004621962, task clock sum: 1142038427
> hw counters: 2249100352 2254366204 2252915996 2248239410
> task clock counters: 285302769 285853299 285787328 285095031
> perf_event_open02 0 TINFO : ratio: 3.00
> perf_event_open02 1 TFAIL : perf_event_open02.c:333: test failed (ratio
> was greater than )
> ----------------------------------------

Its unfortunate the test doesn't actually tells what it was expecting.
It fails to print 'nhw'.

In any case, please try -rc6, which includes:

a096309bc467 perf: Fix scaling vs. perf_install_in_context()
bd2afa49d194 perf: Fix scaling vs. perf_event_enable()
7fce250915ef perf: Fix scaling vs. perf_event_enable_on_exec()
3cbaa5906967 perf: Fix ctx time tracking by introducing EVENT_TIME

Which might fix this. I gave up after a few minutes trying to make LTP
work.