Support Technican, System Engineer, System Architect, Consultant, Mentor and so much more for: Microsoft (nearly everything), Linux (Ubuntu, CentOS), ITIL (V3), Prince²
Still working on more skills.
Support Technican, System Engineer, System Architect, Consultant, Mentor and so much more for: Microsoft (nearly everything), Linux (Ubuntu, CentOS), ITIL (V3), Prince²
Still working on more skills.
Ok, next step/s tweaks. Reached up to maybe 30% speedup of the machine:
Compiled the actual Kernel for KVM (not Module but including both systems Intel and AMD).
set up dbus on debian from: DamionGans on Github. After setting up the dbus you need to Terminate the WSL2 distro with:
wsl.exe -t distroname on CDM or PowerShell. In my case Ubuntu as distroname.
after next start the dbus incl systemctl will become available.
I ended up bailing on macOS-Simple-KVM (I could just never get past the first reboot). I tried everything -- new kernels, various options, nothing worked.
I found another, more complicated approach using OpenCore instead of Clover that ended up working out. Piling on extra RAM helped greatly with performance, as did using as many AMD processor flags as I could for KVM options. I'm pretty happy with where it ended up (using Catalina) but might try Mojave just to compare performance.
Thanks for this guide, Nicole! This post led me down a rabbit hole but it was a good one.
Certified Azure Solution Architect & DevOps expert with 20 years in software. Microsoft Press Author. CloudSkills Community Author. Also a bit of a data nerd.
Certified Azure Solution Architect & DevOps expert with 20 years in software. Microsoft Press Author. CloudSkills Community Author. Also a bit of a data nerd.
Support Technican, System Engineer, System Architect, Consultant, Mentor and so much more for: Microsoft (nearly everything), Linux (Ubuntu, CentOS), ITIL (V3), Prince²
Still working on more skills.
Support Technican, System Engineer, System Architect, Consultant, Mentor and so much more for: Microsoft (nearly everything), Linux (Ubuntu, CentOS), ITIL (V3), Prince²
Still working on more skills.
I used the 2 networking lines from macOS-Simple-KVM rather than the method he listed, which did not work in WSL2. I've added a few more processor flags to my launch shell script (and changed the name for ease of typing) :
.wslconf borrowed and modified from yours (I'm pretty sure some of those AMD settings are non-functional) --note that the number of processors is inherited from the host and does not need listing here. When building my own kernel I had to use the 104 one -- the available 128 option failed to mount my C drive after building. I probably didn't need to go that route at all, since the current Insider dev build (20211.1005) has nested KVM support out of the box.
Launch script from this tutorial with my additions to the flags (I think svm is critical for AMD) and adjustments to RAM/Proc
############################################################################
# NOTE: Tweak the "MY_OPTIONS" line in case you are having booting problems!
############################################################################
MY_OPTIONS="+svm,+hypervisor,+msr,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+avx2,+aes,+xsave,+xsaveopt,check"
# This script works for Big Sur, Catalina, Mojave, and High Sierra. Tested with
# macOS 10.15.6, macOS 10.14.6, and macOS 10.13.6
ALLOCATED_RAM="17166" # MiB
CPU_SOCKETS="1"
CPU_CORES="4"
CPU_THREADS="8"
REPO_PATH="./"
OVMF_DIR="."
It's possible (likely?) that I could trace my original installation-reboot issue by comparing the launch file with the one from macOS-simple-kvm.
That list of processor flags provide a big performance gain, but I'm not done yet. My next step is to place all of the AMD processor flags into the options line and then systematically remove the ones that cause errors -- this is similar to the process used for the huge long list of Intel flags at the bottom of the Accelerated KVM Guests post, and my performance with the graphical Ubuntu shell he walks through the installation of at the bottom is fantastic. Granted that's has a much lighter overhead then macOS.
Support Technican, System Engineer, System Architect, Consultant, Mentor and so much more for: Microsoft (nearly everything), Linux (Ubuntu, CentOS), ITIL (V3), Prince²
Still working on more skills.
@ciparis
i'm sure there is also a huge difference with the vCPU which he uses for QEMU.
I also use the switch -deamonize to free the WSL console for htop and other monitoring.
I just tried Mojave and it ran much slower than Catalina (the opposite of what I expected). For whatever reason, Catalina is faster on my Ryzen setup. Still laggy, but usable.
Support Technican, System Engineer, System Architect, Consultant, Mentor and so much more for: Microsoft (nearly everything), Linux (Ubuntu, CentOS), ITIL (V3), Prince²
Still working on more skills.
just installed over night the insider 20211.1000 now it's a bit faster but still slow:
my ubuntu Ubuntu 20.04.1 LTS linux kernel:
Ok, next step/s tweaks. Reached up to maybe 30% speedup of the machine:
Mine is FINALLY working!
I ended up bailing on macOS-Simple-KVM (I could just never get past the first reboot). I tried everything -- new kernels, various options, nothing worked.
I found another, more complicated approach using OpenCore instead of Clover that ended up working out. Piling on extra RAM helped greatly with performance, as did using as many AMD processor flags as I could for KVM options. I'm pretty happy with where it ended up (using Catalina) but might try Mojave just to compare performance.
Thanks for this guide, Nicole! This post led me down a rabbit hole but it was a good one.
Great news! Many thanks for the update. That's interesting, am still trying to get my hands on an AMD machine to have a go at this.
@pkostelnik yeah dbus is a great shout, same IPC etc, did you check the performance gain after the full kernel compile or with both together?
@nicole Not really because there is only a slightly speedup between this changes maybe 10-15%
@ciparis would you mind to share your configuration please.
Here's the guide I followed:
github.com/kholia/OSX-KVM
I used the 2 networking lines from macOS-Simple-KVM rather than the method he listed, which did not work in WSL2. I've added a few more processor flags to my launch shell script (and changed the name for ease of typing) :
.wslconf borrowed and modified from yours (I'm pretty sure some of those AMD settings are non-functional) --note that the number of processors is inherited from the host and does not need listing here. When building my own kernel I had to use the 104 one -- the available 128 option failed to mount my C drive after building. I probably didn't need to go that route at all, since the current Insider dev build (20211.1005) has nested KVM support out of the box.
Launch script from this tutorial with my additions to the flags (I think svm is critical for AMD) and adjustments to RAM/Proc
It's possible (likely?) that I could trace my original installation-reboot issue by comparing the launch file with the one from macOS-simple-kvm.
That list of processor flags provide a big performance gain, but I'm not done yet. My next step is to place all of the AMD processor flags into the options line and then systematically remove the ones that cause errors -- this is similar to the process used for the huge long list of Intel flags at the bottom of the Accelerated KVM Guests post, and my performance with the graphical Ubuntu shell he walks through the installation of at the bottom is fantastic. Granted that's has a much lighter overhead then macOS.
@ciparis i'm sure there is also a huge difference with the vCPU which he uses for QEMU.
I also use the switch -deamonize to free the WSL console for htop and other monitoring.
Here's the list of every AMD CPU flag (from /proc/cpuinfo) that is accepted without error by QEMU:
Performance remains good; I should probably benchmark between this list and the previous one.
@pkostelnik What version of macOS are you using?
I just tried Mojave and it ran much slower than Catalina (the opposite of what I expected). For whatever reason, Catalina is faster on my Ryzen setup. Still laggy, but usable.
@ciparis trying actually both catalina (which started with clover) and also mojave, but trying now to change to opencore.