Skip to content
Commit 63643b11 authored by Fuad Tabba's avatar Fuad Tabba Committed by Will Deacon
Browse files

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: default avatarFuad Tabba <tabba@google.com>
Link: https://lore.kernel.org/r/20230717121232.3559948-4-tabba@google.com


Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent 834e5ed6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment