[QEMU] All VMs hang on Debian 9 with AMD Ryzen

Hello, this appears to be the best place on the net for Ryzen + KVM/QEMU problems at this point in time.

I have a VM host (kvm + libvirtd) running on Debian 9 with Linux 4.14. The CPU is a AMD Ryzen 7 1700X .

When starting my VMs (Debian, Ubuntu, Win10, …) they freeze/hang after some time.

When running my Debian 9 VM i get the following log messages:

2018-03-06 15:23:55.289+0000: starting up libvirt version: 3.0.0, package: 4+deb9u1 (Guido Günther <[email protected]> Mon, 16 Oct 2017 22:48:55 +0200), qemu version: 2.8.1(Debian 1:2.8+dfsg-6+deb9u3), hostname: myworkstation
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin QEMU_AUDIO_DRV=spice /usr/bin/kvm -name guest=twin1,debug-threads=on -S -object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-5-twin1/master-key.aes -machine pc-i440fx-2.8,accel=kvm,usb=off,vmport=off,dump-guest-core=off -cpu Opteron_G3,+vme,+ht,+pclmuldq,+ssse3,+fma,+sse4.1,+sse4.2,+movbe,+aes,+xsave,+osxsave,+avx,+f16c,+rdrand,+arat,+fsgsbase,+bmi1,+avx2,+smep,+bmi2,+rdseed,+adx,+smap,+clflushopt,+xsaveopt,+xsavec,+xgetbv1,+mmxext,+fxsr_opt,+pdpe1gb,+cmp_legacy,+extapic,+cr8legacy,+3dnowprefetch,+osvw,+skinit,+wdt,+tce,+topoext,+perfctr_core,+perfctr_nb -m 2048 -realtime mlock=off -smp 4,sockets=4,cores=1,threads=1 -uuid 5fa6bcf8-597a-4895-b4ab-eb39374605b6 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-5-twin1/monitor.sock,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=delay -no-hpet -no-shutdown -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 -boot strict=on -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x5.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x5 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x5.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x5.0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 -drive file=/var/lib/libvirt/images/debian9-clone-4.qcow2,format=qcow2,if=none,id=drive-ide0-0-0 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -drive if=none,id=drive-ide0-0-1,readonly=on -device ide-cd,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 -netdev tap,fd=25,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:81:25:54,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev spicevmc,id=charchannel0,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 -spice port=5900,addr=127.0.0.1,disable-ticketing,image-compression=off,seamless-migration=on -device virtio-vga,id=video0,bus=pci.0,addr=0x2 -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -chardev spicevmc,id=charredir0,name=usbredir -device usb-redir,chardev=charredir0,id=redir0,bus=usb.0,port=1 -chardev spicevmc,id=charredir1,name=usbredir -device usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=2 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x7 -msg timestamp=on
char device redirected to /dev/pts/0 (label charserial0)

warning: host doesn't support requested feature: CPUID.01H:EDX.ht [bit 28]
warning: host doesn't support requested feature: CPUID.01H:ECX.osxsave [bit 27]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.extapic [bit 3]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.skinit [bit 12]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.wdt [bit 13]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.tce [bit 17]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.topoext [bit 22]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.perfctr-core [bit 23]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.perfctr-nb [bit 24]
warning: host doesn't support requested feature: CPUID.01H:EDX.ht [bit 28]
warning: host doesn't support requested feature: CPUID.01H:ECX.osxsave [bit 27]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.extapic [bit 3]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.skinit [bit 12]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.wdt [bit 13]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.tce [bit 17]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.topoext [bit 22]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.perfctr-core [bit 23]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.perfctr-nb [bit 24]
warning: host doesn't support requested feature: CPUID.01H:EDX.ht [bit 28]
warning: host doesn't support requested feature: CPUID.01H:ECX.osxsave [bit 27]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.extapic [bit 3]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.skinit [bit 12]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.wdt [bit 13]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.tce [bit 17]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.topoext [bit 22]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.perfctr-core [bit 23]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.perfctr-nb [bit 24]
warning: host doesn't support requested feature: CPUID.01H:EDX.ht [bit 28]
warning: host doesn't support requested feature: CPUID.01H:ECX.osxsave [bit 27]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.extapic [bit 3]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.skinit [bit 12]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.wdt [bit 13]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.tce [bit 17]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.topoext [bit 22]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.perfctr-core [bit 23]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.perfctr-nb [bit 24]
2018-03-06T15:46:20.694846Z qemu-system-x86_64: terminating on signal 15 from pid 19244 (<unknown process>)
2018-03-06 15:46:25.888+0000: shutting down, reason=crashed

[Killed by me after the freeze.]

I already found several Bug reports regarding Ryzen SMT/Hyperthreading support with QEMU and the ECX topoext.

My question: Can i change some VM settings (like CPU which is currently copy host conf) to a known good state without updating QEMU or Linux? Even if it costs me performance. I am not yet willing to upgrade to Debian Buster (Testing).

First thing’s first: I usually manually set the CPU model to host-passthrough to get better performance. It also helps to eliminate issues with KVM or QEMU on new CPU architectures.

Second, I would set your core layout to 1 socket, 4 cores, 1 thread, rather than how you have it currently.

What kernel are you running and what version of libvirt and qemu? I’m not 100% sure that you’ve got support for a Ryzen CPU on Debian yet.


Sorry for the late response, I’ve been out of town.

1 Like

Thank you for your answer.

Kernel: 4.14.0-0.bpo.2-amd64
Debian: Stretch (9)
QEMU: QEMU emulator version 2.8.1(Debian 1:2.8+dfsg-6+deb9u3)
Libvirt: libvirtd (libvirt) 3.0.0

Seems like i need to set passthrough in libvirt directly. Virt Manager dose not expose this option.

Passthrough is not in the dropdown menu, but you can write in the option field.

Seems to work. The VM didn’t freeze so far.

Yep, that’s basically how it works. You can also edit that directly in the xml. The beautiful thing about virt-manager is that they don’t expect to always have all the options covered, so they let people who know what they’re doing edit the values directly, while still providing sane defaults for people with less experience. :smiley:

1 Like

Let a VM run over night, froze again. With kernel panic on restart. Then after freeing some memory it started normally.

Do you know if hangs can happen when RAM is full (not related to Ryzen issues)?