Guest os=Windows , qemu. Shutdown very slow. Memory allocation issue.
Host environment
- Operating system: Linux - Fedora 40
- OS/kernel version: 6.10.8-200.fc40.x86_64
- Architecture: x86-64
- QEMU flavor: qemu-system-x86_64
- QEMU version: qemu-8.2.6-3.fc40.x86_64
- QEMU command line:
/usr/bin/qemu-system-x86_64 -S
-name guest=VMName,debug-threads=on
-object {"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain-6-VMName/master-key.aes"}
-blockdev {"driver":"file","filename":"/usr/share/edk2/ovmf/OVMF_CODE_4M.qcow2","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}
-blockdev {"node-name":"libvirt-pflash0-format","read-only":true,"driver":"qcow2","file":"libvirt-pflash0-storage"}
-blockdev {"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/Win-Lcl_VARS.qcow2","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}
-blockdev {"node-name":"libvirt-pflash1-format","read-only":false,"driver":"qcow2","file":"libvirt-pflash1-storage"}
-machine pc-q35-7.2,usb=off,vmport=off,smm=on,kernel_irqchip=on,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format,hpet=on,acpi=on
-accel kvm
-cpu host,migratable=on,topoext=on,hv-time=on,hv-relaxed=on,hv-vapic=on,hv-spinlocks=0x1fff,hv-vendor-id=0123456789AB,kvm=off,pmu=on,host-cache-info=on,l3-cache=off
-m size=33554432k
-object {"qom-type":"memory-backend-memfd","id":"pc.ram","share":true,"x-use-canonical-path-for-ramblock-id":false,"size":34359738368}
-overcommit mem-lock=off
-smp 10,sockets=1,dies=1,clusters=1,cores=5,threads=2
-object {"qom-type":"iothread","id":"iothread1"}
-object {"qom-type":"iothread","id":"iothread2"}
-object {"qom-type":"iothread","id":"iothread3"}
-object {"qom-type":"iothread","id":"iothread4"}
-uuid 00000000-0000-0000-0000-000000080001
-no-user-config
-nodefaults
-chardev socket,id=charmonitor,fd=46,server=on,wait=off
-mon chardev=charmonitor,id=monitor,mode=control
-rtc base=localtime
-no-shutdown
-global ICH9-LPC.disable_s3=1
-global ICH9-LPC.disable_s4=1
-boot strict=on
-device {"driver":"pcie-root-port","port":16,"chassis":1,"id":"pci.1","bus":"pcie.0","multifunction":true,"addr":"0x2"}
-device {"driver":"pcie-root-port","port":17,"chassis":2,"id":"pci.2","bus":"pcie.0","addr":"0x2.0x1"}
-device {"driver":"pcie-root-port","port":18,"chassis":3,"id":"pci.3","bus":"pcie.0","addr":"0x2.0x2"}
-device {"driver":"pcie-root-port","port":19,"chassis":4,"id":"pci.4","bus":"pcie.0","addr":"0x2.0x3"}
-device {"driver":"pcie-root-port","port":20,"chassis":5,"id":"pci.5","bus":"pcie.0","addr":"0x2.0x4"}
-device {"driver":"pcie-root-port","port":21,"chassis":6,"id":"pci.6","bus":"pcie.0","addr":"0x2.0x5"}
-device {"driver":"pcie-root-port","port":22,"chassis":7,"id":"pci.7","bus":"pcie.0","addr":"0x2.0x6"}
-device {"driver":"pcie-root-port","port":23,"chassis":8,"id":"pci.8","bus":"pcie.0","addr":"0x2.0x7"}
-device {"driver":"pcie-root-port","port":24,"chassis":9,"id":"pci.9","bus":"pcie.0","multifunction":true,"addr":"0x3"}
-device {"driver":"pcie-root-port","port":25,"chassis":10,"id":"pci.10","bus":"pcie.0","addr":"0x3.0x1"}
-device {"driver":"pcie-root-port","port":26,"chassis":11,"id":"pci.11","bus":"pcie.0","addr":"0x3.0x2"}
-device {"driver":"pcie-root-port","port":27,"chassis":12,"id":"pci.12","bus":"pcie.0","addr":"0x3.0x3"}
-device {"driver":"pcie-root-port","port":28,"chassis":13,"id":"pci.13","bus":"pcie.0","addr":"0x3.0x4"}
-device {"driver":"pcie-root-port","port":29,"chassis":14,"id":"pci.14","bus":"pcie.0","addr":"0x3.0x5"}
-device {"driver":"pcie-root-port","port":30,"chassis":15,"id":"pci.15","bus":"pcie.0","addr":"0x3.0x6"}
-device {"driver":"pcie-pci-bridge","id":"pci.16","bus":"pci.4","addr":"0x0"}
-device {"driver":"qemu-xhci","p2":15,"p3":15,"id":"usb","bus":"pci.2","addr":"0x0"}
-device {"driver":"virtio-scsi-pci","id":"scsi0","bus":"pci.16","addr":"0x1"}
-device {"driver":"virtio-serial-pci","id":"virtio-serial0","bus":"pci.5","addr":"0x0"}
-blockdev {"driver":"file","filename":"/Z-ZZZ/VMs/VMName.VHDX","aio":"native","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap","cache":
{"direct":true,"no-flush":false}}
-blockdev {"node-name":"libvirt-2-format","read-only":false,"discard":"unmap","cache":{"direct":true,"no-flush":false},"driver":"vhdx","file":"libvirt-2-storage"}
-device {"driver":"virtio-blk-pci","bus":"pci.6","addr":"0x0","drive":"libvirt-2-format","id":"virtio-disk0","bootindex":2,"write-cache":"off"}
-blockdev {"driver":"file","filename":"/Z-ZZZ/ISO/virtio-win.iso","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}
-blockdev {"node-name":"libvirt-1-format","read-only":true,"discard":"ignore","cache":{"direct":true,"no-flush":false},"driver":"raw","file":"libvirt-1-storage"}
-device {"driver":"scsi-cd","bus":"scsi0.0","channel":0,"scsi-id":0,"lun":2,"device_id":"drive-scsi0-0-0-2","drive":"libvirt-1-format","id":"scsi0-0-0-2","bootindex":1,"write-cache":"on"}
-netdev {"type":"tap","fd":"47","vhost":true,"vhostfd":"49","id":"hostnet0"}
-device {"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":"52:54:00:00:00:01","bus":"pci.1","addr":"0x0"}
-netdev {"type":"tap","fd":"50","vhost":true,"vhostfd":"51","id":"hostnet1"}
-device {"driver":"virtio-net-pci","netdev":"hostnet1","id":"net1","mac":"52:54:00:00:00:02","bus":"pci.7","addr":"0x0"}
-chardev pty,id=charserial0
-device {"driver":"isa-serial","chardev":"charserial0","id":"serial0","index":0}
-chardev socket,id=charchannel0,fd=45,server=on,wait=off
-device {"driver":"virtserialport","bus":"virtio-serial0.0","nr":1,"chardev":"charchannel0","id":"channel0","name":"org.qemu.guest_agent.0"}
-chardev socket,id=chrtpm,path=/run/libvirt/qemu/swtpm/6-VMName-swtpm.sock
-tpmdev emulator,id=tpm-tpm0,chardev=chrtpm
-device {"driver":"tpm-crb","tpmdev":"tpm-tpm0","id":"tpm0"}
-device {"driver":"usb-tablet","id":"input2","bus":"usb.0","port":"1"}
-audiodev {"id":"audio1","driver":"none"}
-vnc 192.168.255.253:0,share=force-shared,audiodev=audio1
-device {"driver":"qxl-vga","id":"video0","max_outputs":1,"ram_size":67108864,"vram_size":67108864,"vram64_size_mb":0,"vgamem_mb":16,"bus":"pcie.0","addr":"0x1"}
-global ICH9-LPC.noreboot=off
-watchdog-action reset
-device {"driver":"virtio-balloon-pci","iommu_platform":true,"ats":true,"id":"balloon0","bus":"pci.3","addr":"0x0"}
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny
-msg timestamp=on
Emulated/Virtualized environment
- Operating system: Windows 11
- Architecture: x86-64
Description of problem
simplifiying - libvirt config:
<memory unit='KiB'>33554432</memory>
<currentMemory unit='KiB'>131072</currentMemory>
when use <currentMemory> less than <memory> - at/after shutdown of guest os cpu hangs on 100% and lasts long- approximately 3-5 minutes
if change to
<memory unit='KiB'>33554432</memory>
<currentMemory unit='KiB'>33554432</currentMemory>
then shutdown takes less some seconds
problem occurs not (shutdown of VM takes some seconds) in cases when not used balloon device:
1 <currentMemory> equal to <memory>
2 memballoon driver disabled in windows
3 memballoon disabled on libvirt with "model=none" (and therefore not passed to qemu command line)
Additional information
on the guest :
- used drivers from virtio-win-0.1.262.iso - membaloon ver 100.95.104.26200
- possible combination of all or some components
monitored next:
virsh dommemstat VMName at shutdown time there grows "rss" till MaxMem, but very slowly.
aLso on virsh setmem VMName --live --size 32G
rss grows slow - but takes 2 times less than at simple shutdown time ( = at shutdown seems occurs memory allocation and deallocation at the same time)
so something with some or all libvirt/qemu/balloon parts not so nice