From a3411eaac1ad3d51d5282d1462d6764ad539ce13 Mon Sep 17 00:00:00 2001 From: Jakub Staron Date: Wed, 24 Apr 2019 10:55:25 -0700 Subject: crosvm: virtio-pmem device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds support for virtio-pmem device as an alternative for virtio-blk. Exposing disk image to guest as virtio-blk device results in both guest and host independently caching the disk I/O. Using virtio-pmem device allows to mount disk image as direct access (DAX) in the guest and thus bypass the guest cache. This will reduce memory foodprint of the VMs. BUG=None TEST=cargo test TEST=Boot patched termina kernel in crosvm; mount virtio-pmem device as DAX and run xfstests. Change-Id: I935fc8fc7527f79e5169f07ec7927e4ea4fa6027 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1605517 Tested-by: kokoro Reviewed-by: Zach Reizner Commit-Queue: Jakub StaroĊ„ --- sys_util/src/mmap.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sys_util') diff --git a/sys_util/src/mmap.rs b/sys_util/src/mmap.rs index 9f573e4..3d1e577 100644 --- a/sys_util/src/mmap.rs +++ b/sys_util/src/mmap.rs @@ -82,6 +82,12 @@ impl Protection { Protection(libc::PROT_READ | libc::PROT_WRITE) } + /// Returns Protection allowing read access. + #[inline(always)] + pub fn read() -> Protection { + Protection(libc::PROT_READ) + } + /// Set read events. #[inline(always)] pub fn set_read(self) -> Protection { -- cgit 1.4.1