vmm: Add virtio-pmem support to cloud-hypervisor

This patch plumbs the virtio-pmem device to the VMM. By adding a new
command line option "--pmem", we can now expose some persistent memory
to the guest OS, backed by the provided source.

The point of having such support in cloud-hypervisor is to be able to
share some memory between the host and the guest as DAXable.
One interesting use case is to boot directly from an image passed
through virtio-pmem, instead of going through virtio-blk. This can
allow good performances while avoiding the guest cache, which would
prevent the VM memory footprint from growing too much.

Fixes #68

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2019-06-19 13:48:37 -07:00
committed by Rob Bradford
parent 8862d61042
commit 294c26bfb7
3 changed files with 130 additions and 1 deletions

View File

@@ -77,6 +77,15 @@ fn main() {
.takes_value(true)
.min_values(1),
)
.arg(
Arg::with_name("pmem")
.long("pmem")
.help(
"Persistent memory parameters \"file=<backing_file_path>,\
size=<persistent_memory_size>\"",
)
.takes_value(true),
)
.get_matches();
// These .unwrap()s cannot fail as there is a default value defined
@@ -101,6 +110,8 @@ fn main() {
let fs: Option<Vec<&str>> = cmd_arguments.values_of("fs").map(|x| x.collect());
let pmem = cmd_arguments.value_of("pmem");
let vm_config = match config::VmConfig::parse(config::VmParams {
cpus,
memory,
@@ -110,6 +121,7 @@ fn main() {
net,
rng,
fs,
pmem,
}) {
Ok(config) => config,
Err(e) => {