Apply scaling down the calculated guest ram size to the number of pages
Calculate the guest ram size based a ratio proportional to the number of pages available, rather than the amount of memory available in bytes, in the host. This is to ensure that the result is always page-aligned. If the result of get_ram_size() isn't aligned to the host page size, it triggers an error in __kvm_set_memory_region(), called via the KVM_SET_USER_MEMORY_REGION ioctl, which requires the size to be page-aligned. Fixes: 18bd8c3b ("kvm tools: Don't use all of host RAM for guests by default") Signed-off-by:Fuad Tabba <tabba@google.com> Link: https://lore.kernel.org/r/20230717121232.3559948-4-tabba@google.com Signed-off-by:
Will Deacon <will@kernel.org>
Loading
Please register or sign in to comment