Commit graph

5360 commits

Author SHA1 Message Date
Daniel Verkamp
f50029e071 kernel_loader: accept physical address offset
This interprets the p_paddr field of ELF program headers as an offset
into physical RAM on aarch64 systems, which is a change in behavior. We
pass an offset of 0 on x86-64, so it makes no difference there.

BUG=b:254601048
BUG=b:255697205
TEST=cargo test -p kernel_loader

Change-Id: I9ebaa285c4cde1f70cb7752e91ff4520e06dc82f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4035738
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-11-28 19:41:53 +00:00
Daniel Verkamp
94f130c23d crosvm: remove argument module
Everything has been migrated to argh and serde_keyvalue, so we can
remove the old argument parsing code now.

The parse_hex_or_decimal() function is still used in a few places in
config.rs, so move it there for now.

BUG=b:255223604
TEST=cargo build

Change-Id: Ic2d66a7fac7c3ff00b9521c56a719dd23883284b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4049038
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-11-28 19:22:30 +00:00
Daniel Verkamp
a444d2592e config: parse --userspace-msr with serde_keyvalue
This removes the last caller of parse_key_value_options().

BUG=b:255223604
TEST=cargo test

Change-Id: Ia17eb320094ee3d46f0db238f2077163e257b7f8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4049037
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-11-28 19:18:06 +00:00
Keiichi Watanabe
2eb36ff983 base: syslog: Preserve stderr FD when spawning
We need to keep stderr FD when spawning processes. Otherwise, log
messages won't be emitted to stderr.
This affects the cases where we spawn device processes such as:
* "crosvm run" without --disable-sandbox,
* virtiofs device, which create its own jail,
* "crosvm devices", which spawn sub processes

BUG=none
TEST=check log messages in virtio-{block,fs} are shown in stderr

Change-Id: If60845d73290a42c863e6c6f4e75869644f659d0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4054212
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
2022-11-28 19:12:37 +00:00
Daniel Verkamp
ea7a5f2b3a devices: pci: stub: parse arguments with serde_keyvalue
Migrate the --stub-pci-device parameters to serde_keyvalue from
parse_key_value_options().

The deprecated `multifunction` option is dropped, as the only caller was
crosvm-direct.sh and it has since been fixed.

BUG=b:255223604
TEST=cargo test -p devices stub
TEST=Run crosvm with --stub-pci-device options; lspci

Change-Id: I3ed0cf52179020bcd1665540dc9bc9e66e17b85e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4049030
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-11-28 18:55:40 +00:00
recipe-roller
14caa2558e Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (depot_tools) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8796231807336053585

depot_tools:
d83509c0c3
  d83509c (gavinmak@google.com)
      Move presubmit_canned_checks tests under tests/ and fix

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: If20322f42e5e2679046198d6b22f5142ca7c5201
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4060239
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2022-11-28 17:47:35 +00:00
Pujun Lun
d17c3e78b5 crosvm: fix the default value of use_vulkan for Windows.
Missed an "s" in the feature flag.

BUG=b:254284360
TEST=presubmit

Change-Id: Iecdb93daca291bc65e61019b484569e25010241e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4059394
Commit-Queue: Pujun Lun <lunpujun@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-11-28 16:40:44 +00:00
Daniel Almeida
ea95da182d video: decoder: vaapi: refactor BufferMapping through AsBufferHandle
BufferMapping could previsouly hold a BufferHandle. Make it more generic
so that it can hold types that can convert themselves to a BufferHandle
instead.

This also simplifies the type considerably, as it only takes a single type
parameter instead of two.

BUG=b:214478588
TEST="cargo build --features=video-decoder,vaapi; Fluster still works"

Change-Id: Idcaf4d0a074609e3155daa596e262810149fe037
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4046944
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-11-28 04:32:49 +00:00
Daniel Almeida
0d7683960a video: decoder: vaapi: move VaapiDecoderSession closer to its impl
Move VaapiDecoderSession closer to its impl for tidiness. Also, if
BufferMapping - which is currently in the middle of them - is extended,
we do not want to widen this gap even further.

BUG=b:214478588
TEST="cargo build --features=video-decoder,vaapi"

Change-Id: I1045e04a313e5d7ee62b313f42923333192ac722
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4046943
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-11-28 04:22:06 +00:00
recipe-roller
ab112e8148 Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (depot_tools) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8796493535133803569

depot_tools:
0115386a26
  0115386 (brucedawson@chromium.org)
      Switch from VS 2017/2019 support to VS 2019/2022

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: I1c5dcf11b18fc15d422087ecfa1b4c0cdd93bedc
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4058046
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2022-11-25 20:29:04 +00:00
Pujun Lun
38182f458e crosvm: merge --gpu-display into --gpu in CLI.
Now that serde_keyvalue is capable of parsing vectors and
sub-structs, we are making the following pattern the official way
of providing display parameters:

--gpu backend=3d,displays=[[mode=windowed[800,600]],\
    [mode=borderless_full_screen]]

The reasons for this change are:
(1) We will likely use this syntax for other CLI options as well.
(2) We only support one single virtual GPU as of today, but
    technically we could support multiple. When we add that
    support, there is no ambiguity as to which display is connected
    to which GPU with this syntax.

For backwards compatibility, we will preserve the following ways to
provide display parameters:
(1) --gpu width=800,height=600 (which implies windowed mode)
(2) --gpu-display mode=windowed,width=800,height=600 \
        --gpu-display mode=borderless_full_screen

BUG=b:254284360
TEST=presubmit

Change-Id: I7f0078b7cf7554c1e93882afce47a4a2a3170a78
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3984545
Commit-Queue: Pujun Lun <lunpujun@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-11-24 18:06:22 +00:00
Pujun Lun
81f42c1a36 crosvm: update CLI syntax for specifying DPI for displays.
The current syntax is:
--gpu-display horizontal-dpi=100,vertical-dpi=200

We would like to change that to:
--gpu-display dpi=[100,200]

We will keep the backward compatibility for now, but the caller
should not use both of syntax at the same time.

FixedGpuDisplayParameters is introduced for backward compatibility
support, and it will be removed once the old syntax is deprecated.

BUG=b:260101753
TEST=presubmit

Change-Id: I66a31c448ecc1eba60f6d1cbcbc753315c6c1df6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4049340
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Jason Macnak <natsu@google.com>
Commit-Queue: Pujun Lun <lunpujun@google.com>
2022-11-24 17:43:55 +00:00
Takaya Saeki
e299f02d3f seccomp: allow clone3 to video_device on x86
Recently, common_device.policy added clone3. It is included by most
devices through include, but the video device missed it since it doesn't
include common_device.policy due to some policy override.

This commit adds clone3 to the policy of the video device to fix that
problem. With this fix, the video device successfully runs in the
sandbox on newer kernels.

BUG=None
TEST=a vm with a video device launches with the sandbox enabled

Change-Id: Idc2dee824e863f3ee43cfd6ce76656e36d6200c0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4053447
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Takaya Saeki <takayas@chromium.org>
2022-11-24 09:40:27 +00:00
Alexandre Courbot
cd34ddcff7 docs: book: document how to specify command-line options and configuration files
Document the format and rules for specifying command-line options, and
add a section on how configuration files can also be used.

BUG=b:218223240
TEST=mdbook build

Change-Id: Ieec40315b7ae8212c6a5b60280440abc9a5e92e6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4040820
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-11-24 09:28:57 +00:00
Keiichi Watanabe
e060d6c639 e2e_tests: Add vhost-user block with devices command
BUG=b:243127910
TEST=./e2e_tests/run

Change-Id: I22dfc4e1d75ff0b310a5f624568b390d2dba6c1e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4054811
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-11-24 09:16:00 +00:00
Keiichi Watanabe
6adf8e8a15 crosvm: cmdline: Improve "devices"'s help for block device
Describe the `vhost=<socket>` option, which is not in `crosvm run`'s
help.

BUG=none
TEST=crosvm devices --help

Change-Id: If95e3eaf8d11632de9034a3ac3b44ecd377e887a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4054810
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-11-24 09:16:00 +00:00
Keiichi Watanabe
d9d74da342 e2e_tests: Add vhost-user block test
BUG=b:243127910
TEST=./e2e_tests/run

Change-Id: Iae16498f79f1395a6aa7ab834addc3e30d767164
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3820966
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-11-24 08:49:34 +00:00
Keiichi Watanabe
6ec82a2305 e2e_tests: fixture: Move VM-specific logic to a separate module
To prepare adding more fixtures such as logic for vhost-user device,
move the existing code to create a VM to a separate module.
Specifically, move the all code in e2e_tests/tests/fixture/mod.rs into
e2e_tests/tests/fixture/vm.rs.

BUG=b:243127910
TEST=./e2e_tests/run

Change-Id: I23e6e5db35ce09b5003f37a9a44f9fda8f502809
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4028760
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-11-24 08:14:05 +00:00
Keiichi Watanabe
c789769acf devices: virtio: fs: Include tag name in worker thread name
This will allow us to identify virtiofs threads in tracing tools such
as perfetto.

BUG=b:260038313
TEST=run arcvm

Change-Id: I198b599a3f710742fc549ab6ae376ad4cb661fc0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4045667
Reviewed-by: David Stevens <stevensd@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-11-24 04:57:25 +00:00
Keiichi Watanabe
5e35436666 devices: virtio: Shorten virtio worker threads' names
Rename each virtio device's worker thread name to the form of
"v_{device type}".
e.g. "v_blk" for virtio-blk

This change allows us to embed more information in the thread names
whose length must not exceed 15. For example, we can embed ID for each
block device thread so we can distinguish threads in `ps` and tracing
tools.

BUG=b:260038313
TEST=CQ

Change-Id: I039421c46e9b28f2cb82f7fc644929ba325e895a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4045666
Reviewed-by: David Stevens <stevensd@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-11-24 04:52:45 +00:00
Keiichi Watanabe
5b456d31f9 vmm_vhost: slave_req_hander: Wait before vhost-user message body
When vhost-user front-end send a vhost-user message via Unix domain
socket, a message header is sent first with optional attached files.
Then, a message body is sent as a separate packet if necessary.
However, the existing implementation blocks only before a
message header coming and assumed that the message body is ready when
the header comes. So, there was a race and `handle_request` could return
`EAGAIN`.

This CL splits SlaveReqHandler::handle_request() into recv_header() and
process_message() so a caller can wait between the header and the
additional payload.

On VVU, we shouldn't wait before receiving the payloads because the
proxy device forwards a header and its message body together. So we
check the protocol in needs_wait_for_payload().

BUG=b:237891754
TEST=Run vhost-user block on Linux
TEST=Run vhost-user block on Windows
TEST=Run VVU block on Linux

Change-Id: I35af3eb0e706cb005bf697397698e01e272b0704
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3863050
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-11-24 04:21:56 +00:00
recipe-roller
c5eff6497e Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (recipe_engine) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8796660249901124465

recipe_engine:
ff5ce51cea
  ff5ce51 (sshrimp@google.com)
      Revert "Check created_by to ensure cq tags were copied on retry...

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: I5fb062358357e9fd96892593ee106d8a833b1f5c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4054540
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2022-11-24 00:17:43 +00:00
Daniel Verkamp
d928670ce8 windows: remove set_bootstrap_arguments()
This function is not called anymore, so it can be removed.

https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3846055

BUG=b:238361778
TEST=tools/dev_container tools/run_tests --platform=mingw64

Change-Id: Ie7bb0b2eafb0643693376c560d08b486dd404907
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4049029
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
2022-11-23 19:10:38 +00:00
recipe-roller
61be9ecf94 Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (recipe_engine) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8796733867438855377

recipe_engine:
189a0bb4a1
  189a0bb (akashmukherjee@google.com)
      [bcid] Uprev provenance broker tool.

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: Id8ba7421e1c41060ccba1224a5c1e5e36e4ac5a2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4050117
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2022-11-23 04:47:49 +00:00
recipe-roller
205aa45951 Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (depot_tools) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8796738271362991841

depot_tools:
60af816019
  60af816 (zhihuixie@google.com)
      depot_tools: Roll rdb and result sink

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: Icd691e699cabe75f6edc5e0af373a186179de6c8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4050114
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2022-11-23 03:37:25 +00:00
Alexandre Courbot
e8cbbb457c crosvm: rename executable_path positional argument to kernel
This is a shorter and more explicit name, and is also what qemu uses for
the same parameter.

Since this is a positional argument, it doesn't affect command-line
argument handling, only the (currently unused) configuration files.

BUG=b:255223604
TEST=None

Change-Id: Ice01335a690550e5afd05b93c6c968b0d0859f32
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4044726
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-11-23 01:58:23 +00:00
Alexandre Courbot
07fc7dbecd crosvm: use kebab-case for disk options
The rule for crosvm options is that they should be specified in
kebab-case. Switch the disk options to that format, while also keeping
camel_case aliases for compatibility.

BUG=b:255223604
TEST=--block option works with both block-size and block_size
parameters.
TEST=cargo test -p devices block::tests::params_from_key_values
TEST=cargo test -p e2e_tests boot_test_vm

Change-Id: Ie095565ca4b27d59ed86ddc0613419e45749b3fa
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4040818
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-11-23 01:57:04 +00:00
Elie Kheirallah
daa000e659 crosvm: cmdline: Add Snapshot command to crosvm
Bug=b:232437513, b:253937826
Test=cargo build

Change-Id: I3e90e5dc86e53a7b2fa0eae6be2f63fcb91a345e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3924744
Commit-Queue: Elie Kheirallah <khei@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Elie Kheirallah <khei@google.com>
2022-11-22 23:04:56 +00:00
recipe-roller
92811aa9de Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (recipe_engine) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8796757134052351249

recipe_engine:
6fefccf8bd
  6fefccf (bpastene@chromium.org)
      Allow chrome branch projects to call cq recipe_mod's owner_is_g...

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: I754eae9986c00da65e68533ddd17b56891ce87ca
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4049482
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2022-11-22 22:37:29 +00:00
Takaya Saeki
984a2f7c8b devices: virtio: improve the comment on a memory fence in Queue::peek
Improve the comment on why a fence is necessary in the middle of
`Queue::peek` so that it gets clearer.

BUG=b:258630435
TEST=`./tools/dev_container ./tools/presubmit` passed

Change-Id: I63f80975e6d04665948a6036998e7ed6e24be64c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4045661
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-11-22 11:22:22 +00:00
Alexandre Courbot
59530f1e1a crosvm: fix --net documentation
The documentation for the --net command-line option was not properly
formatting and had a few trailing words. Also add an OR keyword to
clarify that the keys are mutually exclusive.

BUG=b:255223604
TEST=crosvm run --help

Change-Id: Ib0980c3294828eeccf00e3609b21d829c5da9fb1
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4040819
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-11-22 02:42:00 +00:00
recipe-roller
0181c12b23 Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (depot_tools) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8796834531760911953

depot_tools:
30e3ce8b1c
  30e3ce8 (ukai@google.com)
      Roll out goma client VERSION=255

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: I9370aa823339d9ed5b2b72fc3741927a7162af93
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4043495
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2022-11-22 02:11:28 +00:00
David Stevens
34d7f69f27 swap: fix for VMs with highmem
Handle the case where VM memory is split up into multiple regions by
taking into account the region end when swapping out memory. Also rename
SwapFile.len to SwapFile.num_pages to make the units clear.

BUG=b:215093219
TEST=cargo test --package base
TEST=enable/disable swap on VM with >4GB of memory

Change-Id: I8dcdadd39c3f7cbd22c1c042498153966a1a0431
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4040653
Commit-Queue: David Stevens <stevensd@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Shin Kawamura <kawasin@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-11-22 02:08:53 +00:00
Takaya Saeki
1fe0c44816 devices: virtio: fix a memory ordering bug in Queue::peek on arm
Currently, `Queue::peek` does the following steps for reading and
checking `avail_index`. 1. Reads the current `avail_index` 2. Checks if
`avail_index` meets the condition to go further. 3. If so, read the
current the descriptor index. This works fine on x86. However, on Arm,
which has weak-memory model, the memory read for the third step could
happen before the memory read for the first step since there is no fence
between the first and the third steps. That causes reading a stale value
for the descriptor.

This commit adds a fence between them to fix potential race condition
bugs caused by reading stale descriptor values.

Note it is not fine to move the fence in `Queue::get_avail_index` from
the beginning of it to the end of `get_avail_index`. This is because all
other virtqueue access APIs such as `set_avail_event` also have fences
at the beginning of them. If you move the fence in `get_avail_index` to
the end of `get_avail_index`, the sequence of `set_avail_event` and then
`get_avail_index` loses a fence between them.  Because this is a "write
-> read" operations, losing a fence between them causes memory order bug
in both x86 and arm. Thus, we add another fence in this commit instead.

BUG=b:258630435
TEST=`./tools/dev_container ./tools/presubmit` passed

Change-Id: I693f1bc511fcc6fc2f3b0d7739c318483992280f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4041909
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Commit-Queue: Takaya Saeki <takayas@chromium.org>
2022-11-22 01:57:48 +00:00
Idan Raiter
21e083a108 device: vhost-user: Bring up Windows GPU
Brings up the Windows vhost-user GPU, when there is a vhost-user flag.
Otherwise, uses the original worker in the main process.

- Creates backend and VMM configs in broker.

- Always passes the VMM config to the main process.

- Passes backend config either to main or the vhost-user process.

- Create exit read / write event pair in broker, so GPU can request it
  from its process (on Windows, when we close the rendering window).

BUG=b:243061269
TEST=downstream / presubmit

Change-Id: I373e59e936bc21580e7962942742750444807093
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3968458
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Idan Raiter <idanr@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
2022-11-21 20:05:59 +00:00
Idan Raiter
7b846137b6 devices: gpu: Remove kiwi tubes
Let's remove the tubes:

1) gpu_device_service_tube - We diverge downstream nearly everywhere due
   to other tubes passed just like it. Reducing merge conflicts should
   happen maybe via structs, but we are already paying the cost anyway
   when code changes next to this tube (due to the other differing args)
2) gpu_main_display_tube - We will be moving this to the wndproc thread
   when upstreaming further work on it, so there is no need to keep the
   old version around.

BUG=b:243061269
TEST=presubmit, cargo build

Change-Id: I241922952d34a212dcb412bc1f0391f8473d8a61
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4033254
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Pujun Lun <lunpujun@google.com>
Commit-Queue: Idan Raiter <idanr@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-11-21 19:51:34 +00:00
Clarissa Garvey
76cf0e6bf6 Fix straggler needless_return violations
These are not caught during presubmit or when running cargo clippy but
nonetheless exist and should be cleaned up.

BUG=b:157245930, crbug:908640
TEST=cargo build

Change-Id: I8b4d79bf224b800fbdfeaa7729c5f283d42908e9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4039522
Auto-Submit: Clarissa Garvey <clarissagarvey@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-11-21 19:00:07 +00:00
Alexandre Courbot
3ef6e12b19 crosvm: allow creation of video devices from the configuration file
Now that the video-related options are stable, we can enable their
creation from the configuration file.

BUG=b:255223604
TEST=video decoders and encoders specified in the configuration file are
properly instantiated.

Change-Id: I57efb7ee984ac92f3a81f742dea814d56cce67c0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3974355
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-11-21 12:02:28 +00:00
Alexandre Courbot
884ea737c3 e2e_tests: add test for booting a VM from a configuration file
Add `boot_test_vm_config_file`, which boots a VM similar to
`boot_test_vm`, but using a configuration file instead of command-line
options wherever possible.

BUG=b:218223240
TEST=cargo test -p e2e_tests boot_test_vm

Change-Id: I45f82bfa8201776081e18c50011d928d8c7be0f0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4022749
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-11-21 12:00:39 +00:00
Keiichi Watanabe
667a582781 swap: Fix cargo-doc warnings
BUG=none
TEST=./tools/cargo-doc

Change-Id: I395c7a51fb972d1333127c1e38faa4cedaea14b1
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4042042
Reviewed-by: David Stevens <stevensd@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-11-21 10:46:56 +00:00
Alexandre Courbot
bacf3f7701 crosvm: use structure to specify memory options
We currently have many different memory-related options. This does not
play well with the idea of having them in a configuration file, where
they would ideally be grouped under a single "mem" section.

Turn the `mem` option into a struct, which currently only has one member
specifying the desired RAM size. This makes the struct compatible with
the existing argument (since the first argument of a struct does not
need to be explicitly mentioned), which allowing us to extend the struct
with more options in the future.

This allows us to enable the `mem` option in configuration files.

BUG=b:255223604
TEST=cargo test parse_mem_opts

Change-Id: I24c324002e4e399e5be492bbc9ddcac7fd2b349e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4033213
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-11-21 08:54:28 +00:00
Alexandre Courbot
bb43593a19 crosvm: use structure to specify CPU options
We currently have many different CPU-related options. This does not play
well with the idea of having them in a configuration file, where they
would ideally be grouped under a single "cpus" section.

Turn the `cpus` option into a struct, which currently only has one
member specifying the number of cores we want. This makes the struct
compatible with the existing argument (since the first argument of a
struct does not need to be explicitly mentioned), which allowing us to
extend the struct with more options in the future.

This allows us to enable the `cpus` option in configuration files.

BUG=b:255223604
TEST=cargo test parse_cpu_opts

Change-Id: I1bc856a935be4774926dcba8b0714f5835feeed9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4033212
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-11-21 08:48:42 +00:00
Keiichi Watanabe
20863a3c36 devices: Enable net_util/slirp if slirp is enabled
This is needed to build the `devices` crate only for the windows target.

BUG=none
TEST=cargo test --target=x86_64-pc-windows-gnu --features=slirp in devices

Change-Id: I781def962a716e4ee2ea80f3c6d1a426fc92e2e8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4028759
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-11-19 07:13:20 +00:00
Chia-I Wu
e51529fa92 seccomp: allow process_vm_readv to video_device on aarch64
libvda uses libmojo which uses libbase-core.so from libchrome.

After a recent change, libase-core.so's EarlyFeatureAccessTracker tracks
early accesses to features and saves the stacks of the callers using
libunwind.  On aarch64, libunwind can use process_vm_readv.

BUG=b:259631550
TEST=autologin.py -a on trogdor

Change-Id: I40b432eea72993a8a000b5aadf856a376f954835
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4034854
Commit-Queue: Chia-I Wu <olv@google.com>
Auto-Submit: Chia-I Wu <olv@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-11-18 22:42:55 +00:00
Daniel Verkamp
72ed5576be main: enable args_split unit tests on Windows
These tests work correctly on Windows as well, so remove the check that
made them only run on Linux.

BUG=b:238361778
TEST=tools/dev_container tools/run_tests --platform=mingw64

Change-Id: I775cfe66f3324aee3b83c9deeb93a019f4b07296
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4032428
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
2022-11-18 20:33:42 +00:00
Rob Clark
ed9da38359 crosvm: virtgpu: Increase queue size
When userspace batch frees many buffers, it can end up starving waiting
for virtqueue slots to free up.  The reason is this involves sending
many small cmd messages to host (DETACH_RESOURCE, UNMAP_BLOB, and
RESOURCE_UNREF), which despite being small each consume one slot.  This
starvation leads to janks / fps-stutters.

(I have some WIP perfetto support to monitor # of free slots in ctrl
queue, and based on that 512 seems to be enough to avoid starvation.  We
can always increase it more later if we find a scenario where 512 isn't
enough for everyone.)

BUG=b:230582047
TEST=play grimvalor recording perfetto trace

Change-Id: I5348c619bca7a3b629020e11415a7cac53212cba
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4038124
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Auto-Submit: Rob Clark <robdclark@chromium.org>
Commit-Queue: Rob Clark <robdclark@chromium.org>
2022-11-18 19:21:50 +00:00
Shintaro Kawamura
c64af719a7 devices: virtio: replace Arc<Interrupt> with Interrupt
Interrupt now supports Clone at crrev.com/c/3858693. Arc is no longer
needed.

BUG=b:244204463
TEST=tools/presubmit --all

Change-Id: Ieacfc0970da5f5727ec9324d6585edbdb785bc98
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4037077
Auto-Submit: Shin Kawamura <kawasin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-11-18 18:56:17 +00:00
recipe-roller
08d227ac68 Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (recipe_engine) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8797135247937804897

recipe_engine:
b63398006f
  b633980 (kuanhuang@chromium.org)
      LUCI Analysis: roll the proto.

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: If3c861238f68f5b1d8cd4ce15612bb43341e78ed
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4035613
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2022-11-18 18:31:57 +00:00
recipe-roller
466fcc7c86 Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (depot_tools) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8797138405968995889

depot_tools:
31ca877242~..a0cf432171805ee5663ef0b64585f35792e1f3d2
  31ca877 (brucedawson@chromium.org)
      Fix CheckLicense tests
  a0cf432 (brianosman@google.com)
      Tweak ninja fallback logic

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: I21f1e561614f024e45d3370c097e929643477e5d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4038421
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2022-11-18 17:41:30 +00:00
Shintaro Kawamura
937a163518 swap: fix cursor in PageHandler::copy_all()
BUG=b:215093219
TEST=None

Change-Id: I9cf132e178d7dce922577ef214788ec1485a85fd
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4037069
Reviewed-by: David Stevens <stevensd@chromium.org>
Auto-Submit: Shin Kawamura <kawasin@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
2022-11-18 07:22:00 +00:00