On Fri, Sep 15, 2023 at 02:41:50AM +0100, Daniel Krajnik wrote: > Hi > > I'm trying to Passthrough a GPU to a VM and have it still share its free > memory with the host (just like it would with virtio-balloon). Is this > something virtio-mem is capable of? I've tried to run it, but it immediately > took over 9GB of memory: > > virt-install --name test --cpu > cell0.cpus=0,cell0.memory=4194304,cell1.cpus=1,cell1.memory=4194304 --memory > maxMemory=65536,maxMemory.slots=8 --memdev > model=virtio-mem,target.node=0,target.block=2048,target.size=1000 --disk > size=400 --network network=ai > --location=/tmp/debian-12.1.0-amd64-netinst.iso --os-variant=debian11 > --graphics none --extra-args "console=ttyS0
When using PCI device assignment, the VFIO driver requires that libvit pin guest memory into RAM https://gitlab.com/libvirt/libvirt/-/blob/19484ccac5cb1586f9d10d3e6eb9b93ee82885c6/src/qemu/qemu_domain.c#L9567 so that's why you'll see the immediate memory usage. I dont' think there's any way to workaround this limitation automatically. Closest you can get is to actually hot-unplug the RAM your guest isn't using, but that needs manual work to re-hot-plug it if the guest later needs more RAM, so that's not very friendly. With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|