Qemu VM runs very slowly and virgl not available if using “-device virtio-vga-gl -display gtk,gl=on”

Posted on

Problem :

Host:

  • OS (a variant of Ubuntu 20.10):
uname -a
Linux ... 5.8.0-7642-generic #47~1614007149~20.10~82fb226-Ubuntu SMP Tue Feb 23 02:59:01 UTC  x86_64 x86_64 x86_64 GNU/Linux
  • nVidia RTX 3090 GPU installed. Driver version 460.32.03.
  • Intel Core i9-10900K CPU
  • Effectively headless

Guest:

  • OS: Ubuntu 20.04 Desktop,
  • OS/kernel version: 5.11.0-41-generic
  • Architecture: x86 64 bit

Qemu executable was built on host from the latest source 6.2.0-rc3, the command line options of ./configure being:

--prefix=$HOME/.bin --target-list=x86_64-softmmu --enable-kvm --enable-vnc --enable-gtk --enable-vte --enable-xkbcommon --enable-sdl --enable-spice --enable-spice-protocol --enable-virglrenderer --enable-opengl --enable-guest-agent --enable-avx2 --enable-avx512f --enable-hax --enable-system --enable-linux-user --enable-libssh --enable-linux-aio --enable-linux-io-uring --enable-modules --enable-gio --enable-fuse --enable-fuse-lseek

The Guest Ubuntu is installed from downloaded ISO image. After installation, the Qemu command line to run the VM is:

qemu-system-x86_64 -hda ubuntu-desktop.qcow2 -m 2G -smp 8 -d guest_errors -device virtio-vga-gl -display gtk,gl=on,show-cursor=on -net nic,model=virtio -net user,hostfwd=tcp::5555-:22 -chardev qemu-vdagent,id=ch1,name=vdagent,clipboard=on -device virtio-serial-pci -device virtserialport,chardev=ch1,id=ch1,name=com.redhat.spice.0

There are some output in the console:

libEGL warning: DRI3: failed to query the version
qemu-system-x86_64: warning: AT-SPI: Could not obtain desktop path or name

qemu-system-x86_64: warning: atk-bridge: GetRegisteredEvents returned message with unknown signature
qemu-system-x86_64: warning: atk-bridge: get_device_events_reply: unknown signature
qemu-system-x86_64: warning: atk-bridge: get_device_events_reply: unknown signature
Invalid write at addr 0x0, size 4, region 'acpi-cpu-hotplug', reason: invalid size (min:1 max:1)
... duplicates of the above line ...
gl_version 45 - core profile enabled

The problems of this Qemu VM are 1) If I replaced -device virtio-vga-gl with -vga virtio, the VM runs fast, but under -device virtio-vga-gl, it runs very slowly, including ssh. 2) A lot of Failures during boot, as shown in the screenshot below. There failures would gone if I replaced -device virtio-vga-gl with -vga virtio. Under -device virtio-vga-gl, however, these failures repeat itself and Qemu window cannot go to login screen (so I have to use ssh). 3) I expect that the OpenGL renderer should be “virgl”, but it’s still software “llvmpipe (LLVM 13.0.0, 128 bits)”

enter image description here

So my questions are: 1) Why is the Qemu VM running so slowly if replacing -vga virtio with -device virtio-vga-gl? Is there anything wrong with any of the options? 2) Why are there so many failures during boot? I did not do anything bad. 3) Why the -display virtio-vga-gl -display gtk,gl=on option does not give the guest an accelerated virgl GPU which effectively uses the host’s powerful GPU?

So far I have given plenty of information for troubleshooting. Here is one more piece of info hopefully useful:

$ dmesg|grep virgl
[  164.657541] [drm] features: +virgl +edid -resource_blob -host_visible

Please let me know if you need other info for troubleshooting. Thank you for your help with this Qemu problem.

Solution :

After I changed the guest OS from Ubuntu to RHEL, all the boot problems are gone.

Leave a Reply

Your email address will not be published. Required fields are marked *