UPSTREAM: crosvm: snapshot-restore support for kvm clock

When kvm clock is available, Linux (6.1 at least) uses it for the
scheduling clock (among other things) even when the TSC is configured as
the primary clock source. When restoring a VM, if we don't make a
KVM_SET_CLOCK call, kvm clock's value will rollback to zero and cause
trouble.

`ClockState::flags` was deleted because it had no existing uses, it
isn't useable in any hypervisor generic way, and because it will result
in incorrect behavior for snapshotting. The set of valid flags returned
by KVM_GET_CLOCK is not the same as the set of valid flags that can be
passed to KVM_SET_CLOCK.

Test: snapshot and restore CF
Bug: 339527192
Change-Id: I57503e72499a44e98e0c6ca93eb8cb01cb21c16d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5530677
Reviewed-by: Elie Kheirallah <khei@google.com>
Commit-Queue: Frederick Mayle <fmayle@google.com>
6 files changed
tree: 4a8d3b73cb182de0d2ecfde18ab8782ee3d392ce
  1. .cargo/
  2. .config/
  3. .devcontainer/
  4. .github/
  5. .vscode/
  6. aarch64/
  7. acpi_tables/
  8. arch/
  9. argh_helpers/
  10. audio_streams_conformance_test/
  11. audio_util/
  12. base/
  13. bit_field/
  14. broker_ipc/
  15. common/
  16. cros_async/
  17. cros_fdt/
  18. cros_tracing/
  19. cros_tracing_types/
  20. crosvm_cli/
  21. crosvm_control/
  22. crosvm_plugin/
  23. cuttlefish/
  24. devices/
  25. disk/
  26. docs/
  27. e2e_tests/
  28. fuse/
  29. fuzz/
  30. gpu_display/
  31. hypervisor/
  32. infra/
  33. io_uring/
  34. jail/
  35. kernel_cmdline/
  36. kernel_loader/
  37. kvm/
  38. kvm_sys/
  39. libcras_stub/
  40. linux_input_sys/
  41. logo/
  42. media/
  43. metrics/
  44. metrics_events/
  45. net_sys/
  46. net_util/
  47. patches/
  48. perfetto/
  49. power_monitor/
  50. prebuilts/
  51. proto_build_tools/
  52. protos/
  53. resources/
  54. riscv64/
  55. rutabaga_gfx/
  56. sandbox/
  57. serde_keyvalue/
  58. src/
  59. swap/
  60. system_api/
  61. tests/
  62. third_party/
  63. tools/
  64. tube_transporter/
  65. usb_sys/
  66. usb_util/
  67. vendor/
  68. vfio_sys/
  69. vhost/
  70. virtio_sys/
  71. vm_control/
  72. vm_memory/
  73. win_audio/
  74. win_util/
  75. x86_64/
  76. .dockerignore
  77. .envrc
  78. .gitattributes
  79. .gitignore
  80. .rustfmt.toml
  81. android-fork-stats.sh
  82. android-merge-1-setup.sh
  83. android-merge-2-cargo-embargo.sh
  84. Android.bp
  85. ARCHITECTURE.md
  86. Cargo.lock
  87. Cargo.toml
  88. cargo2android_defaults.bp
  89. cargo2android_module.bp.patch
  90. cargo_embargo.json
  91. CONTRIBUTING.md
  92. DIR_METADATA
  93. LICENSE
  94. METADATA
  95. mypy.ini
  96. OWNERS
  97. OWNERS.android
  98. OWNERS_COUNCIL
  99. PRESUBMIT.cfg
  100. PREUPLOAD.cfg
  101. pyproject.toml
  102. README.chromeos.md
  103. README.md
  104. rust-toolchain
  105. TEST_MAPPING
README.md

crosvm - The ChromeOS Virtual Machine Monitor

crosvm is a virtual machine monitor (VMM) based on Linux’s KVM hypervisor, with a focus on simplicity, security, and speed. crosvm is intended to run Linux guests, originally as a security boundary for running native applications on the ChromeOS platform. Compared to QEMU, crosvm doesn’t emulate architectures or real hardware, instead concentrating on paravirtualized devices, such as the virtio standard.

crosvm is currently used to run Linux/Android guests on ChromeOS devices.

Logo