virtio-fs: Deprecate the DAX feature

Disable the DAX feature from the virtio-fs implementation as the feature
is still not stable. The feature is deprecated, meaning the 'dax'
parameter will be removed in about 2 releases cycles.

In the meantime, the parameter value is ignored and forced to be
disabled.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2022-03-24 15:11:00 +01:00 committed by Bo Chen
parent fd40aceabb
commit afd9f17b73
5 changed files with 19 additions and 190 deletions

View File

@ -74,24 +74,6 @@ system, here is the Cloud Hypervisor command you need to run:
--fs tag=myfs,socket=/tmp/virtiofs,num_queues=1,queue_size=512
```
By default, DAX is enabled with a cache window of 8GiB. You can specify a custom
size (let's say 4GiB for this example) for the cache by explicitly setting DAX
and the cache size:
```bash
--fs tag=myfs,socket=/tmp/virtiofs,num_queues=1,queue_size=512,dax=on,cache_size=4G
```
In case you don't want to use a shared window of cache to pass the shared files
content, this means you will have to explicitly disable DAX with `dax=off`.
Note that in this case, the `cache_size` parameter will be ignored.
```bash
--fs tag=myfs,socket=/tmp/virtiofs,num_queues=1,queue_size=512,dax=off
```
### Mount the shared directory
The last step is to mount the shared directory inside the guest, using the
@ -99,20 +81,13 @@ The last step is to mount the shared directory inside the guest, using the
```bash
mkdir mount_dir
mount -t virtiofs -o dax myfs mount_dir/
mount -t virtiofs myfs mount_dir/
```
The `tag` needs to be consistent with what has been provided through the
Cloud Hypervisor command line, which happens to be `myfs` in this example.
The `-o dax` option must be removed in case the shared cache region is not
enabled from the VMM.
## DAX feature
The filesystem should be mounted with `dax` by default as it bypasses the guest
page cache, reducing the footprint on host memory. When running multiple virtual
machines on the same host, this will let the host deal with page cache, which
will increase the density of virtual machines which can be launched.
When the filesystem is not mounted with the `dax` option, the guest page cache
is used, which can result in better performance for the guest's workload at the
cost of increasing the footprint on host memory.
Given the DAX feature is not stable yet from a daemon standpoint, it is not
available in Cloud Hypervisor.

View File

@ -1258,125 +1258,6 @@ mod unit_tests {
}"#,
true,
),
(
vec![
"cloud-hypervisor", "--kernel", "/path/to/kernel",
"--memory", "shared=true", "--cpus", "boot=4",
"--fs",
"tag=virtiofs1,socket=/path/to/sock1,num_queues=4,queue_size=128,dax=on"
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"memory" : { "shared": true, "size": 536870912 },
"cpus": {"boot_vcpus": 4, "max_vcpus": 4},
"fs": [
{"tag": "virtiofs1", "socket": "/path/to/sock1", "num_queues": 4, "queue_size": 128}
]
}"#,
true,
),
(
vec![
"cloud-hypervisor", "--kernel", "/path/to/kernel",
"--memory", "shared=true", "--cpus", "boot=4",
"--fs",
"tag=virtiofs1,socket=/path/to/sock1,num_queues=4,queue_size=128,dax=on"
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"memory" : { "shared": true, "size": 536870912 },
"cpus": {"boot_vcpus": 4, "max_vcpus": 4},
"fs": [
{"tag": "virtiofs1", "socket": "/path/to/sock1", "num_queues": 4, "queue_size": 128, "dax": true}
]
}"#,
true,
),
(
vec![
"cloud-hypervisor", "--kernel", "/path/to/kernel",
"--memory", "shared=true", "--cpus", "boot=4",
"--fs",
"tag=virtiofs1,socket=/path/to/sock1,num_queues=4,queue_size=128"
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"memory" : { "shared": true, "size": 536870912 },
"cpus": {"boot_vcpus": 4, "max_vcpus": 4},
"fs": [
{"tag": "virtiofs1", "socket": "/path/to/sock1", "num_queues": 4, "queue_size": 128, "dax": true}
]
}"#,
true,
),
(
vec![
"cloud-hypervisor", "--kernel", "/path/to/kernel",
"--memory", "shared=true", "--cpus", "boot=4",
"--fs",
"tag=virtiofs1,socket=/path/to/sock1,num_queues=4,queue_size=128,cache_size=8589934592"
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"memory" : { "shared": true, "size": 536870912 },
"cpus": {"boot_vcpus": 4, "max_vcpus": 4},
"fs": [
{"tag": "virtiofs1", "socket": "/path/to/sock1", "num_queues": 4, "queue_size": 128}
]
}"#,
true,
),
(
vec![
"cloud-hypervisor", "--kernel", "/path/to/kernel",
"--memory", "shared=true", "--cpus", "boot=4",
"--fs",
"tag=virtiofs1,socket=/path/to/sock1,num_queues=4,queue_size=128"
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"memory" : { "shared": true, "size": 536870912 },
"cpus": {"boot_vcpus": 4, "max_vcpus": 4},
"fs": [
{"tag": "virtiofs1", "socket": "/path/to/sock1", "num_queues": 4, "queue_size": 128, "cache_size": 8589934592}
]
}"#,
true,
),
(
vec![
"cloud-hypervisor", "--kernel", "/path/to/kernel",
"--memory", "shared=true","--cpus", "boot=4",
"--fs",
"tag=virtiofs1,socket=/path/to/sock1,num_queues=4,queue_size=128,cache_size=4294967296"
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"memory" : { "shared": true, "size": 536870912 },
"cpus": {"boot_vcpus": 4, "max_vcpus": 4},
"fs": [
{"tag": "virtiofs1", "socket": "/path/to/sock1", "num_queues": 4, "queue_size": 128, "cache_size": 4294967296}
]
}"#,
true,
),
(
vec![
"cloud-hypervisor", "--kernel", "/path/to/kernel",
"--memory", "shared=true","--cpus", "boot=4",
"--fs",
"tag=virtiofs1,socket=/path/to/sock1,num_queues=4,queue_size=128,cache_size=4294967296"
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"memory" : { "shared": true, "size": 536870912 },
"cpus": {"boot_vcpus": 4, "max_vcpus": 4},
"fs": [
{"tag": "virtiofs1", "socket": "/path/to/sock1", "num_queues": 4, "queue_size": 128}
]
}"#,
false,
),
]
.iter()
.for_each(|(cli, openapi, equal)| {

View File

@ -2797,36 +2797,11 @@ mod parallel {
handle_child_output(r, &output);
}
#[test]
#[cfg(not(feature = "mshv"))]
fn test_virtio_fs_dax_on_default_cache_size() {
test_virtio_fs(true, None, "never", &prepare_virtiofsd, false, None)
}
#[test]
#[cfg(not(feature = "mshv"))]
fn test_virtio_fs_dax_on_cache_size_1_gib() {
test_virtio_fs(
true,
Some(0x4000_0000),
"never",
&prepare_virtiofsd,
false,
None,
)
}
#[test]
fn test_virtio_fs_dax_off() {
test_virtio_fs(false, None, "never", &prepare_virtiofsd, false, None)
}
#[test]
#[cfg(not(feature = "mshv"))]
fn test_virtio_fs_hotplug_dax_on() {
test_virtio_fs(true, None, "never", &prepare_virtiofsd, true, None)
}
#[test]
fn test_virtio_fs_hotplug_dax_off() {
test_virtio_fs(false, None, "never", &prepare_virtiofsd, true, None)
@ -2835,27 +2810,13 @@ mod parallel {
#[test]
#[cfg(not(feature = "mshv"))]
fn test_virtio_fs_multi_segment_hotplug() {
test_virtio_fs(
true,
Some(0x4000_0000),
"never",
&prepare_virtiofsd,
true,
Some(15),
)
test_virtio_fs(false, None, "never", &prepare_virtiofsd, true, Some(15))
}
#[test]
#[cfg(not(feature = "mshv"))]
fn test_virtio_fs_multi_segment() {
test_virtio_fs(
true,
Some(0x4000_0000),
"never",
&prepare_virtiofsd,
false,
Some(15),
)
test_virtio_fs(false, None, "never", &prepare_virtiofsd, false, Some(15))
}
#[test]

View File

@ -1530,7 +1530,7 @@ fn default_fsconfig_queue_size() -> u16 {
}
fn default_fsconfig_dax() -> bool {
true
false
}
fn default_fsconfig_cache_size() -> u64 {
@ -1635,6 +1635,15 @@ impl FsConfig {
}
}
if self.dax {
// TODO: Remove the dax parameter.
// Tracked by https://github.com/cloud-hypervisor/cloud-hypervisor/issues/3889
warn!(
"The experimental DAX feature is deprecated and will be \
removed in a future release. A request to enable it is ignored."
);
}
Ok(())
}
}

View File

@ -2395,6 +2395,9 @@ impl DeviceManager {
None
};
// DAX is not supported, we override the config by disabling the option.
fs_cfg.dax = false;
if let Some(fs_socket) = fs_cfg.socket.to_str() {
let cache = if fs_cfg.dax {
let (cache_base, cache_size) = if let Some((base, size)) = cache_range {