vincentbernat / eudyptula-boot

Boot a Linux kernel in a VM without a dedicated root filesystem.
115 stars 6 forks source link

qemu: dynamically decide whether to enable KVM #11

Closed greenduck closed 1 year ago

greenduck commented 1 year ago

Invoke qemu with or without KVM enabled based on KVM availability. This might be useful (where performance penalty is acceptable) in virtualized environment, e.g. WSL.

Signed-off-by: Andrey Gelman andrey.gelman@gmail.com

vincentbernat commented 1 year ago

This requires cpu-checker package and being root. Maybe something like -machine accel=kvm,tcg would work.

greenduck commented 1 year ago

This requires cpu-checker package and being root. Maybe something like -machine accel=kvm,tcg would work.

I've updated the PR with simply looking for presence of /dev/kvm file. This test is on par with kvm-ok utility source code. The difference, kvm-ok tries to provide a diagnostic message, while we are fine with just knowing whether KVM is available or not.

vincentbernat commented 1 year ago

Thanks!