[PATCH 18/22] host/start-vm: increase memory size to 512M

Alyssa Ross
2022-10-10T23:33:04Z

To be able to run Nix builds inside a VM, we need more memory.
Eventually, of course, we will want to not have a single static memory
size for all VMs, but this is fine for now as I have tested all that I
can still run all default VMs, plus one running a Nix build, in the
test VM with 2G of memory with this change.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
host/start-vm/lib.rs | 2 +-
host/start-vm/tests/vm_command-basic.rs | 2 +-
img/app/Makefile | 6 +++---
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/host/start-vm/lib.rs b/host/start-vm/lib.rs
index f167efe..1946c65 100644
--- a/host/start-vm/lib.rs
+++ b/host/start-vm/lib.rs
@@ -50,7 +50,7 @@ pub fn vm_command(dir: PathBuf, root: &Root) -> Result<Command, String> {
command.arg("cloud-hypervisor");
command.args(&["--api-socket", "env/cloud-hypervisor.sock"]);
command.args(&["--cmdline", "console=ttyS0 root=PARTLABEL=root"]);
- command.args(&["--memory", "size=128M,shared=on"]);
+ command.args(&["--memory", "size=512M,shared=on"]);
command.args(&["--console", "pty"]);

command.arg("--kernel");
diff --git a/host/start-vm/tests/vm_command-basic.rs b/host/start-vm/tests/vm_command-basic.rs
index 234f6e3..311c2af 100644
--- a/host/start-vm/tests/vm_command-basic.rs
+++ b/host/start-vm/tests/vm_command-basic.rs
@@ -39,7 +39,7 @@ fn main() -> std::io::Result<()> {
OsStr::new("--cmdline"),
OsStr::new("console=ttyS0 root=PARTLABEL=root"),
OsStr::new("--memory"),
- OsStr::new("size=128M,shared=on"),
+ OsStr::new("size=512M,shared=on"),
OsStr::new("--console"),
OsStr::new("pty"),
OsStr::new("--kernel"),
diff --git a/img/app/Makefile b/img/app/Makefile
index 259e819..cb3af71 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -106,7 +106,7 @@ start-virtiofsd:
.PHONY: start-virtiofsd

run-qemu: build/host/appvm/blk/root.img start-virtiofsd
- $(QEMU_KVM) -m 128 -cpu host -machine q35,kernel=$(KERNEL) -vga none \
+ $(QEMU_KVM) -m 512 -cpu host -machine q35,kernel=$(KERNEL) -vga none \
-drive file=build/host/appvm/blk/root.img,if=virtio,format=raw,readonly=on \
-drive file=$(RUN_IMG),if=virtio,format=raw,readonly=on \
-append "console=ttyS0 root=PARTLABEL=root" \
@@ -114,7 +114,7 @@ run-qemu: build/host/appvm/blk/root.img start-virtiofsd
-device virtio-net,netdev=net0,mac=0A:B3:EC:00:00:00 \
-chardev socket,id=virtiofsd,path=virtiofsd.sock \
-device vhost-user-fs-pci,chardev=virtiofsd,tag=virtiofs0 \
- -object memory-backend-memfd,id=mem,size=128M,share=on \
+ -object memory-backend-memfd,id=mem,size=512M,share=on \
-numa node,memdev=mem \
-chardev vc,id=virtiocon0 \
-device virtio-serial-pci \
@@ -124,7 +124,7 @@ run-qemu: build/host/appvm/blk/root.img start-virtiofsd
run-cloud-hypervisor: build/host/appvm/blk/root.img start-virtiofsd
$(CLOUD_HYPERVISOR) \
--api-socket path=vmm.sock \
- --memory size=128M,shared=on \
+ --memory size=512M,shared=on \
--disk path=build/host/appvm/blk/root.img,readonly=on \
path=$(RUN_IMG),readonly=on \
--net tap=tap0,mac=0A:B3:EC:00:00:00 \
--
2.37.1