IMHO, KVMGT should be enabled as soon as possible.

Since the modules would not be loaded by default and the user have explicit to 
enable it, i see more benefits.

I've tested a scenario with a precompiled "MainlineBuilds" kernel 
(5.3.0-050300rc5-generic #201908182231) from Ubuntu on my Debian sid system 
(with Intel HD 530 Skylake):

- After loading "modprobe kvmgt", i've got 2 types:

  root@nietzsche:~# cat 
/sys/devices/pci0000\:00/0000\:00\:02.0/mdev_supported_types/i915-GVTg_V5_*/description
  low_gm_size: 128MB
  high_gm_size: 512MB
  fence: 4
  resolution: 1920x1200
  weight: 4
  low_gm_size: 64MB
  high_gm_size: 384MB
  fence: 4
  resolution: 1024x768
  weight: 2

- Since i don't use a remote protocol (as spice), i tried this one:

  https://github.com/intel/gvt-linux/wiki/Dma_Buf_User_Guide
  "A new feature called “Local display” has been supported in GVT-g (KVMGT 
only) by introducing “dma-buf”, a generic kernel level frame work to share 
buffers."

- My testing scenario: run Libreelec (Kodi) in a qemu-kvm container - and it 
works...

  To do this (first enable enable_gvt, load modules, create vGPU [1]), give the 
user privileges:
  markus@nietzsche:~$ cat /etc/udev/rules.d/10-qemu.rules
    SUBSYSTEM=="vfio", OWNER="root", GROUP="kvm"

- Start qemu from commandline:

kvm -hda ./kodi.img \
  -boot c -m 2G \
  -vga none \
  -display gtk,gl=on \
  -soundhw ac97 \
  -smp cores=4,threads=2,sockets=1 \
  -enable-kvm \
  -cpu host \
  -device 
vfio-pci,sysfsdev=/sys/bus/pci/devices/0000\:00\:02.0/a297db4a-f4c2-11e6-90f6-d3b88d6c9525,display=on,x-igd-opregion=on,driver=vfio-pci-nohotplug,ramfb=on

- Libreelec output sysinfo:
  GPU: Mesa DRI Intel(R) HD Graphics 530 (Skylake GT2) [...]

  The performance playing a full-hd video is about 60% less CPU usage comparing 
to virgl!!!

* Problems:
- When using the higher resolution (1920x1200 in my case), the VM freezes with 
"RLIMIT_MEMLOCK (67108864) exceeded"
  dirty fix - set memlock to 1GB for specific user [2]:
  root@nietzsche:~# cat /etc/security/limits.d/99-memlock.conf
    markus hard memlock 1048576
    markus soft memlock 1048576
- The resolution isn't flexible - maybe on Linux guests, this could be fixed 
via xorg (or wayland?) [3]
- After shutdown a VM using GVT-g (Dma_Buf) and restart another VM without 
kvmgt, the CPU-usage is very high! Removing the module is solving this (but i 
don't know, if this just happens, because I've tested it in a weird environment 
Debian sid with an Ubuntu maintainer kernel).
- For Linux guests, it seems, this is only working with an compatible kernel 
also on the guest side...

So, i think, it should be enabled in the default kernel, because it has great 
benefits!
On the other side: there are some problems... but the user should have the 
possibility to activate the modules and test it! The modules have to enabled 
manually - and in combination with spice, it seems to be more stable than with 
the newer "dma-buf"-mode!

Thanks,
Markus



[1] https://wiki.archlinux.org/index.php/Intel_GVT-g
[2] 
https://stackoverflow.com/questions/39187619/vfio-dma-map-error-when-passthrough-gpu-using-libvirt
[3] https://github.com/intel/gvt-linux/issues/44

Reply via email to