Libvirt hooks and possible AMD reset bug.

This page summarizes the projects mentioned and recommended in the original post on /r/VFIO

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • Single-GPU-Passthrough

    I've semi-successfully passed my RX480 to a Windows VM by a single-gpu setup. Using this and this guide, I setup my libvirt hooks and after some difficulty I finally boot into Windows. My hooks are setup very similar to those guides using the same directory structure. My VM start hook script is as follows: #!/bin/bash set -x # Stop display manager systemctl stop lightdm.service # Unbind VTconsoles echo 0 > /sys/class/vtconsole/vtcon0/bind echo 0 > /sys/class/vtconsole/vtcon1/bind # Unbind EFI-Framebuffer echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind # Avoid race condition by waiting sleep 5 # Unload AMD drivers modprobe -r amdgpu # Unbind GPU from display driver virsh nodedev-detach pci_0000_09_00_0 virsh nodedev-detach pci_0000_09_00_1 # Load VFIO kernel module modprobe vfio-pci and my VM shutdown hook script: #!/bin/bash set -x # Unload VFIO-PCI Kernel Driver modprobe -r vfio-pci modprobe -r vfio_iommu_type1 modprobe -r vfio # Rebind GPU virsh nodedev-reattach pci_0000_09_00_0 virsh nodedev-reattach pci_0000_09_00_1 # Rebind VTconsoles echo 1 > /sys/class/vtconsole/vtcon0/bind echo 1 > /sys/class/vtconsole/vtcon1/bind # Rebind EFI framebuffer echo "efi-framebuffer.0" > /sys/bus/platform/drivers/efi-framebuffer/bind # Load AMD driver modprobe amdgpu # Restart Display Manager systemctl start lightdm.service I successfully got the VM to boot a handful of times; could never successfully get it to gracefully shut down which I'm assuming is due to the AMD gpu reset bug (host gets black screen and never goes back into desktop and will also not respond through ssh, forcing me to manually shutdown). Looking through the libvirt logs reveals some errors executing the libvirt hooks: Dec 29 16:47:40 hTux libvirtd[2545]: libvirt version: 6.5.0 Dec 29 16:47:40 hTux libvirtd[2545]: hostname: hTux Dec 29 16:47:40 hTux libvirtd[2545]: End of file while reading data: Input/output error Dec 29 16:47:41 hTux libvirtd[2545]: internal error: Child process (LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/var/lib/snapd/snap/bin /etc/libvirt/hooks/qemu Windows10 prepare begin -) unexpected exit status 139: + systemctl stop lightdm.service /etc/libvirt/hooks/qemu: line 30: 2666 Segmentation fault "/etc/libvirt/hooks/qemu.d/Windows10/prepare/begin/start.sh" Windows10 prepare begin - Dec 29 16:47:41 hTux libvirtd[2545]: Hook script execution failed: internal error: Child ⠀process (LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/var/lib/snapd/snap/bin /etc/libvirt/hooks/qemu Windows10 prepare begin -) unexpected exit status 139: + systemctl stop lightdm.service /etc/libvirt/hooks/qemu: line 30: 2666 Segmentation fault "/etc/libvirt/hooks/qemu.d/Windows10/prepare/begin/start.sh" Windows10 prepare begin - Dec 29 16:47:41 hTux libvirtd[2545]: unsupported configuration: pci backend driver 'default' is not supported Dec 29 16:47:41 hTux libvirtd[2545]: Failed to allocate PCI device list: unsupported configuration: pci backend driver 'default' is not supported Dec 29 16:47:41 hTux libvirtd[2545]: Unable to find device 000.000 in list of active USB devices Dec 29 16:47:41 hTux libvirtd[2545]: Unable to find device 000.000 in list of active USB devices Dec 29 16:48:40 hTux audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj==unconfined msg='unit=libvirtd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' Seems that for some reason the display manager will not stop; I've also tried sudo -u to try running as a different user to no avail. The rest of the script seems to run successfully as manually stopping the DM and starting the VM with virsh boots the VM fine. Doing this method also returns me back into the (Manjaro) Linux host desktop upon shutdown (so also seems to fix gpu reset issue?). Has anyone else had this issue? Any ideas how to proceed?

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts