[PATCH 01/22] host/start-vm: use MAP_SHARED memory for VMs

Alyssa Ross
2022-10-10T23:32:34Z

This is required for any use of vhost-user. Since any VM might have a
vhost-user device hotplugged, this needs to be on from the start for
all VMs.

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

diff --git a/host/start-vm/lib.rs b/host/start-vm/lib.rs
index ef79091..9a92ab7 100644
--- a/host/start-vm/lib.rs
+++ b/host/start-vm/lib.rs
@@ -44,7 +44,7 @@ pub fn vm_command(dir: PathBuf, config_root: &Path) -> 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"]);
+ command.args(&["--memory", "size=128M,shared=on"]);
command.args(&["--console", "pty"]);
command.arg("--kernel");
command.arg(config_dir.join("vmlinux"));
diff --git a/host/start-vm/tests/vm_command-basic.rs b/host/start-vm/tests/vm_command-basic.rs
index b9585f9..4145b94 100644
--- a/host/start-vm/tests/vm_command-basic.rs
+++ b/host/start-vm/tests/vm_command-basic.rs
@@ -37,7 +37,7 @@ fn main() -> std::io::Result<()> {
OsStr::new("--cmdline"),
OsStr::new("console=ttyS0 root=PARTLABEL=root"),
OsStr::new("--memory"),
- OsStr::new("size=128M"),
+ OsStr::new("size=128M,shared=on"),
OsStr::new("--console"),
OsStr::new("pty"),
OsStr::new("--kernel"),
--
2.37.1