forum

My journey to playing osu! on a Kernel-based Virtual Machine

posted
Total Posts
12
Topic Starter
ShizuVoice
P.S. This forum is not a guide, this is an explanation to my experience on playing osu! inside a virtual machine.

Good day everyone! Note that this topic might get technical, have some words that you don't understand, have inadequate info from my experience that I can't explain, and this topic can get long. Also this is probably my first time posting a very long topic and this may not be as organized with others so bear with me. Anyways, let's get started.

Few weeks ago, I got interested in virtual machine after watching a certain YouTuber who is like the "KVM God". My goal originally was to try out to play games with anti-cheat (which would be Genshin Impact) and probably stick with KVM for a while to feel if there is any difference from native Windows 10 and virtualized Windows 10.

And so I started installing Arch Linux as the host OS to an SSD. But before proceeding, I'll be dropping the important PC specs:
  1. Intel Core i5-6400
  2. 2 x T-Force Delta 8GB ; 1 x Adata 4GB
  3. Palit GeForce GTX 1060 6GB
After setting up all of the apps I needed like virt-manager, qemu, and others. I proceeded doing a GPU passthrough, installing Windows 10 inside a VM, applying "patches" to the VM manager and inside Windows 10, and installing Genshin Impact inside the VM.
After doing all those parts, I started the game and it ran inside a virtual machine. Again, Genshin Impact has anti-cheat that it wouldn't run inside a virtual machine but it did. With the performance, I saw like very little to no performance impact at all. But note that it has cracking audio issue which happens both on guest (HDMI audio out) and the host (audio passthrough).

Until that time I started thinking about playing osu! inside a virtual machine... (Also the part of the original topic starts)

Ok, I'll start spewing more "technical words" to this topic. I know some of you would ask:
"SilentVoice, why didn't you just install osu! on your Arch Linux using Lutris and use WINE and call it a day?"

Short answer: I tend to break Linux easily (most especially the kernel patch that almost broke my previous installation of Linux).

Long answer:
There are things that you would wanna know some changes to the Linux community.
Recently/several months ago, there was a topic about the new audio/video server of Linux that could replace PulseAudio. And we know that PulseAudio is like the common audio server but this new audio/video server fixes the problem of PulseAudio like the latency and the usage. This is where PipeWire comes in. And I personally use PipeWire that comes with PulseEffects (a system-wide equalizer for Linux). I would love to try playing osu! with WINE but I didn't have time to set it up and since this is getting off-topic, this would be discussed on a different forum.

So with those answers on the side right now, I then proceed install osu! on the VM and download few standard and mania beatmaps. Remember what I said before about audio issue while I was playing Genshin Impact? This was my first hurdle playing osu! inside KVM.
Since I used HDMI audio at that time, there was a problem with the interrupts configured on the registry that makes the crackling sound on the output. I proceeded troubleshoot the problem and set the GPU to use MSI (Message Signaled Interrupts) which was supposedly the fix of the audio crackling issue (which it is) and trying out again, it worked well. But this doesn't fixed the hitsound latency issue that is somewhat present and a very weird bug that causes osu! to froze up for a while midgame and goes on like nothing happened.

Since I was not satisfied with the result, I tried passing through the audio via the manager itself with SPICE and to PipeWire/PulseEffects. Regretted instantly. Audio latency got even worse and the hitsound also sounded very off from the keyboard input to the speakers. SPICE has this like "network remote" way of sending audio to the audio server which explains why the audio had higher latency.

I've kicked things up to a notch where I ordered online a dedicated USB audio exclusively for passing audio from the VM to the speakers. Waited for a few days until I got it. After I got the USB audio I instantly hooked up the device into the VM. To my expectation, I expected that there will be no crackling sound that is present from the two previous attempts and fixes the hitsound latency issue. But it wasn't, there is still an occasional audio crackling issue that is present. This is because of the interrupt issue that is present inside the VM that affects audio only, I don't know if it's because the limitation to my CPU that has only 4 cores and 4 threads.

For more technical info about the interrupt, this is the comparison of the latency using LatencyMon:
  1. Native Windows 10 = 65-230 μs
  2. VM Windows 10 = 450-1250+ μs
With the latency on the VM Windows 10, this introduces underrun/dropouts on the audio.
Aside with the interrupt latency, the hitsound latency issue almost fixed it, but still noticeable to me.

I was somewhat satisfied with the result of the USB audio but the occasional audio crackling sound made me go dig more information from KVM forums.

This is where I stumbled Scream, a virtual device driver that performs as a discrete audio device. Since I was using PipeWire, this could benefit the audio latency I'm dealing with.
This is also the time I did a reconfiguration on my KVM and the system that fixed a bit of performance and uses only one GPU, which is not your typical thing when doing VM on the host.
Since I didn't have time to setup Scream with IVSHMEM driver, I did the network way of sending the audio stream from the guest to the host. Basically, the host has the Scream receiver which I installed from the Arch User Repository and it listens the audio from the client. After the setup, blacklisting Scream listener from PulseEffects (to prevent any latency delay from the equalizer), I tried it again playing osu! and for the first time in my life I've experienced near real-time or real-time audio latency inside VM. The audio crackling issue was gone, hitsound latency was gone, and the experience after playing with it for few hours it was like I was playing osu! in a native Windows 10 system.

"Cool, now the audio issue was fixed, how's the performance inside the virtual machine?"
To be honest, the frametime that I am seeing while using unlimited frametime, from time to time it jumps from 0.88ms to 1.7ms. When I am on my native Windows 10, the frametime goes around 0.56ms to 0.84ms, 0.51ms being the lowest. Not very much difference depending how you see it but there is a performance hit if the host is doing an activity like user interaction or background apps running.

Conclusion
Should you do this? No
But to those people want to try out...
You need a VT-d and IOMMU capable processor, a decent dedicated GPU, some considerable amount of RAM and hard drive for running a virtual machine, and a spare time.

The advantage of running Windows 10 on a virtual machine is the support of apps that you can't use on Linux which does not work with WINE. And if you don't like dual booting, this is the purpose of using a virtual machine. I don't know if I am the very first osu! player to perform this, who knows.

That's all for now. If someone actually perform this and can optimize it even better than mine, I don't know what to say but, good luck.
Topic Starter
ShizuVoice
Update to my journey, I can play osu! with almost bare-metal performance with no latency issue. I even made a best score inside the virtual machine with this beatmap.
Edit: Didn't do my "best" try because this is a technical map.

FrixaCo
You still play osu! using GPU passthrough? I was curious if it's worth switching or not
anaxii

FrixaCo wrote:

You still play osu! using GPU passthrough? I was curious if it's worth switching or not
I think they're gone...

Wimpy Cursed
nah they are still around

anaxii

Wimpy Cursed wrote:

nah they are still around

Yeah 💀
Reyalp51
smol ame
Winnyace
This guy necroed a two year old post man... holy fuck...

Anyway, I really recommend one uses this script now for playing osu! on Linux without a VM, that sets up everything automatically without any hassle. There are some audio issues sometimes, but they can be remedied I believe. ThePoon's Discord server has a channel specific osu on Linux as well.

Using a virtual machine and doing the passthrough and stuff is not worth it IMO considering how mature Wine, DXVK, etc have gotten in the last 2 years alone. They aren't perfect, but they're pretty close. Also Lazer is really speeding up and by the end of the year, peppy says Lazer will have ranked play enabled. Lazer is native to Linux so yeah, I'm excited.
anaxii

Winnyace wrote:

This guy necroed a two year old post man... holy fuck...
It usually happens in GD

I'm even surprised that the thread isn't locked yet
Jangsoodlor
This is like a 1000 words essay that could be summarised as "I use Arch btw"

Jokes aside, I heard (and have experienced) that osu! on linux through wine with pipewire has lower latency than windows. So using gpu passthrough to windows kinda defeats the purpose. But the process of setting this up is notoriously complicated so kudos for setting this up.
Topic Starter
ShizuVoice
Wth guys, did you just necropost on this forum?

Also I'm not dead, I'm mostly active but in Lazer for more than a year.

Anyway, to answer this question...

FrixaCo wrote:

You still play osu! using GPU passthrough? I was curious if it's worth switching or not
No, because of the hassle of setting up and the complexity when troubleshooting your system/VM. As people said there are scripts that can do it everything for you to play osu!stable. Before I left osu!stable and went with osu!lazer, using PipeWire with a specific Wine build pretty much eliminated my issue with osu! on Linux before way back 2018. But there are forums/servers that you can follow on how to properly optimize your osu! under Linux so do that instead of doing a VM, this is an extreme/very specific use case that may not apply to all players.

Unless you have time to tinker and play around your PC, I'm not stopping you.
anaxii

ShizuVoice wrote:

Wth guys, did you just necropost on this forum?

Also I'm not dead, I'm mostly active but in Lazer for more than a year.
You can DM a moderator to lock this thread if you didn't want it to be necro'ed
Please sign in to reply.

New reply