View previous topic :: View next topic |
Author |
Message |
jargon777 n00b
Joined: 12 Mar 2019 Posts: 14
|
Posted: Wed May 05, 2021 4:44 pm Post subject: Total Memory Reported in Guest under Memory Balloon |
|
|
Hi,
This is not really a major issue but basically I observe different behaviour between how my Arch Linux guests and Gentoo guests report the effects of memory ballooning. I am using virt-manager (libvirt/qemu) to manage my guests. In Gentoo, meminfo's MemTotal does not change when the allocated memory to a guest is changed, but the amount of memory in use (MemFree) does. In the Arch Linux guest, the MemTotal amount changes while the MemFree amount doesn't.
In both cases, however, the host still receives the memory back (hence why this is minor). I suspect that I am missing a kernel option or something and the Gentoo guest is not re-mapping the user space memory when the balloon changes the memory? |
|
Back to top |
|
|
jargon777 n00b
Joined: 12 Mar 2019 Posts: 14
|
Posted: Sun May 09, 2021 3:51 am Post subject: |
|
|
I guess no one has any insights, I suppose then instead it would be nice to get some pointers so I can try and debug and compare what the difference is between the two. It's mostly out of curiosity at this point, I have observed this difference for some time and haven't been able to find a way to understand why it's different. Mostly the annoyance is visual in that my htop memory bar in Gentoo is consumed with "in use memory".
Things I have tried:
- Triggering the balloon manually to try and capture events in the Arch and Gentoo. Haven't actually been able to capture anything though.
- Trying to identify what consumes the memory. In top/htop it's just marked as 'used', but there's no way to identify what process or thing is using the memory. Presumably it's the virtio driver.
- Trying to use the install disks to compare behaviour. The archlinux install CD also resizes but the gentoo install disk doesn't. |
|
Back to top |
|
|
mike155 Advocate
Joined: 17 Sep 2010 Posts: 4438 Location: Frankfurt, Germany
|
Posted: Sun May 09, 2021 9:01 am Post subject: |
|
|
Your problem looks interesting. Let's try to find out what is going on.
- Please show us the command line arguments that are used to start your guest machines on your host machine. Run
and post the output. You may want to remove private data if there's anything you don't want to post.
Please post the output of
Code: | zgrep -E "(VIRTIO|KVM)" /proc/config.gz |
in your two guest machines.
Please post the output of
on your host machine as well as on your two guest machines.
|
|
Back to top |
|
|
jargon777 n00b
Joined: 12 Mar 2019 Posts: 14
|
Posted: Tue May 11, 2021 4:34 pm Post subject: |
|
|
vpn-gate is the archlinux guest, and gitea is the gentoo guest
Code: | ps -fe | grep qemu
qemu 2490 1 18 May10 ? 02:20:38 /usr/bin/qemu-system-x86_64 -name guest=vpn-gate,debug-threads=on -S -object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-1-vpn-gate/master-key.aes -machine pc-q35-5.2,accel=kvm,usb=off,vmport=off,dump-guest-core=off,memory-backend=pc.ram -cpu SandyBridge,vme=on,ss=on,vmx=on,pdcm=on,pcid=on,hypervisor=on,arat=on,tsc-adjust=on,umip=on,arch-capabilities=on,xsaveopt=on,pdpe1gb=on,skip-l1dfl-vmentry=on,pschange-mc-no=on -m 1024 -object memory-backend-ram,id=pc.ram,size=1073741824 -overcommit mem-lock=off -smp 1,sockets=1,cores=1,threads=1 -uuid 342611b7-95ae-4d4b-9427-2580be28193e -no-user-config -nodefaults -chardev socket,id=charmonitor,fd=23,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 ICH9-LPC.disable_s3=1 -global ICH9-LPC.disable_s4=1 -boot menu=on,strict=on -device pcie-root-port,port=0x10,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,addr=0x2 -device pcie-root-port,port=0x11,chassis=2,id=pci.2,bus=pcie.0,addr=0x2.0x1 -device pcie-root-port,port=0x12,chassis=3,id=pci.3,bus=pcie.0,addr=0x2.0x2 -device pcie-root-port,port=0x13,chassis=4,id=pci.4,bus=pcie.0,addr=0x2.0x3 -device pcie-root-port,port=0x14,chassis=5,id=pci.5,bus=pcie.0,addr=0x2.0x4 -device pcie-root-port,port=0x15,chassis=6,id=pci.6,bus=pcie.0,addr=0x2.0x5 -device pcie-root-port,port=0x16,chassis=7,id=pci.7,bus=pcie.0,addr=0x2.0x6 -device pcie-root-port,port=0x17,chassis=8,id=pci.8,bus=pcie.0,addr=0x2.0x7 -device qemu-xhci,p2=15,p3=15,id=usb,bus=pci.2,addr=0x0 -device virtio-scsi-pci,id=scsi0,bus=pci.7,addr=0x0 -device virtio-serial-pci,id=virtio-serial0,bus=pci.3,addr=0x0 -blockdev {"driver":"host_device","filename":"/dev/disk/by-id/dm-name-vg_staging-vpn_gate","aio":"native","node-name":"libvirt-3-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"} -blockdev {"node-name":"libvirt-3-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"raw","file":"libvirt-3-storage"} -device virtio-blk-pci,bus=pci.6,addr=0x0,drive=libvirt-3-format,id=virtio-disk0,bootindex=2,write-cache=on -blockdev {"driver":"host_device","filename":"/dev/disk/by-id/dm-name-vg_staging-vpn_gate_swap","aio":"native","node-name":"libvirt-2-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"} -blockdev {"node-name":"libvirt-2-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"raw","file":"libvirt-2-storage"} -device virtio-blk-pci,bus=pci.8,addr=0x0,drive=libvirt-2-format,id=virtio-disk1,write-cache=on -device ide-cd,bus=ide.0,id=sata0-0-0,bootindex=1 -netdev tap,fd=25,id=hostnet0,vhost=on,vhostfd=26 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=02:00:00:00:02:00,bus=pci.1,addr=0x0 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev socket,id=charchannel0,fd=27,server,nowait -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0 -chardev spicevmc,id=charchannel1,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel1,id=channel1,name=com.redhat.spice.0 -device usb-tablet,id=input0,bus=usb.0,port=1 -spice port=5900,addr=127.0.0.1,disable-ticketing,seamless-migration=on -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vram64_size_mb=0,vgamem_mb=16,max_outputs=1,bus=pcie.0,addr=0x1 -device ich9-intel-hda,id=sound0,bus=pcie.0,addr=0x1b -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=2 -chardev spicevmc,id=charredir1,name=usbredir -device usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=3 -device virtio-balloon-pci,id=balloon0,bus=pci.4,addr=0x0 -object rng-random,id=objrng0,filename=/dev/urandom -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.5,addr=0x0 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny -msg timestamp=on
qemu 2509 1 3 May10 ? 00:28:10 /usr/bin/qemu-system-x86_64 -name guest=gitea,debug-threads=on -S -object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-2-gitea/master-key.aes -machine pc-i440fx-3.1,accel=kvm,usb=off,vmport=off,dump-guest-core=off,memory-backend=pc.ram -cpu host,migratable=on -m 4096 -object memory-backend-ram,id=pc.ram,size=4294967296 -overcommit mem-lock=off -smp 2,sockets=2,cores=1,threads=1 -uuid fb902879-993e-4a99-90d7-36c0a0aeaa18 -no-user-config -nodefaults -chardev socket,id=charmonitor,fd=24,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 lsi,id=scsi0,bus=pci.0,addr=0xa -device ahci,id=sata0,bus=pci.0,addr=0x4 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x9 -blockdev {"driver":"host_device","filename":"/dev/disk/by-id/dm-name-vg_staging-gitea","aio":"native","node-name":"libvirt-3-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"} -blockdev {"node-name":"libvirt-3-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"raw","file":"libvirt-3-storage"} -device virtio-blk-pci,bus=pci.0,addr=0x7,drive=libvirt-3-format,id=virtio-disk0,bootindex=2,write-cache=on -blockdev {"driver":"host_device","filename":"/dev/disk/by-id/dm-name-vg_staging-gitea_swap","aio":"native","node-name":"libvirt-2-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"} -blockdev {"node-name":"libvirt-2-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"raw","file":"libvirt-2-storage"} -device virtio-blk-pci,bus=pci.0,addr=0x8,drive=libvirt-2-format,id=virtio-disk1,write-cache=on -device scsi-cd,bus=scsi0.0,scsi-id=0,device_id=drive-scsi0-0-0,id=scsi0-0-0,bootindex=1 -netdev tap,fd=27,id=hostnet0,vhost=on,vhostfd=28 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=02:00:00:00:00:00,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev socket,id=charchannel0,fd=29,server,nowait -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0 -device usb-tablet,id=input0,bus=usb.0,port=1 -spice port=5901,addr=127.0.0.1,disable-ticketing,image-compression=off,seamless-migration=on -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vram64_size_mb=0,vgamem_mb=16,max_outputs=1,bus=pci.0,addr=0x2 -chardev spicevmc,id=charredir0,name=usbredir -device usb-redir,chardev=charredir0,id=redir0,bus=usb.0,port=2 -chardev spicevmc,id=charredir1,name=usbredir -device usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=3 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6,deflate-on-oom=on -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny -msg timestamp=on
|
CONFIG_IKCONFIG is not set on the host and the gentoo guest, but here is the command run on the kernel's .config file.
Both the host and the Gentoo guest also have CONFIG_MODULES unset.
Host:
Code: | zgrep -E "(VIRTIO|KVM)" /boot/config-5.10.27-gentoo
CONFIG_KVM_GUEST=y
CONFIG_HAVE_KVM=y
CONFIG_HAVE_KVM_IRQCHIP=y
CONFIG_HAVE_KVM_IRQFD=y
CONFIG_HAVE_KVM_IRQ_ROUTING=y
CONFIG_HAVE_KVM_EVENTFD=y
CONFIG_KVM_MMIO=y
CONFIG_KVM_ASYNC_PF=y
CONFIG_HAVE_KVM_MSI=y
CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT=y
CONFIG_KVM_VFIO=y
CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT=y
CONFIG_HAVE_KVM_IRQ_BYPASS=y
CONFIG_HAVE_KVM_NO_POLL=y
CONFIG_KVM_XFER_TO_GUEST_WORK=y
CONFIG_KVM=y
CONFIG_KVM_WERROR=y
CONFIG_KVM_INTEL=y
# CONFIG_KVM_AMD is not set
# CONFIG_KVM_MMU_AUDIT is not set
# CONFIG_VIRTIO_CONSOLE is not set
# CONFIG_VIRTIO_MENU is not set
# CONFIG_RPMSG_VIRTIO is not set |
Gentoo Guest
Code: | zgrep -E "(VIRTIO|KVM)" /boot/config-5.10.27-gentoo
CONFIG_KVM_GUEST=y
CONFIG_HAVE_KVM=y
CONFIG_BLK_MQ_VIRTIO=y
CONFIG_VIRTIO_BLK=y
CONFIG_SCSI_VIRTIO=y
CONFIG_VIRTIO_NET=y
CONFIG_VIRTIO_CONSOLE=y
# CONFIG_HW_RANDOM_VIRTIO is not set
# CONFIG_DRM_VIRTIO_GPU is not set
CONFIG_VIRTIO=y
CONFIG_VIRTIO_MENU=y
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_PCI_LEGACY=y
CONFIG_VIRTIO_BALLOON=y
CONFIG_VIRTIO_MEM=y
CONFIG_VIRTIO_INPUT=y
CONFIG_VIRTIO_MMIO=y
CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y
# CONFIG_RPMSG_VIRTIO is not set
CONFIG_CRYPTO_DEV_VIRTIO=y |
Arch Guest
Code: | zgrep -E "(VIRTIO|KVM)" /proc/config.gz
CONFIG_KVM_GUEST=y
CONFIG_HAVE_KVM=y
CONFIG_HAVE_KVM_IRQCHIP=y
CONFIG_HAVE_KVM_IRQFD=y
CONFIG_HAVE_KVM_IRQ_ROUTING=y
CONFIG_HAVE_KVM_EVENTFD=y
CONFIG_KVM_MMIO=y
CONFIG_KVM_ASYNC_PF=y
CONFIG_HAVE_KVM_MSI=y
CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT=y
CONFIG_KVM_VFIO=y
CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT=y
CONFIG_KVM_COMPAT=y
CONFIG_HAVE_KVM_IRQ_BYPASS=y
CONFIG_HAVE_KVM_NO_POLL=y
CONFIG_KVM_XFER_TO_GUEST_WORK=y
CONFIG_KVM=m
CONFIG_KVM_INTEL=m
CONFIG_KVM_AMD=m
CONFIG_KVM_AMD_SEV=y
CONFIG_KVM_XEN=y
CONFIG_KVM_MMU_AUDIT=y
CONFIG_BLK_MQ_VIRTIO=y
CONFIG_VIRTIO_VSOCKETS=m
CONFIG_VIRTIO_VSOCKETS_COMMON=m
CONFIG_NET_9P_VIRTIO=m
CONFIG_VIRTIO_BLK=m
CONFIG_SCSI_VIRTIO=m
CONFIG_VIRTIO_NET=m
CONFIG_VIRTIO_CONSOLE=m
CONFIG_HW_RANDOM_VIRTIO=m
CONFIG_PTP_1588_CLOCK_KVM=m
CONFIG_DRM_I915_GVT_KVMGT=m
CONFIG_DRM_VIRTIO_GPU=m
CONFIG_VIRTIO=y
CONFIG_VIRTIO_PCI_LIB=m
CONFIG_VIRTIO_MENU=y
CONFIG_VIRTIO_PCI=m
CONFIG_VIRTIO_PCI_LEGACY=y
CONFIG_VIRTIO_VDPA=m
CONFIG_VIRTIO_PMEM=m
CONFIG_VIRTIO_BALLOON=m
CONFIG_VIRTIO_MEM=m
CONFIG_VIRTIO_INPUT=m
CONFIG_VIRTIO_MMIO=m
CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y
CONFIG_VIRTIO_DMA_SHARED_BUFFER=m
CONFIG_RPMSG_VIRTIO=m
CONFIG_VIRTIO_FS=m
CONFIG_CRYPTO_DEV_VIRTIO=m |
Host
Code: | Linux x3650-sean 5.10.27-gentoo #11 SMP Thu May 6 21:01:33 -00 2021 x86_64 Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz GenuineIntel GNU/Linux |
Gentoo Guest
Code: | Linux gitea 5.10.27-gentoo #3 SMP Wed May 5 10:53:54 UTC 2021 x86_64 Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz GenuineIntel GNU/Linux |
Arch Guest
Code: | Linux vpn-gate 5.12.1-arch1-1 #1 SMP PREEMPT Sun, 02 May 2021 12:43:58 +0000 x86_64 GNU/Linux
|
|
|
Back to top |
|
|
mike155 Advocate
Joined: 17 Sep 2010 Posts: 4438 Location: Frankfurt, Germany
|
Posted: Wed May 12, 2021 4:42 pm Post subject: |
|
|
- There are differences in the way your virtual machines are started:
Code: | -machine pc-q35-5.2
-machine pc-i440fx-3.1
-cpu SandyBridge,vme=on,ss=on,vmx=on,pdcm=on,pcid=on,hypervisor=on,arat=on,tsc-adjust=on,umip=on,arch-capabilities=on,xsaveopt=on,pdpe1gb=on,skip-l1dfl-vmentry=on,pschange-mc-no=on
-cpu host,migratable=on
-m 1024
-m 4096
-smp 1,sockets=1,cores=1,threads=1
-smp 2,sockets=2,cores=1,threads=1
-device virtio-balloon-pci,id=balloon0,bus=pci.4,addr=0x0
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6,deflate-on-oom=on |
Make sure that the two VMs are started in exactly the same way and with the same QEMU/KVM parameters.
There are many differences in the kernel config parameters of the two guest machines. Change the kernel config of one of your guest machines so that it matches the config of the other VM.
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|