"perf record" causes segmentation fault. root@intel-x86-64:/home# perf record -e cpu-clock ls perf: Segmentation fault Obtained 10 stack frames. /perf() [0x4d618f] /lib64/libc.so.6(+0x37120) [0x7f8f82a64120] /perf() [0x4cbec6] /perf() [0x41b64c] /perf() [0x41cb1a] /perf() [0x47f7bf] /perf() [0x47fac1] /perf() [0x407892] /lib64/libc.so.6(__libc_start_main+0xeb) [0x7f8f82a5108b] /perf() [0x407cca] Segmentation fault (core dumped) root@intel-x86-64:/home# perf record -e task-clock ls perf: Segmentation fault Obtained 10 stack frames. /perf() [0x4d618f] /lib64/libc.so.6(+0x37120) [0x7f2471c03120] /perf() [0x4cbec6] /perf() [0x41b64c] /perf() [0x41cb1a] /perf() [0x47f7bf] /perf() [0x47fac1] /perf() [0x407892] /lib64/libc.so.6(__libc_start_main+0xeb) [0x7f2471bf008b] /perf() [0x407cca] Segmentation fault (core dumped) But there is no problem when using cpu-clock and task-clock together. root@intel-x86-64:/home# perf record -e cpu-clock,task-clock ls perf perf.data perf.data.old [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.007 MB perf.data (16 samples) ] Suspect that it was introduced in commit 0aa802a79469a86ebe143019144cd4df8ae852e4. Without this commit, it works well.
Reproduced, looking into it.
From commit 0aa802a79469a86ebe143019144cd4df8ae852e4, removing the following addition in util/evsel.c resolved the bug: ``` if (perf_evsel__is_clock(evsel)) { /* * The evsel->unit points to static alias->unit * so it's ok to use static string in here. */ static const char *unit = "msec"; evsel->unit = unit; evsel->scale = 1e-6; } ``` Cheers, Adam
This appears to have been fixed for a while - doesn't reproduce with a 5.10 or 5.16 perf command.