You are not logged in.
I have an interesting problem that I am trying to figure out.
HW: 5800X, RX6700XT.
SW: XFCE + greeter alone(autologin), X11+mesa, qemu+libvirt(+ manager)
I can successfully run guest(Win10), and return back to host, even multiple times. There are no issues at all here. However, after using guest and when back in host, if I sw power cycle like reboot or shutdown, it go to almost full shutting process before actual real power off but then stay there on infinitely, with monitor off. Otherwise working inside host after quitting VM is fine as well. Only shutting it down, restarting or sleep is. Here is small log examples of very last log lines, there are no errors before these and would show normal shutting process:
Reached target Unmount All Filesystems.
systemd[1]: Reached target Late Shutdown Services.
systemd[1]: systemd-reboot.service: Deactivated successfully.
systemd[1]: Finished System Reboot.
systemd[1]: Reached target System Reboot.
systemd[1]: Shutting down.
systemd-shutdown[1]: Syncing filesystems and block devices.
systemd-shutdown[1]: Sending SIGTERM to remaining processes...
systemd-journald[601]: Received SIGTERM from PID 1 (systemd-shutdow).
dnsmasq[997]: exiting on receipt of SIGTERM
systemd-journald[601]: Journal stoppedSo no errors in journal(I had stack trace hangs before I added hooks etc but not anymore after proper (un)rebinding of everything etc..)
I also tried to restart host directly from "attach" script part, both immediately and after echo 1 > "remove" pci of the gpu, virsh reattach etc, all without help.
Here is my script which I already also modified multiple ways before to see if any of it help:
#!/bin/bash
detach() {
systemd-cat -p err echo "[ Stopping DM... ]"
chvt 1
xfce4-session-logout --fast
systemctl stop display-manager.service
for i in /sys/class/vtconsole/*; do
if (grep "frame buffer" "${i}/name"); then
systemd-cat -p err echo "[ Detaching console: ${i} ]"
echo 0 > ${i}/bind
fi
done
systemd-cat -p err echo "[ Detaching amdgpu + bus... ]"
modprobe -r amdgpu
while true; do
if fuser -s /dev/dri/card0 || fuser -s /dev/dri/card1 || fuser -s /dev/dri/renderD128 ; then
systemd-cat -p err echo "[ Waiting for amdgpu to unload... ]"
sleep 1
else
virsh nodedev-detach pci_0000_13_00_0
virsh nodedev-detach pci_0000_13_00_1
break
fi
done
systemd-cat -p err echo "[ Done Detaching GPU! ] "
}
attach() {
systemd-cat -p err echo "[ Detaching vfio_pci + reattaching bus... ]"
virsh nodedev-reattach pci_0000_13_00_1
virsh nodedev-reattach pci_0000_13_00_0
# systemd-cat -p err echo "[ Reseting gpu bus... ]"
# echo 1 > /sys/bus/pci/devices/0000:13:00.0/reset
systemd-cat -p err echo "[ Reseting pci bus... ]"
echo 1 > /sys/bus/pci/devices/0000:13:00.0/remove
echo 1 > /sys/bus/pci/devices/0000:13:00.1/remove
echo 1 > /sys/bus/pci/rescan
sleep 2
# systemd-cat -p err echo "[ Loading amdgpu... ]"
# modprobe amdgpu
for i in /sys/class/vtconsole/*; do
if (grep "frame buffer" "${i}/name"); then
systemd-cat -p err echo "[ Attaching console: ${i} ]"
echo 1 > ${i}/bind
fi
done
systemd-cat -p err echo "[ Starting DM... ]"
systemctl start display-manager.service
}
OBJECT="$1"
OPERATION="$2"
if [[ $OBJECT == "win10" ]]; then
case "$OPERATION" in
"prepare")
detach
;;
"release")
attach
;;
esac
fiI also added start/stop scripts in guest(with my own gpu ID):
pnputil /enable-device "PCI\VEN_1002&DEV_66AF&SUBSYS_081E1002&REV_C1\4&23f93f77&0&00E0
pnputil /disable-device "PCI\VEN_1002&DEV_66AF&SUBSYS_081E1002&REV_C1\4&23f93f77&0&00E0I use uki kernel with following cmdline:
rootfstype=xfs loglevel=3 quiet amdgpu.ppfeaturemask=0xfff7ffff amd_iommu=pgtbl_v2 iommu=pt nowatchdog...and following in modprobe.d:
options vfio-pci disable_vga=1
blacklist sp5100_tcoBefore I had "watchdog not stopping" issue thats why I blacklisted it but even so computer still wont power cycle properly.
I am lost at this point, pls advise. Note some 2 years back I recall using VM and being able to properly power cycle but that time it would randomly fail returning from guest. Now this is much more reliable I just cant figure out this last thing.
Also regarding host sleep after using VM, this freeze instantly as I press a sleep button on keyboard at the very moment with last screen remaining(not going blank), shutting down or restarting host does turn off the monitor it just wont completely turn off or reboot computer.
Additional info:
pacman -Qs mesa
local/glu 9.0.3-2
Mesa OpenGL utility library
local/lib32-mesa 1:25.1.7-1
Open-source OpenGL drivers - 32-bit
local/lib32-opencl-mesa 1:25.2.1-1
Open-source OpenCL drivers - 32-bit
local/lib32-vulkan-mesa-layers 1:25.1.7-1
Mesa's Vulkan layers - 32-bit
local/mesa 1:25.1.7-1
Open-source OpenGL drivers
local/opencl-mesa 1:25.2.1-2
Open-source OpenCL drivers
local/vulkan-mesa-layers 1:25.1.7-1
Mesa's Vulkan layers
kernel: 6.16.1-arch1-1
<domain type="kvm">
<name>win10</name>
<uuid>b179eaa5-3e1f-44cb-957e-69175530adab</uuid>
<metadata>
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
<libosinfo:os id="http://microsoft.com/win/10"/>
</libosinfo:libosinfo>
</metadata>
<memory unit="KiB">12582912</memory>
<currentMemory unit="KiB">12582912</currentMemory>
<memoryBacking>
<source type="memfd"/>
<access mode="shared"/>
</memoryBacking>
<vcpu placement="static">16</vcpu>
<iothreads>1</iothreads>
<os firmware="efi">
<type arch="x86_64" machine="pc-q35-9.1">hvm</type>
<firmware>
<feature enabled="no" name="enrolled-keys"/>
<feature enabled="no" name="secure-boot"/>
</firmware>
<loader readonly="yes" type="pflash" format="raw">/usr/share/edk2/x64/OVMF_CODE.4m.fd</loader>
<nvram template="/usr/share/edk2/x64/OVMF_VARS.4m.fd" templateFormat="raw" format="raw">/var/lib/libvirt/qemu/nvram/win10_VARS.fd</nvram>
<boot dev="hd"/>
<smbios mode="host"/>
</os>
<features>
<acpi/>
<apic/>
<hyperv mode="passthrough">
</hyperv>
<kvm>
<hidden state="off"/>
</kvm>
<vmport state="off"/>
</features>
<cpu mode="host-passthrough" check="none" migratable="on">
<topology sockets="1" dies="1" clusters="1" cores="8" threads="2"/>
<feature policy="require" name="topoext"/>
<feature policy="optional" name="hypervisor"/>
</cpu>
<clock offset="localtime">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
<timer name="hypervclock" present="yes"/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
</pm>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="disk">
<driver name="qemu" type="qcow2" cache="none" discard="unmap"/>
<source file="/mntF/vimg/win10.qcow2"/>
<target dev="sda" bus="sata"/>
<address type="drive" controller="0" bus="0" target="0" unit="0"/>
</disk>
<controller type="usb" index="0" model="qemu-xhci" ports="15">
<address type="pci" domain="0x0000" bus="0x02" slot="0x00" function="0x0"/>
</controller>
<controller type="pci" index="0" model="pcie-root"/>
<controller type="pci" index="1" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="1" port="0x10"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0" multifunction="on"/>
</controller>
<controller type="pci" index="2" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="2" port="0x11"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x1"/>
</controller>
<controller type="pci" index="3" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="3" port="0x12"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x2"/>
</controller>
<controller type="pci" index="4" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="4" port="0x13"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x3"/>
</controller>
<controller type="pci" index="5" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="5" port="0x14"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x4"/>
</controller>
<controller type="pci" index="6" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="6" port="0x15"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x5"/>
</controller>
<controller type="pci" index="7" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="7" port="0x16"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x6"/>
</controller>
<controller type="pci" index="8" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="8" port="0x17"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x7"/>
</controller>
<controller type="pci" index="9" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="9" port="0x18"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x0" multifunction="on"/>
</controller>
<controller type="pci" index="10" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="10" port="0x19"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x1"/>
</controller>
<controller type="pci" index="11" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="11" port="0x1a"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x2"/>
</controller>
<controller type="pci" index="12" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="12" port="0x1b"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x3"/>
</controller>
<controller type="pci" index="13" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="13" port="0x1c"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x4"/>
</controller>
<controller type="pci" index="14" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="14" port="0x1d"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x5"/>
</controller>
<controller type="sata" index="0">
<address type="pci" domain="0x0000" bus="0x00" slot="0x1f" function="0x2"/>
</controller>
<filesystem type="mount" accessmode="passthrough">
<driver type="virtiofs"/>
<source dir="/mntF/virt"/>
<target dir="linvirt"/>
<address type="pci" domain="0x0000" bus="0x07" slot="0x00" function="0x0"/>
</filesystem>
<interface type="network">
<mac address="52:54:00:02:5c:16"/>
<source network="default"/>
<model type="e1000e"/>
<link state="up"/>
<address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
</interface>
<input type="evdev">
<source dev="/dev/input/by-path/platform-i8042-serio-0-event-kbd" grab="all" grabToggle="ctrl-ctrl" repeat="on"/>
</input>
<input type="mouse" bus="ps2"/>
<input type="keyboard" bus="ps2"/>
<audio id="1" type="none"/>
<hostdev mode="subsystem" type="pci" managed="yes">
<source>
<address domain="0x0000" bus="0x13" slot="0x00" function="0x0"/>
</source>
<rom file="/etc/libvirt/qemu/rx6700xt.rom"/>
<address type="pci" domain="0x0000" bus="0x05" slot="0x00" function="0x0"/>
</hostdev>
<hostdev mode="subsystem" type="pci" managed="yes">
<source>
<address domain="0x0000" bus="0x13" slot="0x00" function="0x1"/>
</source>
<rom file="/etc/libvirt/qemu/rx6700xt.rom"/>
<address type="pci" domain="0x0000" bus="0x06" slot="0x00" function="0x0"/>
</hostdev>
<hostdev mode="subsystem" type="usb" managed="yes">
<source>
<vendor id="0x08bb"/>
<product id="0x2902"/>
</source>
<address type="usb" bus="0" port="4"/>
</hostdev>
<hostdev mode="subsystem" type="usb" managed="yes">
<source>
<vendor id="0x1bcf"/>
<product id="0x0005"/>
</source>
<address type="usb" bus="0" port="1"/>
</hostdev>
<watchdog model="itco" action="none"/>
<memballoon model="virtio">
<address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0"/>
</memballoon>
</devices>
</domain>Last edited by eUser4 (2025-09-07 20:12:33)
Offline
If anyone come across, I was able to find the culprit. I needed
pci=realloc=offkernel parameter. Now it works.
Last edited by eUser4 (2025-09-07 20:13:50)
Offline