Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FATAL /home/roc/rr/rr/src/PerfCounters.cc:203:start_counter() errno: ENOENT] #1753

Closed
AkeelAli opened this issue Jul 11, 2016 · 10 comments
Closed

Comments

@AkeelAli
Copy link

Getting this core dump on Ubuntu in a VM:

$ rr record ./jpegtran -transverse -outfile testout.jpg testimg.jpg 
rr: Saving execution to trace directory `/home/cs6340/.local/share/rr/jpegtran-7'.
[FATAL /home/roc/rr/rr/src/PerfCounters.cc:203:start_counter() errno: ENOENT] Unable to open performance counter with 'perf_event_open'; are perf events enabled? Try 'perf record'.
Aborted (core dumped)

$ rr replay

rr: error: Version file for recorded trace `/home/cs6340/.local/share/rr/latest-trace/version' not found.  Did you record
           `/home/cs6340/.local/share/rr/latest-trace/version' with an older version of rr?  If so, you'll need to replay
           `/home/cs6340/.local/share/rr/latest-trace/version' with that older version.  Otherwise, your trace is
           likely corrupted.

$ perf --version
perf version 4.2.8-ckt3

$ uname -a
Linux cs6340ProjectVM 4.2.0-30-generic #35-Ubuntu SMP Fri Feb 19 13:52:26 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

@rocallahan
Copy link
Collaborator

are perf events enabled? Try 'perf record'

Did you try perf record? How about perf list?

@AkeelAli
Copy link
Author

$ perf record

 usage: perf record [<options>] [<command>]
    or: perf record [<options>] -- <command> [<options>]

    -e, --event <event>   event selector. use 'perf list' to list available events
        --filter <filter>
                          event filter
    -p, --pid <pid>       record events on existing process id
    -t, --tid <tid>       record events on existing thread id
    -r, --realtime <n>    collect data with this RT SCHED_FIFO priority
        --no-buffering    collect data without buffering
    -R, --raw-samples     collect raw sample records from all opened counters
    -a, --all-cpus        system-wide collection from all CPUs
    -C, --cpu <cpu>       list of cpus to monitor
    -c, --count <n>       event period to sample
    -o, --output <file>   output file name
    -i, --no-inherit      child tasks do not inherit counters
    -F, --freq <n>        profile at this frequency
    -m, --mmap-pages <pages[,pages]>
                          number of mmap data pages and AUX area tracing mmap pages
        --group           put the counters into a counter group
    -g                    enables call-graph recording
        --call-graph <mode[,dump_size]>
                          setup and enables call-graph (stack chain/backtrace) recording: fp dwarf lbr
    -v, --verbose         be more verbose (show counter open errors, etc)
    -q, --quiet           don't print any message
    -s, --stat            per thread counts
    -d, --data            Record the sample addresses
    -T, --timestamp       Record the sample timestamps
    -P, --period          Record the sample period
    -n, --no-samples      don't sample
    -N, --no-buildid-cache
                          do not update the buildid cache
    -B, --no-buildid      do not collect buildids in perf.data
    -G, --cgroup <name>   monitor event in cgroup name only
    -D, --delay <n>       ms to wait before starting measurement after program start
    -u, --uid <user>      user to profile
    -b, --branch-any      sample any taken branches
    -j, --branch-filter <branch filter mask>
                          branch stack filter modes
    -W, --weight          sample by weight (on special events only)
        --transaction     sample transaction flags (special events only)
        --per-thread      use per-thread mmaps
    -I, --intr-regs       Sample machine registers on interrupt
        --running-time    Record running/enabled time of read (:S) events
    -k, --clockid <clockid>
                          clockid to use for events, see clock_gettime()
    -S, --snapshot[=<opts>]
                          AUX area tracing Snapshot Mode
        --proc-map-timeout <n>
                          per thread proc mmap processing timeout in ms


$ perf list

List of pre-defined events (to be used in -e):

  alignment-faults                                   [Software event]
  context-switches OR cs                             [Software event]
  cpu-clock                                          [Software event]
  cpu-migrations OR migrations                       [Software event]
  dummy                                              [Software event]
  emulation-faults                                   [Software event]
  major-faults                                       [Software event]
  minor-faults                                       [Software event]
  page-faults OR faults                              [Software event]
  task-clock                                         [Software event]

  rNNN                                               [Raw hardware event descriptor]
  cpu/t1=v1[,t2=v2,t3 ...]/modifier                  [Raw hardware event descriptor]
   (see 'man perf-list' on how to encode it)

  mem:<addr>[/len][:access]                          [Hardware breakpoint]

@rocallahan
Copy link
Collaborator

It looks like, as the error messages suggest, hardware performance counters are not enabled on your system. Try dmesg|grep PMU?

@AkeelAli
Copy link
Author

You're right. I should mention this is a virtualbox Ubuntu VM.

$ dmesg | grep PMU
[    4.132417] Performance Events: unsupported p6 CPU model 70 no PMU driver, software events only.

@rocallahan
Copy link
Collaborator

Ah. As noted here, VirtualBox doesn't support PMU virtualization currently and therefore can't run rr. Sorry!

@Srinivasuluch
Copy link

I am seeing same issue on my setup too... Any idea

root@<>:~/Desktop/tmp# dmesg | grep PMU
[ 0.335342] Performance Events: Fam15h core perfctr, AMD PMU driver.
[ 0.336794] NMI watchdog: enabled on all CPUs, permanently consumes one hw-PMU counter.

@Srinivasuluch
Copy link

root@<>:~/Desktop/tmp# rr record /usr/bin/clinfo
rr: Saving execution to trace directory `/root/.local/share/rr/clinfo-1'.
[FATAL /home/roc/rr/rr/src/PerfCounters.cc:162:get_cpu_microarch() errno: ENOTTY] CPU 0x30f00 unknown.
Aborted (core dumped)

@khuey
Copy link
Collaborator

khuey commented Jun 28, 2017

rr does not work on any AMD microarchitecture. See #2034.

@mikepurvis
Copy link

I'm also having no joy, under VMWare:

$ dmesg | grep PMU
[    0.020526] Performance Events: Haswell events, core PMU driver.
[    0.029365] core: PMU erratum BJ122, BV98, HSD29 workaround disabled, HT off

Hi-Angel added a commit to Hi-Angel/rr that referenced this issue Feb 20, 2021
Some machines, mainly VMs, may lack hardware support for cpu-cycles
counter. However, it is no reason not to support them: there may be a
similar software event available: PERF_COUNT_SW_CPU_CLOCK.

The idea is taken from the kernel-provided `perf` utility, function
`evsel__fallback` at evsel.c file.

Fixes: rr-debugger#2815,
       rr-debugger#1753

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
Hi-Angel added a commit to Hi-Angel/rr that referenced this issue Feb 20, 2021
Some machines, mainly VMs, may lack hardware support for cpu-cycles
counter. However, it is no reason not to support them: there may be a
similar software event available: PERF_COUNT_SW_CPU_CLOCK.

The idea is taken from the kernel-provided `perf` utility, function
`evsel__fallback` at evsel.c file.

Fixes: rr-debugger#2815,
       rr-debugger#1753

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
@Hi-Angel
Copy link
Contributor

@mikepurvis the #2816 should fix the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants