[PATCH kvmtool v1 2/2] Align the calculated guest ram size to the host's page size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If host_ram_size() * RAM_SIZE_RATIO does not result in a value
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: 18bd8c3bd2a7 ("kvm tools: Don't use all of host RAM for guests by default")
Signed-off-by: Fuad Tabba <tabba@xxxxxxxxxx>
---
 builtin-run.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin-run.c b/builtin-run.c
index 2801735..ff8ba0b 100644
--- a/builtin-run.c
+++ b/builtin-run.c
@@ -406,7 +406,7 @@ static u64 get_ram_size(int nr_cpus)
 	if (ram_size > available)
 		ram_size	= available;
 
-	return ram_size;
+	return ALIGN(ram_size, host_page_size());
 }
 
 static const char *find_kernel(void)
-- 
2.41.0.255.g8b1d071c50-goog




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux