rr-debugger / rr

Record and Replay Framework
http://rr-project.org/
Other
9.07k stars 577 forks source link

mozilla rr don't work on VMWARE 16.02 ubuntu guest #3510

Closed wjllz closed 1 year ago

wjllz commented 1 year ago

Hey, I want to use mozilla rr on ubuntu . But seems it can't work.

Here is my environment information.

My ubuntu version is 20.04.1:

i8f@ubuntu:~/Desktop/18_floor/source_code/rr_test$ uname -a
Linux ubuntu 5.15.0-71-generic #78~20.04.1-Ubuntu SMP Wed Apr 19 11:26:48 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

And my vmware pro version is |16.2.1 build-18811642|.

My CPU version info is:

12th Gen Intel(R) Core(TM) i7-12700K   3.61 GHz

I followed your build tutorial.

The only thing which I canged is that:

PS C:\Users\18f> wmic path Win32_Processor get ProcessorId
ProcessorId
BFEBFBFF00090672

I found my cpuid number is |0x0090672|, but seems the source code don't include it. so I add it...

    case 0x90670:
    case 0x90672:   // [+] The code add by myself.
    case 0x906a0:
      return IntelAlderlake;

Then I build it, compile it. install it.

And follow your turtoial, virtual-machine-guests part, I set the related optionis in vmware:

image

And I Add this line to .vmx file:

vpmc.enable = "TRUE"
monitor_control.disable_hvsim_clusters = "TRUE"
floppy0.present = "FALSE"

note |monitor_control.disable_hvsim_clusters = "TRUE"| is the line which I added.

But It still can't work:

i8f@ubuntu:~/Desktop/18_floor/source_code/rr_test$ rr ./poc
rr: Saving execution to trace directory `/home/i8f/.local/share/rr/poc-1'.
[FATAL src/PerfCounters.cc:380:check_working_counters() errno: EDOM] 
Got 0 branch events, expected at least 500.

The hardware performance counter seems to not be working. Check
that hardware performance counters are working by running
  perf stat -e r5111c4 true
and checking that it reports a nonzero number of events.
If performance counters seem to be working with 'perf', file an
rr issue, otherwise check your hardware/OS/VM configuration. Also
check that other software is not using performance counters on
this CPU.
=== Start rr backtrace:
rr(_ZN2rr13dump_rr_stackEv+0x5a)[0x55eb51b28b5a]
rr(_ZN2rr15notifying_abortEv+0x14)[0x55eb51b2d4e4]
rr(+0x4ed04)[0x55eb51b15d04]
rr(_ZN2rr12PerfCounters5resetEl+0xcaf)[0x55eb51c242af]
rr(_ZN2rr4Task16resume_executionENS_13ResumeRequestENS_11WaitRequestENS_12TicksRequestEi+0x842)[0x55eb51b5d2a2]
rr(_ZN2rr13RecordSession13task_continueERKNS0_9StepStateE+0x40e)[0x55eb51c14f9e]
rr(_ZN2rr13RecordSession11record_stepEv+0x31b)[0x55eb51c11dcb]
rr(_ZN2rr13RecordCommand3runERSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS7_EE+0xe2a)[0x55eb51c162fa]
rr(main+0x199)[0x55eb51b116c9]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7f6453dc4083]
rr(_start+0x2e)[0x55eb51b1197e]
=== End rr backtrace
Aborted (core dumped)

Then I use this command:

i8f@ubuntu:~/Desktop/18_floor/source_code/rr_test$  perf stat -e r5111c4 true
WARNING: event 'N/A' not valid (bits 16,20,22 of config '5111c4' not supported by kernel)!

 Performance counter stats for 'true':

                 0      cpu_core/r5111c4/                                           

       0.002271401 seconds time elapsed

       0.001467000 seconds user
       0.000000000 seconds sys

i8f@ubuntu:~/Desktop/18_floor/source_code/rr_test$ sudo perf stat -e r5111c4 true
WARNING: event 'N/A' not valid (bits 16,20,22 of config '5111c4' not supported by kernel)!

 Performance counter stats for 'true':

                 0      cpu_core/r5111c4/                                           

       0.000397969 seconds time elapsed

       0.000475000 seconds user
       0.000000000 seconds sys

i8f@ubuntu:~/Desktop/18_floor/source_code/rr_test$ 

seems the hardware performance counter still can't work. would u mind help me about this? THX!

:)

wjllz commented 1 year ago

help help help me 😭😭😭

khuey commented 1 year ago

Did you do the

Enable the code profiling applications in the Processors & Memory tab.

step?

wjllz commented 1 year ago

Did you do the

Enable the code profiling applications in the Processors & Memory tab.

step?

I don't think so, I just enable "Set the Preferred virtualization engine in the Advanced tab to Intel VT-x with EPT (it may default to Automatic)". But I don't find " Processors & Memory tab.", where I could find it? thx!

image

wjllz commented 1 year ago

if I don't misunderstand anything.

Configure additional virtualization settings.
On Windows, you can select Virtualize Intel VT-x/EPT or AMD-V/RVI.
On macOS, expand Advanced options. You can then select one or more of the following options:

Enable hypervisor applications in this virtual machine
Enable code profiling applications in this virtual machine
Enable IOMMU in this virtual machine

from vm document. select VT-x/EPT same as Enable code profilling applications. one for Windows, the other one for Macos?

wjllz commented 1 year ago

@rocallahan Hey, Would u mind tell me did I miss anything? Thanks!πŸ˜Άβ€πŸŒ«οΈ

khuey commented 1 year ago

I don't read Chinese but I think it's the second checkbox (right under the VT-x/EPT one).

I assume you've done the obvious things like restart the VM?

What's the output of dmesg|grep PMU in the guest?

wjllz commented 1 year ago

I don't read Chinese but I think it's the second checkbox (right under the VT-x/EPT one).

I assume you've done the obvious things like restart the VM?

What's the output of dmesg|grep PMU in the guest?

Hey, I choose these two options:

image

And this is its output.

i8f@ubuntu:~/Desktop/18_floor/source_code/rr_test$ dmesg|grep PMU
[    0.515352] Performance Events:  AnyThread deprecated, Alderlake Hybrid events, Intel PMU driver.
[    0.515352] core: cpu_core PMU driver: 
[    0.515352] NMI watchdog: Enabled. Permanently consumes one hw-PMU counter.
[    6.169566] RAPL PMU: API unit is 2^-32 Joules, 0 fixed counters, 10737418240 ms ovfl timer
rocallahan commented 1 year ago

What do you get if you run perf stat /bin/ls and perf list in the VM? The output of the latter will be long so you should probably attach it.

wjllz commented 1 year ago

What do you get if you run perf stat /bin/ls and perf list in the VM? The output of the latter will be long so you should probably attach it.

hey, this is my output:

i8f@ubuntu:~/Desktop/18_floor/source_code/rr_test$ perf stat /bin/ls
poc  poc.c

 Performance counter stats for '/bin/ls':

              0.94 msec task-clock                #    0.098 CPUs utilized          
                 0      context-switches          #    0.000 /sec                   
                 0      cpu-migrations            #    0.000 /sec                   
                97      page-faults               #  103.192 K/sec                  
                 0      cpu_core/cycles/          #    0.000 /sec                   
                 0      cpu_core/instructions/    #    0.000 /sec                   
                 0      cpu_core/branches/        #    0.000 /sec                   
                 0      cpu_core/branch-misses/   #    0.000 /sec                   

       0.009603849 seconds time elapsed

       0.000000000 seconds user
       0.013217000 seconds sys

i8f@ubuntu:~/Desktop/18_floor/source_code/rr_test$ perf list

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

  branch-instructions OR branches                    [Hardware event]
  branch-misses                                      [Hardware event]
  bus-cycles                                         [Hardware event]
  cache-misses                                       [Hardware event]
  cache-references                                   [Hardware event]
  cpu-cycles OR cycles                               [Hardware event]
  instructions                                       [Hardware event]
  ref-cycles                                         [Hardware event]

  alignment-faults                                   [Software event]
  bpf-output                                         [Software event]
  cgroup-switches                                    [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]

  duration_time                                      [Tool event]

  L1-dcache-load-misses                              [Hardware cache event]
  L1-dcache-loads                                    [Hardware cache event]
  L1-dcache-stores                                   [Hardware cache event]
  L1-icache-load-misses                              [Hardware cache event]
  branch-load-misses                                 [Hardware cache event]
  branch-loads                                       [Hardware cache event]
  dTLB-load-misses                                   [Hardware cache event]
  dTLB-loads                                         [Hardware cache event]
  dTLB-store-misses                                  [Hardware cache event]
  dTLB-stores                                        [Hardware cache event]
  iTLB-load-misses                                   [Hardware cache event]

  branch-instructions OR cpu_core/branch-instructions/ [Kernel PMU event]
  branch-misses OR cpu_core/branch-misses/           [Kernel PMU event]
  bus-cycles OR cpu_core/bus-cycles/                 [Kernel PMU event]
  cache-misses OR cpu_core/cache-misses/             [Kernel PMU event]
  cache-references OR cpu_core/cache-references/     [Kernel PMU event]
  cpu-cycles OR cpu_core/cpu-cycles/                 [Kernel PMU event]
  instructions OR cpu_core/instructions/             [Kernel PMU event]
  mem-loads OR cpu_core/mem-loads/                   [Kernel PMU event]
  mem-loads-aux OR cpu_core/mem-loads-aux/           [Kernel PMU event]
  mem-stores OR cpu_core/mem-stores/                 [Kernel PMU event]
  ref-cycles OR cpu_core/ref-cycles/                 [Kernel PMU event]
  slots OR cpu_core/slots/                           [Kernel PMU event]
  topdown-bad-spec OR cpu_core/topdown-bad-spec/     [Kernel PMU event]
  topdown-be-bound OR cpu_core/topdown-be-bound/     [Kernel PMU event]
  topdown-br-mispredict OR cpu_core/topdown-br-mispredict/ [Kernel PMU event]
  topdown-fe-bound OR cpu_core/topdown-fe-bound/     [Kernel PMU event]
  topdown-fetch-lat OR cpu_core/topdown-fetch-lat/   [Kernel PMU event]
  topdown-heavy-ops OR cpu_core/topdown-heavy-ops/   [Kernel PMU event]
  topdown-mem-bound OR cpu_core/topdown-mem-bound/   [Kernel PMU event]
  topdown-retiring OR cpu_core/topdown-retiring/     [Kernel PMU event]
  msr/pperf/                                         [Kernel PMU event]
  msr/smi/                                           [Kernel PMU event]
  msr/tsc/                                           [Kernel PMU 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]

Metric Groups:

i8f@ubuntu:~/Desktop/18_floor/source_code/rr_test$ 
rocallahan commented 1 year ago

OK, the PMU is definitely not working in the VM guest. I don't think we can really help you; maybe you can take this up with VMWare support? The perf stat results are all you need.

wjllz commented 1 year ago

OK, the PMU is definitely not working in the VM guest. I don't think we can really help you; maybe you can take this up with VMWare support? The perf stat results are all you need.

unfortunately heared this, but thank u . I will close the issue.