OpenMediaVault-Plugin-Developers/openmediavault-kvm

KVM on ARM64

Derisis13 opened this issue · 9 comments

I'm using openmediavault on a RockPro64, which has an RK3399 which is a CPU by Rockchip that supports hardware virtualization. Yet when I tried to spin up a virtual machine (Homeassistant OS to be exact) it ate all RAM and CPU I gave it and still was as if it run on a potato from 2005.

The reason turned out to be that Qemu was emulating the processor and not using hardware virtualization. I tried setting the CPU model to host passtrough, but Qemu was rejecting the xml saying that this option was unavailable.
When I looked into the issue more, it turns out my system is missing the KVM module (# modprobe kvm outputs modprobe: FATAL: Module kvm not found in directory /lib/modules/6.1.0-0.deb11.11-rt-arm64).

Is there a way to change the arm package to depend on whatever provides the kvm module? I couldn't find any package (this could be my skill issue), if there is none, can one be created inside the openmediavault repos? I have tried recompiling the kernel but I was unsuccessful in creating the KVM module or a kernel that includes it.

If you compile CONFIG_KVM into the kernel, then there will be no module to load. I haven't tried anything KVM on an arm board in a long time.

There is nothing I can add to the plugin to fix this since the kernel is responsible for it.

Thanks, I understand that it's outside your scope the plugin.

My kernel (according to its config file) was not built with the CONFIG_KVM switch set (but the CONFIG_HAVE_KVM and the CONFIG_VIRTUALIZATION are set for some reason).

I'm thinking of writing to the Debian kernel maintainers to enable this option or in what way can they make kvm available.

Armbian maintains that kernel not Debian.

Are you sure? I have debian mirrors in my sources.d and that's where the I installed my kernel from. My dmesg also starts like this:

[Thu Oct  5 10:20:43 2023] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[Thu Oct  5 10:20:43 2023] Linux version 6.1.0-0.deb11.11-rt-arm64 (debian-kernel@lists.debian.org) (gcc-10 (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2) #1 SMP PREEMPT_RT Debian 6.1.38-4~bpo11+1 (2023-08-08)
[Thu Oct  5 10:20:43 2023] Machine model: Pine64 RockPro64 v2.1

Armbian always uses Debian userland. I didn’t know the arm64 Debian kernel supported the rockpro64 (I have one). You would have a lot better chance getting armbian to change the standard config for a board than Debian to change a generic kernel. Any reason you are using the realtime kernel? That would not be my first choice for a KVM host.

The only reason I'm using the realtime kernel is that that's what got installed when I did a system upgrade from the last Ayufan release. I'll check if the generic kernel has KVM. I hope it has since it'd make my life a bit easier.

Thanks so much for figuring out that the RT kernel was the issue. I installed and booted a generic kernel, now modinfo tells me I do have a built-in kvm module, and I'm no longer getting mode host-passtrough not supported on platform aarch64

However the big-little architecture has a little problem with KVM that can be bypassed by explicitly setting the cores as described here:
virtio-win/kvm-guest-drivers-windows#177 (comment)

Applying the workaround with virsh-edit (because the edit xml option doesn't seem to save the xml file, maybe a folder2ram incompatibility?) my virtual machine is up and running!

Was the VM running when you tried to edit the xml? Was there an error? I use it all the time on my systems and haven’t seen any issues.

I'll try to reproduce it tomorrow and open a new issue if I can.