rr-debugger / rr

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

Running on MacBook Pro, Windows 10 Bootcamp, WSL 2 #3333

Open vjpr opened 2 years ago

vjpr commented 2 years ago

An issue to track ability to run on Bootcamp on Apple Intel hardware.

Setup

https://ubuntu.com/tutorials/install-ubuntu-on-wsl2-on-windows-10#2-install-wsl

wsl --install -d ubuntu

Install perf

See: https://stackoverflow.com/a/65276025/130910

Test

Open PowerShell in Administrator mode.

wsl

Create a sample program to debug

multiple.c ``` #include #define SIZE 4 void zero(char *a, int size) { while (size>0) a[size--] = 0; } void initialize(char *a, int size) { zero(a, size); } void multiply(char *a, int size, int mult) { int i; for (i=0; i
sudo apt install gcc

gcc multiply.c -o multiply

./multiply
f(0)=0
f(1)=2
f(2)=4
f(3)=6
sudo rr record multiply

Fails to run:

[FATAL /home/roc/rr/rr/src/PerfCounters.cc:217:start_counter()] Unable to open performance counter with 'perf_event_open'; are hardware perf events available? See https://github.com/rr-debugger/rr/wiki/Will-rr-work-on-my-system

Check perf events supported

$ uname -a
Linux VMBP2019-WINBC 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
$ dmesg  | grep -i perf
[    0.062235] Performance Events: unsupported p6 CPU model 158 no PMU driver, software events only.

This seems to indicate that they are not.

Status

See: Support hardware performance counters - WSL2 - https://github.com/microsoft/WSL/issues/4678

Also: State of hardware performance monitoring in WSL2 - https://github.com/microsoft/WSL/issues/8480

No one seems to have got it working so far.

Potential fixes

Update custom Microsoft Linux kernel version for wsl2

5.10 to 5.15 (latest longterm - see https://www.kernel.org/)

Pending issue on wsl repo: https://github.com/microsoft/WSL/issues/8507

Doesn't seem to work

Try Windows 11

NOTE: Not compatible with Apple Intel hardware.

Doesn't seem to work

yuyichao commented 2 years ago

Is this supposed to be different from normal wsl?

khuey commented 2 years ago

WSL2 is an actual VM, not just a Linux/POSIX compatibility layer like WSL1 was.

You'll need WSL2 version 0.50.2 or later. If you're on Windows 10 you'll have to get that from the store IIRC. You also need to configure the VMM to enable hardware performance counters like so https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/manage/performance-monitoring-hardware

vjpr commented 1 year ago

FYI: Hardware counters in WSL2 just landed:

https://github.com/microsoft/WSL/issues/4678#issuecomment-1318579235

GitMensch commented 1 month ago

I think that can be closed, no?