Commit graph

9 commits

Author SHA1 Message Date
Shintaro Kawamura
67390a05fb Reland "swap: add userfaultfd wrapper"
origin:
https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3895235

userfaultfd enables applications to handle page faults on designated
memory area.

vmm-swap feature uses userfaultfd to catch page fault event and swap
in the guest memory from the swap file.

design document: go/tanooki-phase1-dd

BUG=b:215093219
TEST=cargo build --features=swap

Change-Id: I36ecfe9be988a4bc451f8edaf2ab48e25c6600f4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4016142
Commit-Queue: Shin Kawamura <kawasin@google.com>
Reviewed-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-11-14 06:14:07 +00:00
Shin Kawamura
eb5c9ffef9 Revert "swap: add userfaultfd wrapper"
Revert submission 3935683

Reason for revert: userfaultfd-sys fails to build on windows
Reverted Changes:
Icf46cfb26:swap: add PageHandler
I408dbfa4d:base: unix: add fork_process
Ie62a0cf53:swap: suspend device processes using SIGSTOP signa...
I4ce16eef3:swap: add swap file
I13ae09cd9:swap: add userfaultfd wrapper

Change-Id: Ic815d0a73a0b2db6a33ed9d87025643a106183d2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4015885
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-11-09 06:02:39 +00:00
Shin Kawamura
35c9c13c65 Revert "swap: add swap file"
Revert submission 3935683

Reason for revert: userfaultfd-sys fails to build on windows
Reverted Changes:
Icf46cfb26:swap: add PageHandler
I408dbfa4d:base: unix: add fork_process
Ie62a0cf53:swap: suspend device processes using SIGSTOP signa...
I4ce16eef3:swap: add swap file
I13ae09cd9:swap: add userfaultfd wrapper

Change-Id: I6f323046726edf0d2006de99a2c07ee2956efda6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4015884
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-11-09 06:02:39 +00:00
Shin Kawamura
444ddb868c Revert "swap: add PageHandler"
Revert submission 3935683

Reason for revert: userfaultfd-sys fails to build on windows
Reverted Changes:
Icf46cfb26:swap: add PageHandler
I408dbfa4d:base: unix: add fork_process
Ie62a0cf53:swap: suspend device processes using SIGSTOP signa...
I4ce16eef3:swap: add swap file
I13ae09cd9:swap: add userfaultfd wrapper

Change-Id: I1db78f57a91968f17d8b27bbbfc574e14adea65b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4015883
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-11-09 06:02:39 +00:00
Shin Kawamura
55d99500a9 Revert "swap: suspend device processes using SIGSTOP signal"
Revert submission 3935683

Reason for revert: userfaultfd-sys fails to build on windows
Reverted Changes:
Icf46cfb26:swap: add PageHandler
I408dbfa4d:base: unix: add fork_process
Ie62a0cf53:swap: suspend device processes using SIGSTOP signa...
I4ce16eef3:swap: add swap file
I13ae09cd9:swap: add userfaultfd wrapper

Change-Id: Ia3675a8e0439de38db55a8cd0098bbc331230e8b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4015882
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-11-09 06:02:39 +00:00
Shintaro Kawamura
427f1becb9 swap: suspend device processes using SIGSTOP signal
ProcessesGuard stops all the crosvm processes except the caller process
using SIGSTOP signal because we must guarantee that no one changes the
guest memory contents while vmm-swap out.

This is a short term solution and will be replaced with device
suspension feature later.

See the "Write back atomicity" section in go/tanooki-phase1-dd

BUG=b:215093219
TEST=cargo build --features=swap

Change-Id: Ie62a0cf537a045128c0d298e7a73d222fea96ef0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3932497
Reviewed-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-11-09 05:24:08 +00:00
Shintaro Kawamura
0d94c42c56 swap: add PageHandler
PageHandler handles events from userfaultfd using SwapFile.

design document: go/tanooki-phase1-dd

BUG=b:215093219
TEST=cargo test -p swap page_handler

Change-Id: Icf46cfb26670ff4488d783c3623f280ccc89457a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3944711
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: David Stevens <stevensd@chromium.org>
2022-11-09 05:24:08 +00:00
Shintaro Kawamura
e8aaafffcf swap: add swap file
SwapFile saves the active pages in the memory region to a file.

design document: go/tanooki-phase1-dd

BUG=b:215093219
TEST=cargo test -p swap

Change-Id: I4ce16eef36ace832d26622e44444f7549299c1e7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3930082
Reviewed-by: David Stevens <stevensd@chromium.org>
2022-11-09 05:24:08 +00:00
Shintaro Kawamura
b75d3bc45e swap: add userfaultfd wrapper
userfaultfd enables applications to handle page faults on designated
memory area.

vmm-swap feature uses userfaultfd to catch page fault event and swap
in the guest memory from the swap file.

design document: go/tanooki-phase1-dd

BUG=b:215093219
TEST=cargo build --features=swap

Change-Id: I13ae09cd97e4215b00e5d834d4f97eb6b507b892
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3895235
Reviewed-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-11-09 05:24:08 +00:00