If a VM uses PCI(e) passthrough, ballooning does not work as expected: The QEMU process will always consume the full memory amount given in `memory`, even if `balloon` is set to a smaller (non-zero) amount. The reason is that the PCI device might use DMA, so QEMU needs to map the complete guest memory on startup. However, users may not be aware of that (see e.g. [0]).
To make users aware of the limitation, warn on VM start if at least one PCI device is passed through and ballooning is enabled (and `balloon` != `memory`). [0] https://forum.proxmox.com/threads/134202/ Signed-off-by: Friedrich Weber <f.we...@proxmox.com> --- Notes: I did not test this on a "real" PCI passthrough setup as I don't have one at hand, but Markus tested (an earlier version) of this patch on his machine. PVE/QemuServer.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index dbcd568..70983a4 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -5789,6 +5789,16 @@ sub vm_start_nolock { die $err; } + if ( + scalar(%$pci_devices) + && defined($conf->{balloon}) + && $conf->{balloon} != 0 + && $conf->{balloon} != $memory + ) { + log_warn("Ballooning is not possible when using PCI(e) passthrough, " + ."VM will use maximum configured memory ($memory MiB).\n"); + } + PVE::Storage::activate_volumes($storecfg, $vollist); -- 2.39.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel