google / android-emulator-container-scripts

1.87k stars 261 forks source link

I cannot use CPU acceleration on VM server instance #244

Open jay0129 opened 3 years ago

jay0129 commented 3 years ago

I use CentOS 7.9 with hardware spec N3.8vCPU_32GB_100GB_SSD.

However, even though I enabled KVM and passed devices: [/dev/kvm] to the emulator, it is too slow to be used compared to same spec of Physical machine.

What I did to enable KVM is:

$ lscpu | grep Virtualization
Virtualization:        VT-x
Virtualization type:   full

$ sudo yum install qemu-kvm libvirt libvirt-python libguestfs-tools virt-install
$ sudo systemctl enable libvirtd
$ sudo systemctl start libvirtd

$ /sbin/lsmod | grep kvm
kvm_intel             188740  0
kvm                   637289  1 kvm_intel
irqbypass              13503  1 kvm

And standard error message when running docker is:

tail: warning: --retry only effective for the initial open
tail: cannot open '/tmp/android-unknown/goldfish_rtc_0' for reading: No such file or directory
* daemon not running; starting now at tcp:5037
* daemon started successfully
handleCpuAcceleration: feature check for hvf
cannot add library /android/sdk/emulator/qemu/linux-x86_64/lib64/vulkan/libvulkan.so: failed
added library /android/sdk/emulator/lib64/vulkan/libvulkan.so
cannot add library /android/sdk/emulator/lib64/vulkan/libvulkan.so.1: full
pc_memory_init: above 4g size: 40000000
pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver
WARNING. Using fallback path for the emulator registration directory.

Could you help me identifying the problem here?

pokowaka commented 3 years ago

Unfortunately there is significant overhead to running the emulator in nested virtualization. We are working on adding instrumentation to get a better understanding of where we are experiencing slowdowns.

jay0129 commented 3 years ago

@pokowaka thank you for the explanation. However I think, I am not sure though, my vm doesn't use nested virtualization.

$cat /sys/module/kvm_intel/parameters/nested
N