linux-test-project / ltp

Linux Test Project (mailing list: https://lists.linux.it/listinfo/ltp)
https://linux-test-project.readthedocs.io/
GNU General Public License v2.0
2.28k stars 998 forks source link

perf_event_open01.c:158: perf_event_open PERF_COUNT_HW_INSTRUCTIONS failed unexpectedly #683

Open ywangwrs opened 4 years ago

ywangwrs commented 4 years ago

When running perf_event_open01 test on Xilinx ZYNQ ZC702/706 board, it fails with the following error:

<<>> tag=perf_event_open01 stime=1571849199 cmdline="perf_event_open01" contacts="" analysis=exit <<>> perf_event_open01 1 TFAIL : perf_event_open01.c:158: perf_event_open PERF_COUNT_HW_INSTRUCTIONS failed unexpectedly: TEST_ERRNO=EINVAL(22): Invalid argument <<>> initiation_status="ok" duration=0 termination_type=exited termination_id=1 corefile=no cutime=1 cstime=0 <<>>

The issue is this type of boards don't support Kernel PMU event, this can be verified through the following command:

root@xilinx-zynq:/mnt# perf stat -e cycles:u,instructions:u /bin/echo 123
123 Performance counter stats for '/bin/echo 123':

cycles:u instructions:u 0.008575491 seconds time elapsed 0.000000000 seconds user 0.008434000 seconds sys root@xilinx-zynq:/mnt# perf list |grep pmu root@xilinx-zynq:/mnt#

So I think this line of the test code: https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/syscalls/perf_event_open/perf_event_open01.c#L152 should include the situation of TEST_ERRNO=EINVAL(22).

jstancek commented 4 years ago

What kernel version is this? When I run it in unsupported environment I'm getting ENOENT.

       ENODEV Returned when the event involves a feature not supported by the current CPU.
       ENOENT Returned if the type setting is not valid.  This error is also returned for some unsupported generic events.
ywangwrs commented 4 years ago

uname: Linux xilinx-zynq 5.4.42-yocto-standard #1 SMP PREEMPT Tue May 26 03:49:55 PDT 2020 armv7l armv7l armv7l GNU/Linux

Attached is the full log.

perf_event_open01.log

ywangwrs commented 3 years ago

Any update on this ticket?