Commit graph

2751 commits

Author SHA1 Message Date
Dennis Kempin
8a1277de1a Kokoro: Rebase changes to ToT before testing
By default Kokoro will use changes as they come from gerrit, which may
have an outdated parent. We want to make sure that we are always testing
against tip of tree so we are confident the presubmit test result will
reflect the postsubmit results.

BUG=b:202275156
TEST=Tested in Kokoro

Change-Id: I2a1d2860a361eee741dc522c9859e32890ff15bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3229947
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-10-19 17:10:04 +00:00
Dennis Kempin
76e6fd051b Fix push-to-github Kokoro builder
One more fix. Everything seems to work, but the remote is rejecting
an update of the active main branch. Hopefully the last fix needed.

BUG=b:199692764
TEST=Testing in prod.

Change-Id: I4f341cc374080454317cb3ac29cade59fec6aeee
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3229958
Tested-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-10-18 23:22:27 +00:00
Dennis Kempin
2d50ccb4a7 Fix push-to-github kokoro build
We were in the wrong directory.

BUG=b:199692764
TEST=Testing in prod...

Change-Id: Idbc60f7f6084109220186e56cd7fad2e6553da9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3229950
Tested-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-10-18 22:00:22 +00:00
Dennis Kempin
49c169a410 Add push-to-github kokoro config and script
This is hard to test. I verified that kokoro can access
the github token and use it to access github by adding
a git clone into the x86 presubmit build file in patchset 3.

But we can only really test the full process by submitting this
CL and have it pass through the continuous builder.

BUG=b:199692764
TEST=Needs to be tested in prod...

Change-Id: Ifdcd385552c61ecea75a43fb71b08950e8b036ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3229941
Tested-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-10-18 21:37:58 +00:00
Dennis Kempin
1b284f8dcd Docs: Update linux build instructions for new tooling
BUG=b:199951064
TEST=None

Change-Id: I7518790461f43a97db007eda86f56027f527ec95
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3226277
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-10-18 20:10:43 +00:00
Dennis Kempin
d1dbefc9dc Integrate new container and test runner with Kokoro
This replaces the existing tooling at ./ci/ with the new tooling
at ./tools.

BUG=b:199951064
TEST=./ci/kokoro/simulate_all

Change-Id: Id0296d5a46ca0f3eb0f655d85d1aed801ee3b434
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3226275
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-10-18 20:10:42 +00:00
Dennis Kempin
ee56b2ddec Add presubmit script
Consolidates the utility scripts from bin/ into tools/.
Adds a 'presubmit' utility script to run a set of checks and
tests.

This won't be a git hook, but can be manually used to verify
changes before uploading.

BUG=b:199951064
TEST=./tools/presubmit --quick
./tools/dev_container ./tools/presubmit

Change-Id: Iac7c11fca0beaa6d4f214319149ef385fa5ced70
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3225139
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2021-10-18 20:10:41 +00:00
Dennis Kempin
18724772c2 Add test runner ./tools/run_tests
The new runner makes use of the simplified crosvm build and greatly
improves execution speed by gathering test binaries from cargo output
and executes them directly in parallel.

This allows all of our tests to execute in ~5 seconds when run locally.

The new test runner also makes use of the new testvm tools to make it
easy to switch between testing on the host, in a VM or via SSH on a
remote device.

See ./tools/run_tests --help for usage instructions.

To allow more iterative testing with the same test targets, this CL
includes a set_test_target script to write env vars that instruct cargo
to build for the target arch and run on the test target.

Note: The test runner can build for armhf, but we need build file fixed
to allow armhf to build successfully.

BUG=b:199951064
TEST=Inside ./tools/dev_container:
./tools/run_tests --target=host
./tools/run_tests --target=vm:aarch64
./tools/run_tests --aarch=armhf --build-only
./tools/set_test_target vm:aarch64 && source .envrc
cargo test

Change-Id: I60291fa726fb2298f62d1f032e55ed6e7ab1c4ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3221779
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-10-15 22:12:03 +00:00
Dennis Kempin
c4ec996103 Add new dev container and install-deps scripts
The new container just provides a standard debian box with a
rust toolchain.
Installation of dependencies has been extracted into scripts
which can also be used to set up a machine for development.

This will replace the current ./ci/ containers.

BUG=b:199950887,b:199950423
TEST=./tools/dev_container ./tools/run_tests

Change-Id: I832bc5b129246923df937a34614b4d74955304dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3221781
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
2021-10-15 22:12:02 +00:00
Dennis Kempin
af0144e51b testvm: Use prebuilts instead of building on-the-fly
We need to download a base image anyway, so we might as well make
that a full prebuilt of our VM image. This makes the initial
startup of ./tools/aarch64vm significantly faster. It also makes
it easier to add the prebuilt into a Docker dev container later.

Also move the VM data into the cargo target dir so we do not
dirty the src dir.

A Makefile for building and uploading the prebuilt has been added.

This change also moved the testvm code from ./tools/testvm into
./tools/impl so the python code can be shared with future scripts
(relative imports from other folders are tricky in Python).

BUG=b:199951064
TEST=./tools/aarch64vm ssh

Change-Id: I3fb57bfb8f7330b765e9be5ded821615ecddd841
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3221704
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-10-15 22:02:24 +00:00
Woody Chow
1b16db18bd devices: Add vhost-user snd vmm
BUG=b:184322202
TEST=tast run $DUT_IP vm.Audio*.vhost_user_cras
     (with https://crrev.com/c/3185059)

Change-Id: Icb3b2dd1268f183bf57754345b9302fd5e78a7ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2801654
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Woody Chow <woodychow@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
2021-10-15 04:51:19 +00:00
Tom Cherry
1cfd2d627d x86_64: pass the ramoops command line to bios
This was an oversight from the previous commit to pass the kernel
command line to a bios.

BUG=b:200208446
TEST=Observe pstore working across reboots

Change-Id: Ie93cc3399000a83099d396f4dde1da9d835704be
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3197732
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Tom Cherry <tomcherry@google.com>
2021-10-15 00:05:12 +00:00
Woody Chow
2e1332276e Reland "Add StreamEffect to new(_async)_capture_stream"
This is a reland of 79d6696394

Original change's description:
> Add StreamEffect to new(_async)_capture_stream
>
> It is needed to support AEC in virtio-snd (cras backend)
>
> BUG=b:201472965
> TEST=cargo test
>
> Change-Id: If79eee8a41d1da7e6d643e8187bbc75768f31ad9
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3193841
> Reviewed-by: Judy Hsiao <judyhsiao@google.com>
> Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
> Commit-Queue: Dennis Kempin <denniskempin@google.com>
> Tested-by: kokoro <noreply+kokoro@google.com>

Bug: b:201472965
Change-Id: I14f16dc8397e153ba54c676dabe396efda81cb82
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3222221
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Judy Hsiao <judyhsiao@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Woody Chow <woodychow@google.com>
2021-10-14 14:31:33 +00:00
Woody Chow
eaf4518b0d devices: virtio-snd cras-backend cleanup
in preparation for vhost-user device implementation.

* Use <I: SignalableInterrupt> in handle_*_queue methods. start_queue of
  VhostUserBackend has a different interrupt type.
* Avoid sharing of pcm queues to ctrl queue. start_queue of
  VhostUserBackend is called per queue, and provides the queue object
  for that queue only.

BUG=b:179755683
TEST=tast run $DUT_IP vm.Audio*.virtio_cras_snd

Change-Id: Ic53135ac317896f1ebeb3b11795e80736c466996
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3168560
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Woody Chow <woodychow@google.com>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
2021-10-14 09:15:06 +00:00
Dylan Reid
68c9bb610c Rutabaga: don't always build virglrenderer
If the virglrenderer feature isn't enabled, skip building virglrenderer.
This fixes cross-compiling for architectures that don't have libdrm
ready.

Change-Id: I397864ea6104896e1d12a838834d7d0b09a485be
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3221693
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2021-10-13 22:59:16 +00:00
Dennis Kempin
3b7a45792d Remove Cargo.lock from version control
The Cargo.lock file has been source of much annoyance and does not
really serve it's purpose in crosvm anyway. Both Android and ChromeOS
builds will not use Cargo.lock files but use their own infra to pin
dependencies to fixed versions.
Cargo.lock files are only used for development builds, but can cause
frequent merge issues, especially once our hacky 'setup_cros_cargo.sh'
script is involed.

Since we are planning to migrate towards bazel in the not-so-far future,
the easiest short term plan is to just remove Cargo.lock from version
control and deal with potential discrepancies in development builds.

BUG=None
TEST=None

Change-Id: I23736a61a4cc8131888d5ee2c19793066267f608
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3140584
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2021-10-12 19:28:43 +00:00
Jason Macnak
ab4be4298a rutabaga_gfx: rutabaga_gralloc: Handle device creation failure
... with mulitple devices. On my machine, Nvidia device creation
succeeds but then llvmpipe device creation fails because llvmpipe
reports having VK_EXT_external_memory_dma_buf but not
the required VK_KHR_external_memory_fd.

BUG=b:189133053
TEST=launch Cuttlefish w/ Vulkano enabled in Crosvm

Change-Id: I1709aa9895834be6b225104fbfda20e418ae7d1c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3203234
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Jason Macnak <natsu@google.com>
2021-10-12 19:13:10 +00:00
Woody Chow
5acd4ee978 snd: Add debug prints and comments to virtio-snd (cras)
BUG=None
TEST=cargo test

Change-Id: Id4d0795f9001215dea07b8ff4edeee723782d7c0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3217344
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Woody Chow <woodychow@google.com>
2021-10-12 05:29:41 +00:00
Junichi Uekawa
e2947e0f12 Reland "Dump backing File system type."
BUG=b:199094605
TEST=tast run localhost:2229 arc.Boot.vm_o_direct
  # logs: Disk image file is hosted on file system type ef53
TEST=emerge-hana crosvm

This is a reland of 4ea81e3003

Original change's description:
> Dump backing File system type.
>
> To aid investigation, the root file system image needs to reside on a
> file system with O_DIRECT support.
>
> BUG=b:199094605
> TEST=tast run localhost:2229 arc.Boot.vm_o_direct
>   # logs: Disk image file is hosted on file system type ef53
>
> Change-Id: Ifd393e7009721c697d3d23177129f187454534a8
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3203719
> Tested-by: kokoro <noreply+kokoro@google.com>
> Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
> Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>

Bug: b:199094605
Change-Id: Ie1cb9b515d7b95fd9b108e9a6963a7c77fee652e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3215931
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2021-10-11 23:10:07 +00:00
Daniel Verkamp
7fd815ed22 crosvm: switch to upstream tempfile crate
Use the crates.io implementation of tempfile instead of our own version.

Our reimplementation is kept in the tree for now in case of dependencies
outside of the crosvm tree; it can be removed later once those are fully
switched over to the crates.io implementation.

BUG=b:199204746
TEST=emerge-hatch crosvm

Change-Id: I07d3404239302ab9a17f4ddc82a9479b256e4eb4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3209839
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2021-10-11 18:35:55 +00:00
Junichi Uekawa
ce6cf4efe2 ci: Quote underscores.
My editor doesn't like them, and probably they should be.

BUG=None
TEST=read it.

Change-Id: I40041e41841e47cb386fcd12a4622efeca33474d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3215932
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
2021-10-11 18:28:42 +00:00
Woody Chow
0c9c4baa7f seccomp: Add timerfd_* to cras_snd_device.policy
Following CL:3047951 for cras_audio_device.
Without these, the device would crash under crostini.

BUG=b:198730031
TEST=tast run $DUT_IP crostini.PulseAudioBasic.*

Change-Id: I87a60b87461ff10594ebe7643a631630eabc94ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3213791
Auto-Submit: Woody Chow <woodychow@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Woody Chow <woodychow@google.com>
2021-10-11 05:10:11 +00:00
Jason Macnak
0024533253 rutabaga_gfx: rutabaga_gralloc: Request instance extensions
VK_KHR_external_memory requires VK_KHR_external_memory_capabilities which
requires VK_KHR_get_physical_device_properties2. Ash has started to check
that the instance extensions were required when creating devices.

BUG=b:189133053
TEST=launch Cuttlefish w/ Vulkano feature enabled in Crosvm

Change-Id: Ifaafda72500ccbd16dd461bcd5dc2633de4b8cfc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3203233
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2021-10-09 00:34:29 +00:00
Dennis Kempin
60102cdd2f Revert "Dump backing File system type."
This reverts commit 4ea81e3003.

Reason for revert: Breaks ToT. See: https://ci.chromium.org/ui/p/chromeos/builders/cq/hana-cq/b8833931827711281905/overview

Original change's description:
> Dump backing File system type.
>
> To aid investigation, the root file system image needs to reside on a
> file system with O_DIRECT support.
>
> BUG=b:199094605
> TEST=tast run localhost:2229 arc.Boot.vm_o_direct
>   # logs: Disk image file is hosted on file system type ef53
>
> Change-Id: Ifd393e7009721c697d3d23177129f187454534a8
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3203719
> Tested-by: kokoro <noreply+kokoro@google.com>
> Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
> Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>

Bug: b:199094605
Change-Id: I3da7c8284d1e6f2496e300d9f02c0063bbb5467c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3213363
Reviewed-by: Raul E Rangel <rrangel@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-10-08 19:05:47 +00:00
Daniel Verkamp
ecab88ad99 devices: virtio: block: suppress error for GET_ID
If the guest sends a VIRTIO_BLK_T_GET_ID request and the block device
does not have an ID configured, crosvm prints an error message:

  [devices/src/virtio/block/asynchronous.rs:191] failed executing disk
  request: unsupported (8)

Since there is no corresponding feature flag for GET_ID support, the
guest can only detect if the command is supported by just trying it.
However, the error message is confusing to the crosvm user, since this
request failure is not indicative of a problem, just a part of normal
operation.

To avoid this confusion, suppress the error message when GET_ID fails
while still returning the unsupported status to the guest.

BUG=None
TEST=crosvm run -r vm_rootfs.img vm_kernel # check syslog for no error

Change-Id: I05fcd3c428ff1314998ac88fd92d78423155dba3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3213115
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2021-10-08 17:01:37 +00:00
Junichi Uekawa
4ea81e3003 Dump backing File system type.
To aid investigation, the root file system image needs to reside on a
file system with O_DIRECT support.

BUG=b:199094605
TEST=tast run localhost:2229 arc.Boot.vm_o_direct
  # logs: Disk image file is hosted on file system type ef53

Change-Id: Ifd393e7009721c697d3d23177129f187454534a8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3203719
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
2021-10-08 07:07:50 +00:00
Chirantan Ekbote
84091e5331 Add vhost-user vsock vmm
Add the vmm side for the vhost-user vsock device.

BUG=b:179756331
TEST=Connect to vshd inside a VM with a vhost-user vsock device

Change-Id: I332adbb6f8d6cfc8dff16375e93d946ecad2e84b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3153213
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2021-10-08 07:00:06 +00:00
Chirantan Ekbote
f08bdddf58 Add vhost-user vsock device
Since vhost-user messages have a 1:1 mapping to vhost ioctls, this
device doesn't use DeviceRequestHandler but processes incoming messages
directly.

BUG=b:179756331
TEST=Connect to vshd inside a VM with a vhost-user vsock device

Cq-Depend: chromium:3105429
Change-Id: I9811e29282f7e79140be1203bce9030ec37a3343
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3153212
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-10-08 07:00:04 +00:00
Yusuke Sato
31e136aeda crosvm: Allow all vCPU threads to share same cookie for core scheduling
This CL adds --per-vm-core-scheduling command line option to crosvm
to allow ARCVM to use per-VM core scheduling for better performance.
Note that per-VM core scheduling makes all vCPU threads to share the
same core scheduling cookie.

The feature is disabled by default, and does not change Linux VMs
behavior unless the new command line flag is explicitly passed in.
Also, this CL never affect Parallels since it uses the plugin
infrastructure (src/plugin/).

For ARCVM, the feature will be enabled by default via Chromium's
base::Feature (see crrev.com/c/3207747) as an interim solution until
the optimized two-level core scheduling is ready. This is based on
the latest recommendation from the security team (newfel@, resch@,
and others) at go/arcvm-core-scheduling-recommendations.

Credit: This CL is based on an idea from joelhockey@ and bgeffon@
at go/exawj

BUG=b:194022819
TEST=boot ARCVM with the new flag and verify all vCPU threads have
  same cookie.

Change-Id: Ib97ab9942b2516df9fbffe35517919f29b309a83
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3101607
Commit-Queue: Yusuke Sato <yusukes@chromium.org>
Owners-Override: Yusuke Sato <yusukes@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Joel Hockey <joelhockey@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
2021-10-07 21:34:10 +00:00
Daniel Verkamp
cce4054aa8 third_party/minijail: uprev to commit 6aa0392
This includes https://r.android.com/1835176 in order to prevent bindgen
from modifying libminijail.rs on every build, causing the submodule to
be marked as dirty.

BUG=None
TEST=cargo build
TEST=./test_all

Change-Id: I73e97231c37ef49bff463b7cc282a1cb42d7bc84
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3209926
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2021-10-06 23:01:30 +00:00
Daniel Verkamp
31b6a00062 argument: convert to ThisError and sort
BUG=b:197143586
TEST=cargo check

Change-Id: I8d75003c65e647f1cf4962f390823d5c15169a57
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3105434
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org>
2021-10-06 21:38:37 +00:00
Daniel Verkamp
8eda3ea975 plugin: convert to ThisError and sort
BUG=b:197143586
TEST=cargo check

Change-Id: If39509d73741df08fdc876431dfc096ee0b8d158
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3105433
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org>
2021-10-06 21:38:36 +00:00
Daniel Verkamp
847cbf13c9 x86_64: convert to ThisError and sort
BUG=b:197143586
TEST=cargo check

Change-Id: I474afd84954c48a039306f6d7ba3c64b60b8cff5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3105432
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org>
2021-10-06 21:38:34 +00:00
Daniel Verkamp
a9f0fef04a vm_memory: convert to ThisError and sort
BUG=b:197143586
TEST=cargo check

Change-Id: Id769937e55f1f697dcd51fd390cc50d714d3c3b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3105431
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org>
2021-10-06 21:38:33 +00:00
Daniel Verkamp
c42ef90be1 vm_control: convert to ThisError and sort
BUG=b:197143586
TEST=cargo check

Change-Id: Ibf99cd24cc0c246fa1e70f3c91b45bc1716adf41
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3105430
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2021-10-06 21:38:32 +00:00
Daniel Verkamp
06875127b2 vhost: convert to ThisError and sort
BUG=b:197143586
TEST=cargo check

Change-Id: Ib3ecfa6e6c9fc88edcf592d511cacfd97b2dd195
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3105429
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2021-10-06 21:38:31 +00:00
Daniel Verkamp
3878e5c6ba usb_util: convert to ThisError and sort
BUG=b:197143586
TEST=cargo check

Change-Id: I747bd7889182addbe1781a6726f10f140c192d5e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3105428
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2021-10-06 21:38:30 +00:00
Daniel Verkamp
1fd68656a2 sys_util: convert to ThisError and sort
BUG=b:197143586
TEST=cargo check

Cq-Depend: chromium:3105311
Change-Id: Ie7978c8fa171340d18d9fabe1af21b27a0d18b94
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3105427
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2021-10-06 20:58:22 +00:00
Gurchetan Singh
0bef14dd62 rutabaga_gfx: match latest vulkano
- 'vulkano::device::DeviceExtensions::supported_by_device` deprecated
   * Use PhysicalDevice::supported_extensions instead

- formats now use VK naming convention, not Rust conventions

BUG=b:173630595
TEST=compile and run

Change-Id: Ibb1bdd8f98f9d6a5d38ac3605780a1ae8d818a6e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3203232
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Jason Macnak <natsu@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2021-10-06 17:37:16 +00:00
Gurchetan Singh
74a548181c rutabaga_gfx: add better error reporting
Both RutabagaError::SpecViolation and RutabagaError::Unsupported
are used as catch-alls for errors that don't fit any one
particular place.

With this change, RutabagaError::Unsupported means that a particular
function is not implemented.

RutabagaError::SpecViolation(..) now provides free-form debug
reporting for one-off errors.  However, it is recommended to create a
new RutabagaError variant if two instances of the same spec violation
are noticed.  Many new variants are added in CL in observance of this
recommendation.

In addition, we may create a CrossDomainError and RutabagaGrallocError
one day.  Currently, it doesn't make sense to do so at the moment.
But prefix the new variants accordingly if the need arises.

BUG=b:173630595
TEST=compile and run

Change-Id: Ie610c77445f4406b40bb40f00bcabb8e65c8e02d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3203231
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Jason Macnak <natsu@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2021-10-06 17:37:15 +00:00
Keiichi Watanabe
05a8da41ee devices: virtio: vhost: user: Refactor BlockBackend::new
BUG=b:194137301
TEST=run 'crosvm device block ...'

Change-Id: I378dfbc95ee941cdd86aad3c1c42fcdad2e26d0e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3149875
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
2021-10-06 17:02:59 +00:00
Keiichi Watanabe
fe64430445 main: Don't initialize syslog twice for device command
Remove `syslog::init()` in `start_device(), as it's called in
`crosvm_main()`.

BUG=none
TEST=cargo build

Change-Id: Ibe2fe08382525c8eee8dfe33b7949c0f8b0f545e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3165617
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
2021-10-06 17:02:58 +00:00
Keiichi Watanabe
a493fc52d0 mdbook: Generate cargo-doc by GitHub Actions
BUG=b:199874828
TEST=run in my GitHub account

Change-Id: Ie456a90731ccedc4934a13110902ea153fce23ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3159891
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2021-10-06 15:10:23 +00:00
Allen Webb
bfc3f64598 sys_util: Convert mmap::Error over to thiserror::Error.
This conversion adds source attribution for wrapped errors and
implicitly implements std::error::Error for mmap::Error which was
missing before.

Also some compile time warnings were fixed for the mmap::arena_msync
test case.

BUG=None
TEST=cargo test

Change-Id: I13b6257692887bcd7229f1cb59c10edb850d0a65
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3207106
Auto-Submit: Allen Webb <allenwebb@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Allen Webb <allenwebb@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
2021-10-06 13:07:38 +00:00
Dennis Kempin
f0dd0588ca Disable integration tests temporarily
Something in our Kokoro infrastructure has changed and the tests
are timing out.
Disabling the tests to get things unblocked while I further
investigate.

BUG=b:202196400
TEST=Kokoro

Change-Id: I852cf254013f8c3ebe0e44bab510609df21d260c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3207108
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Abhishek Bhardwaj <abhishekbh@chromium.org>
Auto-Submit: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Abhishek Bhardwaj <abhishekbh@chromium.org>
2021-10-05 23:14:07 +00:00
Tomasz Nowicki
344eb144bc linux: Instantiate VFIO platform device
Extend VFIO command line option to specify full path to VFIO platform
device that is going to be assigned.

BUG=b:185504618
TEST=trogdor64-manatee SDHCI and GENIQUP device passthrough boots/works

Change-Id: Iad6a24124b383fadb9e025dc64f8a90fa8763ff8
Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2961217
Commit-Queue: Micah Morton <mortonm@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-10-04 19:02:18 +00:00
Tomasz Nowicki
b8957f90a8 devices: vfio: Add VFIO platform support
Platform device is another type of device which might be assigned
directly to VM by using the same IOMMU DMA isolation technique.
In contrary to PCI, platform device has no config space which
describes device resources and makes it self-contained and
self-discoverable. Therefore, platform device resources are described in
FW and host is the one who enumerates/probes devices by parsing DT/ACPI.
We have ioctl i/f which allows to expose all that info to VMM.
Add platform bus specific calls to interact with host properly and
plug in to aarch64 bus creation code.

Note, for now all IRQs are abstracted to wired line (SPI in ARM GIC world)
which means guest wont see MSI-X for platform devices.

BUG=b:185504618
TEST=trogdor64-manatee SDHCI and GENIQUP device passthrough boots/works

Change-Id: Id0e9efde3586af77ed1d0b8bf79ca485906afb83
Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2961216
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Tomasz Nowicki <tnowicki@google.com>
Commit-Queue: Micah Morton <mortonm@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-10-04 17:06:19 +00:00
Tomasz Nowicki
eb2a4fb623 devices: vfio: Get info about device's IRQs
Some devices (like platform device) has no PCI config which describes
associated IRQs. Instead, IRQs are described either via DT or ACPI.
In any case, host is the one who keeps that info and needs to expose
to VMM. Add function to collect IRQs info for further processing.

BUG=b:185504618
TEST=trogdor64-manatee SDHCI and GENIQUP device passthrough boots/works

Change-Id: Ica7d60d50b905968285f61722897ef150d419a56
Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2961215
Commit-Queue: Tomasz Nowicki <tnowicki@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-10-04 16:58:21 +00:00
Tomasz Nowicki
348e32451a devices: vfio: Extend MMIO region queries
In preparation for adding VFIO platform support add function which
allows to get number of regions and size of specific region.

BUG=b:185504618
TEST=trogdor64-manatee SDHCI and GENIQUP device passthrough boots/works

Change-Id: I4ad99d7658d5b76cae4aa686b2b1f772e2bc3e44
Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2961214
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Micah Morton <mortonm@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-10-04 16:39:24 +00:00
Tomasz Nowicki
d7cbad7707 resources: Introduce new allocator for VFIO platform device
DT platform bus abstraction requires its own MMIO address range.
Let it allocate from well defined address range.

BUG=b:185504618
TEST=trogdor64-manatee SDHCI and GENIQUP device passthrough boots/works

Change-Id: I357e909433a565968a7f081c727a3b1e420e7729
Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2961212
Commit-Queue: Micah Morton <mortonm@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-10-04 16:32:47 +00:00